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
com.mongodb.MongoWaitQueueFullException with Webflux + reactive Mongo driver #22775
Comments
@rstoyanchev thanks for reply. My controller is simple, it just takes string field as path variable and uses ReactiveMongoRepository to find document from Mongo DB. `
` I did go through the #22332 , but I need some more clarification. I see in #22332 issue reporter ultimately increased the mongo driver wait queue size to pass the tests. I tested both MVC and Webflux with concurrent users of 10K with Webflux MVC If I increase the concurrent users to 15K, even with |
The root cause of An increase of CPU usage using WebFlux and reactive MongoDB is exactly what you should see. Because all I/O is non-blocking, the CPU is able to perform more work with less context switches between threads. With Tomcat you have a natural barrier: If you run out of threads, then you cannot issue more queries. With WebFlux, that's different. Threads are not a limiting factor.
From my perspective you can do the following things:
The expanded version is: Perform more work (higher CPU usage) with less resources (Threads). |
@mp911de thanks for details and sorry for delay. I am a newbie and was trying to digest and experiment your suggestions. got some descent understanding on the topic now, we can close the issue. Thanks @rstoyanchev |
I am trying to do load test of a simple Spring webflux application using gatling tool. Application is developed using 'spring-boot-starter-webflux' and 'spring-boot-starter-data-mongodb-reactive' projects. It simply read mongo document with a specific unique column. I inject concurrent users using gatling setUp(scn.inject(atOnceUsers(userCount)).protocols(httpConf))
I start mongo db instance like shown below
Replica
standalone
Setup 1: application running in Windows Desktop(Intel i5 and 16GB RAM), Mongo DB replica mode (3 node) running on windows laptop (Intel i7 processor and 16GB RAM) and Gatling load test scripts also on desktop. Both application and Gatling scripts on desktop are containerized. Queue size is 500 by default, I have overridden with 1000 queue size using waitQueueMultiple
I am getting this com.mongodb.MongoWaitQueueFullException: with even 3000 concurrency itself.
Setup 2: I have same setup as above but Mongo DB is running in standalone mode
I am getting this com.mongodb.MongoWaitQueueFullException: with even 3000 concurrency itself.
Setup 3: application, Mongo DB standalone mode and Gatling load test scripts all running on Desktop. And all are containerized and connected with a bridge network Queue size is 500 by default, overridden with 1000 queue size this setup works fine till 10000 concurrency. I understand here there is no role of network latency , so the better performance
I have below question
How to resolve this exception , apart from increasing the queue size .
Why there is a Mongo DB performance difference between Standalone and Replica mode
As mentioned above setup 1 and 2 raises exception when concurrency ~3000 users. I repeat these tests at random time of the day. But at some point of time standalone setup of mongo database performance extremely well and till 48000 concurrent users application scales well(no exception thrown). I checked that Mongo is receivng the requests by watching mongostat/mongotop and also confirmed by running db.adminCommand("top") before and after the each test. I can confirm that read counts are increasing by number of concurrent users i used for test. My only worry is same time if I use mongo DB in replica mode (Setup 1) it does not show the better performance , it continues to throw exception at 3000 concurrency itself. Why replica mode is not performaing equal to standalone mode ) Application code is same , gatling script is same.
I am using mongodb-driver-reactivestreams 1.9.2 Mongo Database 4.0.8
The text was updated successfully, but these errors were encountered: