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

Unai Rodriguez unai at sysbible.org
Wed Jul 6 06:28:15 EDT 2016


Hi Tim,

Great , it's now time of testing the different parts of the server. You
could start testing the database, uwsgi/Python and maybe the network ?

You could build two queries, a simple and one more complicated and run
it multiple times on your dev and prod boxes and compare. Different
times? Consistent ?     


For uwsgi/Python you could do the same, build a simple page and a more
complicated one and compare (no database queries to isolate).

Lastly for the network, was this isolated already from your tests? I
think so but if it wasnt you'll need to look at some tools
(munin?cacti?)

The server/os will have to be looked at some point as well. 

Also, are all other app currently running  on your production behaving
better in terms of performance and consistency ?                
-- unai

On Wed, Jul 6, 2016, at 06:16 PM, Tim van der Linden 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


More information about the Flask mailing list