We have an internal Flask/SQLAlchemy webapp using MySQL and served up using 
Apache and mod_wsgi.  We recently upgraded the server, going from an older 
Debian/Apache2.2/MySQL5.5/mod_wsgi 3.x, to a current Ubuntu/Apache 
2.4/MySQL5.7/mod_wsgi4.5.x.  Something seems to be causing some of our page 
requests to occasionally take 10-30 seconds where the same or similar 
requests are much quicker at a different time.  One of the things I'm 
looking at is lazy/eager loading.  It looks like from this thread 
<https://groups.google.com/forum/#!searchin/sqlalchemy/session$20counter$20query%7Csort:relevance/sqlalchemy/jsuoFMqbGpo/22vMBcRWEwAJ>
 
that a Session has no built-in counter of the number of queries it has 
executed?  I'll look at adding the event-handler suggestion to get a count.

Also, I'm curious if the QueuePool for the engines in use are ever hitting 
the max (pool_size+max_overflow).  There's a QueuePool.status() method 
which returns something like "Pool size: 5  Connections in pool: 1 Current 
Overflow: -4 Current Checked out connections: 0", but from a quick scan of 
the source it looks like nothing keeps track of the highest value that the 
queue's "overflow" ever reaches?  I don't think the sessions in my requests 
would use more that one connection, and the pools should be configured to 
allow more connections than the WSGI process has handler threads, but if 
I'm somehow wrong it could be that a session is hitting the pools "wait" 
period in trying to acquire a connection.

-- 
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 post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at https://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to