I'm using Flask and mod_wsgi on Webfaction and so my config was under:
~/webapps/[app_name]/apache/conf/httpd.confIn my effort to save memory, back when WebFaction only offered 256MB of RAM, I'd gone through my sites and set the threads and processes to "2" for the wsgi process:
WSGIDaemonProcess app_name processes=2 python-path=... threads=2I'd also set MaxSpareThreads 2 (down from the default 3) and ThreadsPerChild 2.
After checking performance with serverstatus and checking memory usage with this script, I settled on
MaxSpareThreads 3Which took my response time down from around 15 seconds (which even with 2 threads and processes seems slow) to around 2 seconds from cold and well under a second when warm (the second check after restarting apache). Much better!
MinSpareThreads 1
ServerLimit 1
ThreadsPerChild 16
WSGIDaemonProcess ... processes=8 threads=16
Memory usage seems to be around 22MB per process, but with 512MB of RAM to play with, there's plenty of headroom.
No comments:
Post a Comment