[Flask] uWSGI and Flask - Slow and varying response times

Tim van der Linden tim at shisaa.jp
Wed Jul 6 19:18:11 EDT 2016


On Wed, 6 Jul 2016 12:49:34 +0300
Mark Pors <mark at pors.net> wrote:

> On Wed, Jul 6, 2016 at 9:40 AM, Tim van der Linden <tim at shisaa.jp> wrote:

Hi Mark

> > ...
> > I even profiled the server with Werkzeug's ProfilerMiddleware and SnakeViz
> > which doesn't give me much direction. The function load is spread quite
> > identically in every request - if the request takes four times as long, all
> > functions take four times as long as well.
> >
> >
> 
> All functions? Also if there is no DB access or other I/O initiated by
> these functions (or waiting on it)?

All or at least most of the functions seem stretched in time. Many of them are indeed database related functions which led me to believe it was a typical database issue at first.

However, there are not only database related functions but also functions such as the template rendering which equally slow down when the response time is higher. This brought me on the current track that there might be an issue with Python processing being abnormally slow.

Also querying the database via its CLI was very fast and did not show any lag, the database itself is also not under any particularity heavy load. Connection between Python and the database is done via PsycoPG2 (not ORM) using direct sockets.

> > ...

Cheers,
Tim


More information about the Flask mailing list