[pypy-dev] Playing with PyPy and Django

Omer Katz omer.drow at gmail.com
Sat Feb 7 17:45:09 CET 2015


I use locust to warm up the the entire site after deployments.
As a bonus you'll be able to stress test your code.

I really recommend using uwsgi for production python sites. It takes some
time to learn it but it makes the site so much more responsive it's worth
it.

As mentioned PyPy3 is still slower then CPython.
I haven't seen such a performance difference with PyPy2.

2015-02-07 17:25 GMT+02:00 Tin Tvrtković <tinchester at gmail.com>:

>  Alright, trying 10,000 warmup requests, and then 100 benchmark requests,
> "production" scenario (gunicorn, one worker, no debug):
>
> PyPy3          26.956 [ms]
> CPython 3.4    10.822 [ms]
>
> So, not much improvement there. Also consider the slight inconvenience of
> mandatory manual warmup every deploy:
>
> * would I need to warm up just the site, every application, or every
> template?
> * I'd need a prepared session to warm up anything except the login page
> * I'll be running more worker processes, so even more warmup requests,
> hopefully they'd get distributed evenly amongst the workers
>
>
>
> On 07.02.2015 07:56, Omer Katz wrote:
>
>  You need to warm up the JIT first.
>  Run the benchmark a 10,000 times on PyPy before measuring and you'll see
> the real performance improvement.
>  Nevertheless, it does sound like you're hitting a performance bug(s)
> somewhere. It's worth investigating.
>
>  2015-02-07 1:12 GMT+02:00 Tin Tvrtković <tinchester at gmail.com>:
>
>> Hello, PyPy folks!
>>
>> While trying to speed up one of my Django sites, I noticed a new version
>> of PyPy
>> had just been released. So I grabbed a fresh download of PyPy 3 (since
>> this is
>> a Python 3 codebase) and tried taking it out for a spin.
>>
>> However, as far as I can see, whatever I try PyPy is consistently slower
>> than
>> CPython for this.
>>
>> Since this is a proprietary site, I've basically ripped out all the code
>> except
>> my settings.py and my requirements; and am benchmarking the Django admin
>> index.
>> The results are about the same.
>>
>> I've set up a small repo that can be used to reproduce the environment:
>> https://github.com/Tinche/PyPy-Django-Playground. There's additional
>> info in
>> the README there.
>>
>> These tests have been carried out on Ubuntu Trusty, 64-bit. CPython 3 is
>> the
>> system Python, 3.4. PyPy has been downloaded from the official site and
>> unzipped.
>>
>> So what I basically do is set up an admin session, and use the Django
>> main admin
>> page. 200 warmup requests, then 100 benchmarked requests, look at the mean
>> request time.
>>
>> Some results:
>>
>> Django's runserver, DEBUG mode:
>>
>> PyPy3            485.389 [ms]
>> CPython 3.4      105.777 [ms]
>>
>> Django's runserver, no debug:
>>
>> PyPy3             44.661 [ms]
>> CPython 3.4       18.697 [ms]
>>
>> Gunicorn, 1 worker, no debug:
>>
>> PyPy3             28.615 [ms]
>> CPython 3.4       13.532 [ms]
>>
>> I don't exactly claim to be an expert on benchmarking, but assuming my
>> site
>> is similar to the Django admin, CPython's gonna be giving me better
>> performance.
>> Also the debug runserver performance is kinda worrying. Nobody's going to
>> be
>> running this in production, but it makes development a little slower and
>> more
>> annoying than it should be.
>>
>> Is there anything to make PyPy more competitive in these kinds of
>> scenarios?
>>
>> Kind regards,
>> Tin
>> _______________________________________________
>> pypy-dev mailing list
>> pypy-dev at python.org
>> https://mail.python.org/mailman/listinfo/pypy-dev
>>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pypy-dev/attachments/20150207/b182f77a/attachment.html>


More information about the pypy-dev mailing list