You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I call ctx.run from multiple threads, will the database queries block each other ? For example:
classMain {
importscala.concurrent.ExecutionContext.Implicits.globalvalctx:Context=newPostgresJdbcContext[SnakeCase]( ... )
defmain(args: Array[String]):Unit= {
// will a & b insert into database at the same time?vala=Future {ctx.run { .. insert into db .. }}
valb=Future {ctx.run { .. insert into db .. }}
}
}
What context should I use? PostgresJdbcContext or PostgresAsyncContext? Documentation does not really explain how do they differ and what is their purpose.
Is the maximum number of parallel queries equal to the size of connection pool?
What about the choice of ExecutionContext and usage of blocking { .. }.
The text was updated successfully, but these errors were encountered:
PostgresAsyncContext use nio-based driver
While PostgresJdbcContext just use the blocking jdbc driver.
You'd better first do some research with postgresql-async, and if you decide to use it, be careful about this bug
Yes, jdbc is blocking, but is that an issue if quill uses pool of jdbc connections? So that when you wrap every call to database into future, you effectively can run `size of connection pool` parallel queries at the same time, no?
23. 2. 2018 2:19 AM, 2:19 AM, jilen <[email protected]> napsal/a:
`PostgresAsyncContext` use [nio-based
driver](https://github.com/mauricio/postgresql-async/)
While `PostgresJdbcContext` just use the blocking jdbc driver.
You'd better first do some research with postgresql-async, and if you
decide to use it, be careful about this
[bug](mauricio/postgresql-async#241)
--
You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub:
#1034 (comment)
@Josef-Vonasek Yes, you can wrap scala execution context with fixed thread pool with number of threads equals to connection pool. The only restriction is to be careful with transactions since they need to be run in a single thread.
We have gitter channel for general-purpose questions https://gitter.im/getquill/quill
If I call
ctx.run
from multiple threads, will the database queries block each other ? For example:What context should I use?
PostgresJdbcContext
orPostgresAsyncContext
? Documentation does not really explain how do they differ and what is their purpose.Is the maximum number of parallel queries equal to the size of connection pool?
What about the choice of
ExecutionContext
and usage ofblocking { .. }
.The text was updated successfully, but these errors were encountered: