首页 > Linux操作系统 > Linux操作系统 > Async SQL and Akka

Async SQL and Akka

原创 Linux操作系统 作者:jieforest 时间:2012-05-28 11:46:02 0 删除 编辑
[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?


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博客 ” ,链接:,如需转载,请注明出处,否则将追究法律责任。

上一篇: JRuby 1.7.0
请登录后发表评论 登录


  • 博文量
  • 访问量