Async SQL and Akka

[i=s] 本帖最后由 jieforest 于 2012-5-27 11:15 编辑

I’ve already written several times about Akka and async programming with it. For example doing access files and webservices with it. So async API stack is complete, right?


We’ve got async network and web access via NIO and frameworks like Play 2.0, Spray, HTTPClient etc. And with NIO 2 we easily can access the file system in asynchronous way.


But wait, what about your database? What if tons of yourdata sits in a good old relational database? Unfortunately the current JDBC model is blocking by definition. No asynchronous operation isallowed.


The standard way of doing things for async SQL operations is to use some background threads and do things there. And for many applications this is good enough.


But if you do more and more db operations you start to consume more and more threads, which will be waiting for blocking operations. Wouldn’t it be nicer if the database operations are truly asynchronous like other operations?



111324lknnxlmhmhcn65sh.png
JDBC-Model.png
  


JDBC is nice, but let's you wait


So I’ve looked for an alternative to JDBC. I’ve found two approaches to provide a asynchronous JDBC alternative.


The async-mysql-connector and ADBCJ. Unfortunate both are not really actively maintained. Anyhow I decided to go ahead with ADBCJ. More about that later. Let’s first take a look at how we to use everything.




来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/301743/viewspace-731245/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/301743/viewspace-731245/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值