3 ms·
Basically anything living in the akka+spray world is written this way. But akka+spray is not an framework in the same sense that django is.
by yummyfajitas 13y ago
Basically anything living in the akka+spray world is written this way. But akka+spray is not an framework in the same sense that django is.
- lmm 13y agoAre there async drivers for e.g. mysql yet? Last time I did that I had a very nice async spray frontend, but it was all backed by a pool of regular blocking threads because that was the only way to use the database driver.
- yummyfajitas 13y agoThere is this, but it's not particularly mature: https://github.com/mauricio/postgresql-async https://github.com/mauricio/postgresql-async I also use https://github.com/etaty/rediscala https://github.com/etaty/rediscala for accessing redis. But even without async drivers for MySQL, you can still do: val sqlResult: Future[StuffFromSql] = future { val stmt = connection.createStatement("...") ... } This will tie up a thread, but you can still run other actions in parallel with it.
- saryant 13y agoIf you do this, execute the future on a different dispatcher so you aren't blocking the default dispatcher. This can cause problems if you tie up the default dispatcher with blocking SQL queries while using clustering: the cluster gossip won't be able to fire and if your failure detection settings are low, that node can be marked unreachable by the rest of the cluster.