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
The best experience to use Couchbase with webflux? #1792
Comments
eventLoopThreadCount is configurable
IoEnvironment.Builder eventLoopThreadCount(int eventLoopThreadCount) |
I currently configure eventLoopThreadCount to be the same number of cores as my CPU.
Please help me to confirm if there is any problem with my configuration, or which configuration can be adjusted to solve the timeout problem? error message
|
publishOn(Schedulers.boundedElastic()) seems like the correct solution.
You could try a higher value like 120 ( Schedulers.boundedElastic() is cores X 10). See https://stackoverflow.com/questions/61304762/difference-between-boundedelastic-vs-parallel-scheduler |
Do you mean to increase the number of eventLoopThreadCount? For example, to 120?
Seems weird to raise eventLoopThreadCount directly to 120? |
Yes, increase it to 120. Schedulers.boundedElastic() is cores X 10 according to the stackoverflow post. If you have six cores, that would be 60. So 120 threads would be just twice that (cores x 20). Increasing the threadCount is exactly what should resolve your primary complaint is that there are not enough threads. |
If I have increased the |
spring-boot-starter-data-couchbase-reactive:2.6.9
com.couchbase.client: java-client: 3.3.1
Sometimes I get a lot of Couchbase UnambiguouslyTimeoutException errors and I find that the Couchbase cb-io thread is occupied by function code.
Then I found out that when using
repository.findById
Or after other couchbase operations, the thread will switch to the couchbase cb-io thread. If I have some time-consuming functions after the cousebase operation, the cb-io thread will be occupied until the function ends, resulting in fewer threads in the couchbase thread pool. , couchbase operations in a large number of queues wait for a timeout.
So my best practice is to publishOn/subscribeOn it to other threads immediately after the couchbase request ends?
such as this
Is this best practice? Or any other suggestions? Or is there any global setting that controls the early release of database operation threads
The text was updated successfully, but these errors were encountered: