On Tue, Aug 23, 2022, at 1:54 PM, mkmo...@gmail.com wrote:
> As stated in the docs:
> 
> > All SQLAlchemy pool implementations have in common that none of them “pre 
> > create” connections - all implementations wait until first use before 
> > creating a connection 
> 
> Is it possible to warm up, or pre create, the connections in the pool?

sure do a pre-connect like this:

conns = [engine.connect() for i in range(num_of_connections_you_want)]
for c in conns:
    c.close()

the connections are all made at the same time so that will establish individual 
connections in the pool.

> 
> When I start my server, the connection pool is initially empty. I'm using 
> Oracle and connection initialization has a lot of overhead. I'm seeing as 
> high as 4 seconds sometimes.
> 
> The only way I can think of is to spawn a lot of threads that all check out a 
> connection and release it after ~10 seconds. Is there a built in solution for 
> this?
> 
> Thanks and best regards,
> 
> Matthew
> 
> 
> -- 
> SQLAlchemy - 
> The Python SQL Toolkit and Object Relational Mapper
>  
> http://www.sqlalchemy.org/
>  
> To post example code, please provide an MCVE: Minimal, Complete, and 
> Verifiable Example. See http://stackoverflow.com/help/mcve for a full 
> description.
> --- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to sqlalchemy+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sqlalchemy/d64fbfe3-f07b-49d8-a670-6059ed9a4574n%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/sqlalchemy/d64fbfe3-f07b-49d8-a670-6059ed9a4574n%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/81e37a19-95b0-4178-84cf-aa4253d500af%40www.fastmail.com.

Reply via email to