I am currently using spring AMQP API to connect to RabbitMQ. Basically in my consumer code I am reading the messages asynchronously and making a Bulk insert in elastic search. when I do ack = AUTO I get a moderate speed of 400-500 msg/sec (reading from Queue). when I do ack = NONE the increase in reading speed is huge i.e. it goes to 5000-6000 msg/sec.
The configuration is as follows:
- Linux machine with with 32GB RAM
- JVM arguments:
-server
-Xms1g -Xmx1g -Xss384k PermSize=256m MaxPermSize=256m
Now the problem is when I am doing ack = NONE though I am getting a good speed the JVM is getting OutOfMemory after some time and I can see lot of GC is happening in this scenario.
I am planning to use the QueueChannel from Spring integration where I can limit the size of the channel as how much messages it can contain.
How can I implement this with RabbitMQ also is there any other way to achieve a good reading speed like 4000-5000 msg/sec without crashing the JVM?