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?

Asked By: jl6

||

Answers:

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.

Answered By: CadentOrange
  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.

Answered By: Thomas
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.