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

Tim van der Linden tim at shisaa.jp
Wed Jul 6 06:27:57 EDT 2016


On Wed, 6 Jul 2016 12:19:42 +0200
Alejo Arias <alejoar at gmail.com> wrote:

Hi Alejo

> Is the DB hosted in the same server?

Yep, the database cluster is on the same SSD drive.

I also just checked one of the slowest pages and the database queries total up to around ~90 ms of the response time including every transaction start and commit. That is for the amount of queries done also very acceptable.

I think this rules out the database as the bottleneck since my local machine clocks in at roughly the same amount of time for database work, meaning all other Python work is done in the remaining ~100 ms.

The server needs ~600 ms for this remaining work.

Cheers,
Tim

> On 6 July 2016 at 12:16, Tim van der Linden <tim at shisaa.jp> wrote:
> 
> > On Wed, 06 Jul 2016 17:52:00 +0800
> > Unai Rodriguez <unai at sysbible.org> wrote:
> >
> > > Hi Tim,
> >
> > Hi Unai
> >
> > Thanks for the response!
> >
> > > I think your top priority should be to get consistent results first and
> > > for the that you want to stop all other activity on your production
> > > server and benchmark your application alone. Would it be feasible to
> > > declare downtime in all other apps for 30 minutes? Alternatively you
> > > might want to run all apps on your prodution server somewhere else while
> > > you benchmark your app.
> > >
> > > This will tell you if the inconsistencies come from the other apps, or
> > > it is an issue with your code or server configuration.
> >
> > Very good suggestion and I just had the timing to do so. I allowed only,
> > my local IP access to the server and nobody else. The server fell even more
> > silent and no requests came in except mine.
> >
> > I ran the profiler again which gave me very similar results to before:
> > average response time ~700 ms. Average response time on my local machine:
> > ~200 ms (exact same database and code).
> >
> > So even when this beast of a server is fully isolated and only answers to
> > my requests, it does so 3 to 4 times slower than on my development machine.
> >
> > From my perspective, if the code were the bottleneck then I would also get
> > the same "slow" performance on my local machine ... no?
> >
> > My gut feeling says that there is some sort of misconfiguration going on.
> >
> > > -- unai
> >
> > Cheers,
> > Tim
> >


-- 
Tim van der Linden <tim at shisaa.jp>


More information about the Flask mailing list