Re: [flask] WSGI performance
- 2013-07-16 @ 17:35
-----BEGIN PGP SIGNED MESSAGE-----
Thanks Matthew. Obviously that was a contrived example to demonstrate
the performance issue.
My problem is that the first time the user goes to the web app, the
load time is long as Flask is set up. I was surprised to see so much
time spent just in the 'import Flask' when I profiled it.
If it is normal for Flask to take a couple seconds to import on low
powered hardware, I'll just have to live with it, or get a WSGI
process started pre-emptively.
On 07/15/2013 07:30 PM, Matthew Frazier wrote:
> On 07/15/2013 08:01 PM, Braddock wrote:
>> Is the line 'from flask import Flask, request' expensive?
>> The time to execute this single import statement is between 1 to
>> 5 seconds on an ARM Fedora-18 install using mod_wsgi.
>> See http://pastebin.com/EA6ZZDLb for details
>> How do I optimize this? Is it normally so slow? Should I be
>> configuring WSGI differently?
> In a working WSGI application, that line should only execute once
> for every time you reboot the server. Your problem is that since
> you're not defining an application file, mod_wsgi assumes there was
> an error starting up, so it's destroying and rebuilding the Python
> environment on every request.
> I recommend adding a simple "Hello, world!" app to the WSGI file,
> then benchmarking. Right now, you're benchmarking a misconfigured
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
-----END PGP SIGNATURE-----