I am using Jersey 1.12 with Grizzly, using Jackson to generate JSON output. If the generated result is much bigger, then the data transport speed is very slow.
I run the server and client on the same box, and the transport speed for 350KB data is around 350KB/sec, this is pretty slow, right? How to tuning this? I monitored the API who generate a list of object ready to be serialized to JSON, it is about 50ms after the first time.
I set the number of Grizzly NIO worker threads to 40.
I run the server on
Linux 2.6.18-274.7.1.el5 #1 SMP Thu Oct 20 16:21:01 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux
This server has 8 cores.
Maybe you are running out of heap space, causing the VM to try to GC more aggressively causing longer and more frequent GC cycles? How big is the data? Are you using logging filter (it buffers the entity – loading it all into memory)? Try increasing the heap size or ensuring you send/receive data in a streaming fashion rather than keeping it all in memory.