Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Options for compressed content #2006

Closed
asfimport opened this issue Sep 12, 2007 · 16 comments
Closed

Options for compressed content #2006

asfimport opened this issue Sep 12, 2007 · 16 comments

Comments

@asfimport
Copy link
Collaborator

Sebb (Bug 43363):
JMeter automatically decodes certain types of compressed content.

It might be useful to be able to switch off the decoding - so the compressed
response can be stored. Also it would be useful to have a way to record the
compressed size as well as the uncompressed size.

OS: other

@asfimport
Copy link
Collaborator Author

@asfimport
Copy link
Collaborator Author

@asfimport
Copy link
Collaborator Author

@milamberspace (migrated from Bugzilla):
Created attachment response_size_v20110413.patch: New version

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
(In reply to comment 3)

Created an attachment (id=26879) [details]
New version

Looks good to me.

@asfimport
Copy link
Collaborator Author

@milamberspace (migrated from Bugzilla):

URL: http://svn.apache.org/viewvc?rev=1091965&view=rev
Log:
Change strategy to get response size (use CountingInputStream from Commons IO)
View Results Tree - Add new size fields: response headers and response body (in bytes) - derived from #2006
Size Assertion - Add response size scope (full, headers, body, code, message) - derived from #2006

Modified:
jakarta/jmeter/trunk/bin/jmeter.properties
jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/SizeAssertion.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/assertions/gui/SizeAssertionGui.java
jakarta/jmeter/trunk/src/components/org/apache/jmeter/visualizers/SamplerResultTab.java
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/resources/messages_fr.properties
jakarta/jmeter/trunk/src/core/org/apache/jmeter/samplers/SampleResult.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC3Impl.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPJavaImpl.java
jakarta/jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSampleResult.java
jakarta/jmeter/trunk/test/src/org/apache/jmeter/assertions/SizeAssertionTest.java
jakarta/jmeter/trunk/xdocs/changes.xml
jakarta/jmeter/trunk/xdocs/usermanual/component_reference.xml

@asfimport
Copy link
Collaborator Author

@milamberspace (migrated from Bugzilla):
Created attachment TestSize.jmx: Test cases for issue to HttpClient 4.1 get size

@asfimport
Copy link
Collaborator Author

