mwashburn2 opened a new pull request, #2770:
URL: https://github.com/apache/activemq/pull/2770

   Fixes #2744.
   
   `NIOTransport` reads any frame larger than its input buffer into a new 
`ByteBuffer.allocateDirect(frameSize)`. Those buffers are only released by GC, 
so steady large-message traffic fills direct memory and `Bits.reserveMemory` 
falls back to `System.gc()`, stalling the broker for seconds. This change reads 
oversize frames into heap buffers instead.
   
   Escape hatch: set `ACTIVEMQ_NIO_USE_DIRECT_BUFFER=true` (env, checked first) 
or `-DactivemqNIOUseDirectBuffer=true` to restore the previous direct-buffer 
behaviour.
   
   ## Load test (per-variant medians)
   
   | Variant | send/s | p50 (ms) | p99 (ms) | p999 (ms) | max (ms) | stalls 
>100 ms | System.gc() | direct peak |
   |---|---|---|---|---|---|---|---|---|
   | stock | 17,567 | 0.04 | 19.81 | 95.70 | 1,455 | 4,804 | 68 | 2.15 GB |
   | heap (this PR) | 17,567 | 0.04 | 10.41 | 76.55 | 1,516 | 2,747 | 0 | 3.3 
MB |
   
   20k msg/s target, 300 s publish, 1000 topics, 470 subscribers, 2% large 
messages plus 2 huge messages/s; fresh broker per run, GC logs from start.
   
   ## Tests
   
   - `NIOOversizeFrameDirectMemoryTest`: asserts direct buffer count does not 
grow per oversize frame. Runs in the default test JVM; fails with the escape 
hatch on (288 buffers for 285 frames).
   - `NIOVariedSizeTopicLatencyTest` (perf, excluded from CI): varied-size 
topic fan-out reporting latency percentiles, direct memory and System.gc() 
pauses. 15 s run: 8 direct buffers / 0.1 MB peak with this change vs 1,900 / 
891 MB stock.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information, visit: https://activemq.apache.org/contact


Reply via email to