0

As per my knowledge slick 3.1 is currently built on JDBC native drivers that is blocking for IO operations at driver level.Can I use mysql-async driver call with plain Sql and playframework? Do i need to use future to open new thread on each DB call using ExecutionContext?

1 Answers1

0

You're correct, slick is built on the standard (blocking) jdbc drivers (see here). However, it should be OK for most workloads.

Can I use mysql-async driver call with plain Sql and playframework?

which java driver exactly do you refer to? I'm familiar with Mauricio's async driver which should be completely async and has some nice libs built on top of it if you're looking for a replacement to slick. (e.g. quill)

Do I need to use future to open new thread on each DB call using ExecutionContext?

This will not help if all the threads are blocking, a new http request will can be starved due to blocking DB queries. A better approach would be to create a dedicated thread pool for the blocking tasks. Refer to play's thread pool configuration to better understand this.

Community
  • 1
  • 1
LiorH
  • 18,524
  • 17
  • 70
  • 98
  • Regarding mysql-async driver or postgresql-async driver .They are the drivers that comes for asyncronous/Non Blocking call back to MySQL database and Postgres DB [link](https://github.com/mauricio/postgresql-async). Yes I am trying to replace Slick and want asyncronous call for DB calls also .I want to be application full reactive with non blocking DB call. Reagring ExecutionContext: Yes i was also asking for different pool of threads for DB calls. – Rahul Gulabani Mar 21 '17 at 10:49
  • I think Quill will be a good choice for scala-play rest application which is completely build on Async drivers. So is it good for production use?I means is it meature enough to use it for production use any suggetion? – Rahul Gulabani Mar 21 '17 at 10:59
  • Which approach will be better for maximum performance and regarding maturity . ! Slick 3 with blocking jdbc calls or Quill with async call. If there will be not much performance gain then I can use Slick 3.x version as it is a recomanded for db interaction . – Rahul Gulabani Mar 21 '17 at 11:15
  • I think quill is ready for production, at least we're using it in production :-) – LiorH Mar 23 '17 at 13:23
  • when examining slick vs. quill I wouldn't only compare the async characteristics, but the whole usage pattern. see this comparison https://github.com/getquill/quill/blob/master/SLICK.md (maybe a bit biased cause it's written by quill, but I found it useful) – LiorH Mar 23 '17 at 13:24
  • -Thanks for help. – Rahul Gulabani Mar 23 '17 at 16:02