@milamberspace (migrated from Bugzilla):
milamber@bothari2:~/W-workspaces/Workspaces-JMeter/Jmeter-integration/lib$ ls -l
total 11604
-rw-r--r-- 1 milamber milamber 4202 4 mars 11:34 aareadme.txt
-rw-r--r-- 1 milamber milamber 69409 4 mars 23:23 activation-1.1.1.jar
drwxr-xr-x 3 milamber milamber 4096 16 mars 23:38 api
-rw-r--r-- 1 milamber milamber 72851 4 mars 23:14 avalon-framework-4.1.4.jar
-rw-r--r-- 1 milamber milamber 113369 4 mars 23:14 bsf-2.4.0.jar
-rw-r--r-- 1 milamber milamber 19174 4 mars 23:14 bsf-api-3.1.jar
-rw-r--r-- 1 milamber milamber 383846 4 mars 23:16 bsh-2.0b5.jar
-rw-r--r-- 1 milamber milamber 37175 18 avril 23:08 bshclient.jar
-rw-r--r-- 1 milamber milamber 73098 2 avril 16:36 commons-codec-1.5.jar
-rw-r--r-- 1 milamber milamber 575389 4 mars 23:16 commons-collections-3.2.1.jar
-rw-r--r-- 1 milamber milamber 305001 4 mars 23:16 commons-httpclient-3.1.jar
-rw-r--r-- 1 milamber milamber 159509 2 avril 16:37 commons-io-2.0.1.jar
-rw-r--r-- 1 milamber milamber 132165 4 mars 23:16 commons-jexl-1.1.jar
-rw-r--r-- 1 milamber milamber 284220 2 avril 16:37 commons-lang-2.6.jar
-rw-r--r-- 1 milamber milamber 60686 4 mars 23:17 commons-logging-1.1.1.jar
-rw-r--r-- 1 milamber milamber 180792 4 mars 23:17 commons-net-1.4.1.jar
drwxr-xr-x 3 milamber milamber 4096 16 mars 23:38 doc
-rw-r--r-- 1 milamber milamber 56089 4 mars 23:17 excalibur-datasource-1.1.1.jar
-rw-r--r-- 1 milamber milamber 17669 4 mars 23:17 excalibur-instrument-1.0.jar
-rw-r--r-- 1 milamber milamber 76725 4 mars 23:17 excalibur-logger-1.1.jar
-rw-r--r-- 1 milamber milamber 44462 4 mars 23:17 excalibur-pool-1.2.jar
drwxr-xr-x 3 milamber milamber 4096 17 avril 10:39 ext
-rw-r--r-- 1 milamber milamber 32359 4 mars 23:23 geronimo-jms_1.1_spec-1.1.1.jar
-rw-r--r-- 1 milamber milamber 71952 23 sept. 2006 htmllexer-2.0-20060923.jar
-rw-r--r-- 1 milamber milamber 138838 23 sept. 2006 htmlparser-2.0-20060923.jar
-rw-r--r-- 1 milamber milamber 351132 21 mars 21:59 httpclient-4.1.1.jar
-rw-r--r-- 1 milamber milamber 181801 15 avril 08:41 httpcore-4.1.1-20110414.220809-1.jar
-rw-r--r-- 1 milamber milamber 26889 21 mars 21:59 httpmime-4.1.1.jar
-rw-r--r-- 1 milamber milamber 142391 2 nov. 2003 jCharts-0.7.5.jar
-rw-r--r-- 1 milamber milamber 153115 4 mars 23:18 jdom-1.1.jar
-rw-r--r-- 1 milamber milamber 132098 18 avril 23:08 jorphan.jar
-rw-r--r-- 1 milamber milamber 708951 4 mars 23:19 js-1.6R5.jar
-rw-r--r-- 1 milamber milamber 249924 4 mars 23:19 jtidy-r938.jar
drwxr-xr-x 3 milamber milamber 4096 16 mars 23:19 junit
-rw-r--r-- 1 milamber milamber 237047 4 mars 23:19 junit-4.8.1.jar
-rw-r--r-- 1 milamber milamber 81885 4 mars 23:19 logkit-2.0.jar
-rw-r--r-- 1 milamber milamber 462097 4 mars 23:23 mail-1.4.3.jar
drwxr-xr-x 3 milamber milamber 4096 4 mars 11:34 opt
-rw-r--r-- 1 milamber milamber 65261 4 mars 23:17 oro-2.0.8.jar
-rw-r--r-- 1 milamber milamber 278281 4 mars 23:20 serializer-2.7.1.jar
-rw-r--r-- 1 milamber milamber 232498 4 mars 23:19 soap-2.3.1.jar
-rw-r--r-- 1 milamber milamber 3176148 4 mars 23:22 xalan-2.7.1.jar
-rw-r--r-- 1 milamber milamber 1229125 4 mars 23:22 xercesImpl-2.9.1.jar
-rw-r--r-- 1 milamber milamber 194354 4 mars 23:23 xml-apis-1.3.04.jar
-rw-r--r-- 1 milamber milamber 517073 4 mars 23:23 xmlgraphics-commons-1.3.1.jar
-rw-r--r-- 1 milamber milamber 24956 4 mars 23:20 xpp3_min-1.1.4c.jar
-rw-r--r-- 1 milamber milamber 431406 4 mars 23:20 xstream-1.3.1.jar

Created attachment wiki-monip_jtl_and_pcap.zip: JTL + Wireshark capture

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
All looks OK - I get the same response from www.monip.org (apart from the IP address!) and I also get the response as a single packet when viewed using Wireshark.

I need to look further at httpcore to see why it could be reading ahead more in your case and not in mine.

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Created attachment Metrics.java: Sample metrics code

Metrics.java
/*
 * ====================================================================
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *   http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 * ====================================================================
 *
 * This software consists of voluntary contributions made by many
 * individuals on behalf of the Apache Software Foundation.  For more
 * information on the Apache Software Foundation, please see
 * <http://www.apache.org/>.
 *
 */

package org.apache.http.examples.client;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.io.PrintWriter;
import java.util.logging.LogManager;

import org.apache.http.HttpConnection;
import org.apache.http.HttpConnectionMetrics;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpRequestBase;
import org.apache.http.impl.client.DefaultHttpClient;
import org.apache.http.protocol.BasicHttpContext;
import org.apache.http.protocol.ExecutionContext;
import org.apache.http.protocol.HttpContext;
import org.apache.http.util.EntityUtils;

public class Metrics {

    private static void initLogging() throws Exception {
        LogManager mgr = LogManager.getLogManager();
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        PrintWriter pw = new PrintWriter(os);
        pw.println("handlers=java.util.logging.ConsoleHandler");
        pw.println("java.util.logging.ConsoleHandler.formatter = java.util.logging.SimpleFormatter");
        pw.println("java.util.logging.ConsoleHandler.level = ALL");
        pw.println("org.apache.http.level = FINEST");
        pw.close();
        InputStream ins = new ByteArrayInputStream(os.toByteArray());
        mgr.readConfiguration(ins);
        ins.close();
    }
    public static void main(String[] args) throws Exception {
        initLogging();
        DefaultHttpClient httpclient = new DefaultHttpClient();
        try {
            HttpRequestBase req = new HttpGet("http://wiki.apache.org/jakarta-jmeter/JMeterCommitters");
            HttpContext localContext = new BasicHttpContext();
            HttpResponse rsp = httpclient.execute(req, localContext);
            System.err.println("*** "+rsp.getStatusLine());
            HttpConnection conn = (HttpConnection) localContext.getAttribute(ExecutionContext.HTTP_CONNECTION);
            HttpConnectionMetrics metrics = conn.getMetrics();
            long hdr = metrics.getReceivedBytesCount();
            System.err.println("*** HEADER "+hdr);

            HttpEntity entity = rsp.getEntity();
            if (entity != null) {
                EntityUtils.consume(entity);
            }
            long total = metrics.getReceivedBytesCount();
            System.err.println("*** TOTAL "+total);
        } finally {
            // When HttpClient instance is no longer needed,
            // shut down the connection manager to ensure
            // immediate deallocation of all system resources
            httpclient.getConnectionManager().shutdown();
        }
    }

}

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Created attachment Metrics.log: Sample metrics code log

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
Added a simple test program to show metrics behaviour with HC4.

Needs to be run with httpclient+httpcore.

@asfimport
Copy link
Collaborator Author

Sebb (migrated from Bugzilla):
I've looked in more detail at how the data is read from the socket, and I think it is accidental that it works for me and not for you. Probably depends on OS and JVM config.

So let's use the header calculation method. I'll update the code.

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Hasn't this one been fixed ?

@asfimport
Copy link
Collaborator Author

@milamberspace (migrated from Bugzilla):
Yes, I think too.

When I run Test Case https://issues.apache.org/bugzilla/attachment.cgi?id=26885, the only difference between HC3 and HC4 with chunked test is:
The HC3 doesn't include the size of chunk counters in response body size
The HC4 included this size (35 bytes added)

The docs can be update with a notice to indicate this difference (in View Results Tree section).

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Already Fixed in JMeter 2.5

Date: Mon Feb 6 20:45:33 2012
New Revision: 1241169

URL: http://svn.apache.org/viewvc?rev=1241169&view=rev
Log:
#2006 - Options for compressed content
Add doc to component_reference

Modified:
jmeter/trunk/xdocs/usermanual/component_reference.xml

@asfimport
Copy link
Collaborator Author

@pmouawad (migrated from Bugzilla):
Date: Tue Feb 7 00:32:39 2012
New Revision: 1241292

URL: http://svn.apache.org/viewvc?rev=1241292&view=rev
Log:
Clarify HC4 behaviour wrt transport overhead

Modified:
jmeter/trunk/xdocs/usermanual/component_reference.xml

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant