You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jmeter.apache.org by bu...@apache.org on 2016/07/18 21:01:08 UTC

[Bug 59882] New: JMeter memory allocations reduction

https://bz.apache.org/bugzilla/show_bug.cgi?id=59882

            Bug ID: 59882
           Summary: JMeter memory allocations reduction
           Product: JMeter
           Version: 3.0
          Hardware: HP
                OS: Neutrino
            Status: NEW
          Severity: enhancement
          Priority: P2
         Component: Main
          Assignee: issues@jmeter.apache.org
          Reporter: benoit.wiart@gmail.com

I've been profiling jmeter memory allocation under different conditions
the PR linked to this bug gives substantial improvements.

Gain really depends on the test but in the worst case (compressed content, no
embedded resources) it's about 15% less allocations (in bytes)
When not compressed (no embedded resources) and if content-length is sent by
the server my test gives 30% reduction in bytes allocated
As always YMMV but this PR is always a win in all my different tests.

Reduction in memory allocated comes from
Better usage of ByteArrayOutputStream  by
  - directly accessing the buffer instead of copying it
  - or by using the commons-lang implementation which avoid copying memory
around when extending the buffer
  - or by creating the string directly from the buffer instead of a temporary
copy

Avoid unneeded string concatenation due to missing log.isDebugEnabled()
if possible use httpclient CharArrayBuffer to avoid memory allocations
Do not create unneeded silent exceptions
Do not allocate 2 empty iterators on each call to executeSamplePackage
  - LinkedList.iterator() is a stinky monkey. Also see HTTPCORE-361
Set better default size to StringBuilder buffers
improve JOrphanUtils#replaceAllChars : provides a fast path which does not
allocate memory
etc..

Remark : 
When using ssl, jsse is a major source of unneeded allocation !!!! 
(sun.security.ssl.SSLContextImpl#getDefaultCipherSuiteList(boolean))
https://bugs.openjdk.java.net/browse/JDK-8133070 should improve the situation
(I did not test it)
the title of the bug is misleading as it's also about an internal cache beeing
cleared on each method call.

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59882] Reduce memory allocations for better throughput

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59882

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |p.mouawad@ubik-ingenierie.c
                   |                            |om
            Summary|JMeter memory allocations   |Reduce memory allocations
                   |reduction                   |for better throughput

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59882] JMeter memory allocations reduction

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59882

--- Comment #1 from benoit.wiart@gmail.com ---
PR : https://github.com/apache/jmeter/pull/217

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59882] Reduce memory allocations for better throughput

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59882

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Hardware|HP                          |All
                 OS|Neutrino                    |All

-- 
You are receiving this mail because:
You are the assignee for the bug.

[Bug 59882] Reduce memory allocations for better throughput

Posted by bu...@apache.org.
https://bz.apache.org/bugzilla/show_bug.cgi?id=59882

Philippe Mouawad <p....@ubik-ingenierie.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #2 from Philippe Mouawad <p....@ubik-ingenierie.com> ---
Added:
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/util/DirectAccessByteArrayOutputStream.java
  (with props)
Modified:
   
jmeter/trunk/src/core/org/apache/jmeter/testelement/AbstractTestElement.java
    jmeter/trunk/src/core/org/apache/jmeter/threads/JMeterThread.java
    jmeter/trunk/src/jorphan/org/apache/jorphan/util/JOrphanUtils.java
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPHC4Impl.java
   
jmeter/trunk/src/protocol/http/org/apache/jmeter/protocol/http/sampler/HTTPSamplerBase.java
    jmeter/trunk/xdocs/changes.xml

-- 
You are receiving this mail because:
You are the assignee for the bug.