MongoWaitQueueFullException in Webflux + Reactive Mongo
See original GitHub issueAffects: 5.1.2.RELEASE
The latest TechEmpower’s benchmark shows a lot of errors for Webflux + Spring data mongo.
I digged and found out that under load, we get a lot of
com.mongodb.MongoWaitQueueFullException: Too many threads are already waiting for a connection. Max number of threads (maxWaitQueueSize) of 500 has been exceeded.
exceptions.
From our discussion on gitter, @mp911de thinks that “WebFlux could have a notion of connection backpressure and should limit subscription rate/demand rate to provide a sense of protection for downstream components within the application”.
Code of the benchmark here
Related issue : #20338
Issue Analytics
- State:
- Created 5 years ago
- Comments:18 (11 by maintainers)
Top Results From Across the Web
[JAVA-3166] Improve MongoWaitQueueFullException message
MongoWaitQueueFullException is created with two messages: Too many threads are already waiting for a connection.
Read more >Spring WebFlux/Reactive Mongo based application opens ...
It is caused by setting maxConnectionIdleTime=1 , which you can see in logs as well: ...because it is past its maximum allowed idle...
Read more >spring-projects/spring-data - Gitter
Hi. The latest TechEmpower benchmark show quite disappointing results for Webflux + Reactive-mongo. I replayed the test on my laptop and have quite...
Read more >[Java] High Mongo time and error rates on Spring Webflux and ...
On the mongo issue, the mongo DB transaction times are so wrong. see the image. In here I'm using spring-boot-starter-data-mongodb-reactive 2.3.
Read more >Spring Data Mongo · Spring WebFlux By Example - Hantsy Bai
Spring Data Mongo provides reactive variants of MongoTemplate and MongoRepository , aka ReactiveMongoTemplate and ReactiveMongoRepository which have ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Yes, and I believe that would also be resolved by a reactive DB Connection pooled capped at 500 connections.
So using
concat
instead ofmerge
does have an effect on the number of items put in the wait queue. The number of concurrent connections is related to the queue size (withconcat
it’s queue size + a little number). The pool size doesn’t seem to have any effect. I guess all items go into the queue before being given a pool connection. I can put a highmaxWaitQueueSize
(usingwaitqueuemultiple
parameter in connexion string) and then I don’t see any issues both forconcat
andmerge
. I think I’ll keepmerge
with a queue size of 512*20 since it gives better results for low concurrency requests (since the 20 requests are done concurrently). For me this issue is understood and can be closed. Maybe there could be some documentation somewhere about the Mongo async driver pool size. I’ll do the fix for the TechEmpower benchmark. Thanks to all.