On Thu, Dec 17, 2009 at 12:37 PM, Iñaki Baz Castillo <[email protected]> wrote:
> El Jueves, 17 de Diciembre de 2009, Iñaki Baz Castillo escribió:
>> El Jueves, 17 de Diciembre de 2009, Iñaki Baz Castillo escribió:
>> > Hi, AFAIK Ruby C mysql driver is blocking so Ruby must wait until get a
>> > response.
>> > So what's the advantage of using "single_threaded = false"? With this
>> > option Sequel creates a pool of connections to the DB while when using
>> > "single_threaded = true" it just mantain a single connection. Is it
>> > right?
>>
>> Perhaps I'm wrong and "single_threaded" has no relationship with
>> "max_connections"... am I right?
>>
>
> My app doesn't use threads (but an event based server to handle HTTP
> requests).
>
> I use Sequel with MySQL adapter:
>
> :single_threaded => false # doesn't matter IMHO
> :max_connections => 4
single_threaded has to be false, or sequel will not use a connection
pool. With single_threaded=>true, max_connections is ignored.
>
> Now I do a DB query like this:
>
> DB.run("SELECT sleep(4)")
>
> At the same time I do any other "normal" SQL query. It's not attended until
> the previous blocking query terminates. Is it the expected behaviour? What is
> the point of having 4 DB connections available?
The sequel connection pool only uses multiple connections if queries
in performed in separate threads.
>
> I've also tryed the same but using "mysqlplus" instead of "mysql". The result
> is the same. I think that "mysqlplus" just offers advantages is the
> application on top of it makes usage of async methods. If not, it behaves
> exactly as "mysql" driver.
The mysql driver blocks, you have to use the mysqlplus driver and also
enable async queries:
require 'mysqlplus'
class Mysql; alias :query :async_query; end
>
>
> Thanks for any comment.
>
>
>
>
>
> --
> Iñaki Baz Castillo <[email protected]>
>
> --
>
> You received this message because you are subscribed to the Google Groups
> "sequel-talk" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected].
> For more options, visit this group at
> http://groups.google.com/group/sequel-talk?hl=en.
>
>
>
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/sequel-talk?hl=en.