As far as I know, async apps with thread pool are used to not create
new thread per each connection. When this is solved with go blocks in core.async, where socket IO can be parked as it is possible with operating system and popular http libraries supporting it, other blocks like DB queries need to be handled with creating a new thread. For typical web application 99.9% requests are handled with accessing DB and we end up with n connections = n threads. Am I right and is there any solution?
Add a comment
|
1 Answer
Yes, you should not use go blocks for blocking operations like IO. Hopefully we'll have async jdbc soon https://www.slideshare.net/ypoirier/jdbc-next-a-new-asynchronous-api-for-connecting-to-a-database
Also there are https://github.com/alaisi/postgres.async
1 Comment
orestis
Wouldn't there usually be a threadpool that maintains connections to the DB? The hope/design being that each individual DB operation would be fast enough that 10k clients could be multiplexed over say 100 connections (adding of course some latency).