[Fixed]-Parsing .py files performances with mod_wsgi / django / rest_framework

1👍

I guess all .py files need to be periodically parsed or .pyc to be read

.py files are only parsed (and compiled to bytecode .pyc files) when there’s no matching .pyc file or the .py file is newer than the .pyc. Also, the .pyc files are only loaded once per process.

Given your symptom, chances are your problem is mostly with your server’s settings. First make sure you’re in daemon mode (https://code.google.com/p/modwsgi/wiki/QuickConfigurationGuide#Delegation_To_Daemon_Process), then tweak your settings accroding to your server hardware and application’s needs ( https://code.google.com/p/modwsgi/wiki/ConfigurationDirectives#WSGIDaemonProcess)

0👍

This looks like your Apache does remove the Python processes from the memory after a while. mod_wsgi loads the Python interpreter and files into Apache which is slow. However you should be able to tune it so it keeps them into memory.

Leave a comment