On Thursday, April 14, 2016 at 10:46:04 AM UTC-7, Caio Chassot wrote:
>
> Since the point is to make the pool faster in high latency situations, is
> there any reason to not initialize the connections in parallel?
>
> Something like:
>
> def preconnect
> (max_size - size).times
> .map{ Thread.new{ make_new(nil) }}
> .map(&:value)
> .each{ |c| checkin_connection c }
> end
>
The point of preconnect is to reduce new connections during runtime by
spending more time during initialization. In general, Sequel does not
create threads internally. The only time we do it is in the
pg_static_cache_updater extension.
I don't think we should make this the default behavior, but I'm not opposed
to adding a connection pool option that will use threads to preconnect.
Please send a pull request if you would like that behavior, making sure to
handle both the sharded and regular threaded connection pools.
Thanks,
Jeremy
--
You received this message because you are subscribed to the Google Groups
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/d/optout.