Just looking for advise for best solution, thanks:...
# server
r
Just looking for advise for best solution, thanks: • What’s the best way to handle concurrency issues with async calls to a backend accessing a db and making several calls on same rows. [ More…]
I heard about that I could solve that with VirtaulThreads but I am not complete sure is the right way, I have also dug a bit into coroutines but I didn’t use it yet. The error usually I get is this, which is obviously going in timeout for locks, tupes. java.util.concurrent.TimeoutException: Connection lease request time out
a
Any threading solution will work. Virtual threads give you the same effect as an unbounded thread pool, but with less overhead. Coroutines are similar, but typically require library support. If you're getting a timeout exception, my best guess at a solution is to ensure you're using a connection pool with a sufficient max number of connections. Your concurrency is limited by the max number of connections, which could lead to a timeout when your threads are waiting for a connection from the pool.
r
Thanks for the suggestion but I was going already to write the connection pool is big already
a
Ok. In that case, are you sure connections are being released properly after a thread is done with it?
r
like in my case unirest.shutdown