Drawbacks to running Django under PyPy?


Question

I understand that Django, PyPy, and Psycopg2 all work correctly together, and speed.pypy.org claims great performance improvements over CPython. Are there any downsides?

1
33
5/2/2013 8:32:09 AM

Accepted Answer

  1. Library support. Not all libraries are compatible with PyPy.

    Your best bet is to actually try running pypy manage.py test and see if it breaks. Then you know which dependencies need to be brought into line.

    http://reinout.vanrees.org/weblog/2011/06/06/django-and-pypy.html

  2. Webservers

    You can't use pypy with Apache. You need to use a pure-python webserver + nginx. You MAY get it working on uwsgi.

36
5/3/2013 4:09:33 AM

The PyPy wiki lists Django as compatible, but it doesn't go into great detail about how much of Django was tested. I am not aware of any major Django deployment that runs PyPy instead of CPython. A better question is why you'd want to switch to PyPy for a Django app, especially as Django has been extensively tested and deployed with CPython.

PyPy is good for tasks that are computationally intensive. Web apps are usually not. The Django benchmark they base their performance numbers off is essentially a template rendering benchmark which is a CPU intensive task. This is not representative of most web apps where the bottle neck tends to be I/O. As such, PyPy may not speed up your site as much as those graphs lead you to believe.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon