<div dir="rtl"><div dir="ltr">I use locust to warm up the the entire site after deployments.<br></div><div dir="ltr">As a bonus you'll be able to stress test your code.<br><br></div><div dir="ltr">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.<br><br></div><div dir="ltr">As mentioned PyPy3 is still slower then CPython.<br></div><div dir="ltr">I haven't seen such a performance difference with PyPy2.<br></div></div><div class="gmail_extra"><br><div class="gmail_quote"><div dir="ltr">2015-02-07 17:25 GMT+02:00 Tin Tvrtković <span dir="ltr"><<a href="mailto:tinchester@gmail.com" target="_blank">tinchester@gmail.com</a>></span>:</div><blockquote class="gmail_quote" style="margin:0 .8ex;border-left:1px #ccc solid;border-right:1px #ccc solid;padding-left:1ex;padding-right:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Alright, trying 10,000 warmup requests, and then 100 benchmark
    requests, "production" scenario (gunicorn, one worker, no debug):<br>
    <br>
    <tt>PyPy3          26.956 [ms]</tt><tt><br>
    </tt><tt>CPython 3.4    10.822 [ms]</tt><br>
    <br>
    So, not much improvement there. Also consider the slight
    inconvenience of mandatory manual warmup every deploy:<br>
    <br>
    * would I need to warm up just the site, every application, or every
    template?<br>
    * I'd need a prepared session to warm up anything except the login
    page<br>
    * I'll be running more worker processes, so even more warmup
    requests, hopefully they'd get distributed evenly amongst the
    workers<div><div class="h5"><br>
    <br>
    <br>
    <div>On 07.02.2015 07:56, Omer Katz wrote:<br>
    </div>
    <blockquote type="cite">
      <div dir="rtl">
        <div dir="ltr">You need to warm up the JIT first.<br>
        </div>
        <div dir="ltr">Run the benchmark a 10,000 times on PyPy before
          measuring and you'll see the real performance improvement.<br>
        </div>
        <div dir="ltr">Nevertheless, it does sound like you're hitting a
          performance bug(s) somewhere. It's worth investigating.<br>
        </div>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">
          <div dir="ltr">2015-02-07 1:12 GMT+02:00 Tin Tvrtković <span dir="ltr"><<a href="mailto:tinchester@gmail.com" target="_blank">tinchester@gmail.com</a>></span>:</div>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello,
            PyPy folks!<br>
            <br>
            While trying to speed up one of my Django sites, I noticed a
            new version of PyPy<br>
            had just been released. So I grabbed a fresh download of
            PyPy 3 (since this is<br>
            a Python 3 codebase) and tried taking it out for a spin.<br>
            <br>
            However, as far as I can see, whatever I try PyPy is
            consistently slower than<br>
            CPython for this.<br>
            <br>
            Since this is a proprietary site, I've basically ripped out
            all the code except<br>
            my settings.py and my requirements; and am benchmarking the
            Django admin index.<br>
            The results are about the same.<br>
            <br>
            I've set up a small repo that can be used to reproduce the
            environment:<br>
            <a href="https://github.com/Tinche/PyPy-Django-Playground" target="_blank">https://github.com/Tinche/PyPy-Django-Playground</a>.
            There's additional info in<br>
            the README there.<br>
            <br>
            These tests have been carried out on Ubuntu Trusty, 64-bit.
            CPython 3 is the<br>
            system Python, 3.4. PyPy has been downloaded from the
            official site and<br>
            unzipped.<br>
            <br>
            So what I basically do is set up an admin session, and use
            the Django main admin<br>
            page. 200 warmup requests, then 100 benchmarked requests,
            look at the mean<br>
            request time.<br>
            <br>
            Some results:<br>
            <br>
            Django's runserver, DEBUG mode:<br>
            <br>
            PyPy3            485.389 [ms]<br>
            CPython 3.4      105.777 [ms]<br>
            <br>
            Django's runserver, no debug:<br>
            <br>
            PyPy3             44.661 [ms]<br>
            CPython 3.4       18.697 [ms]<br>
            <br>
            Gunicorn, 1 worker, no debug:<br>
            <br>
            PyPy3             28.615 [ms]<br>
            CPython 3.4       13.532 [ms]<br>
            <br>
            I don't exactly claim to be an expert on benchmarking, but
            assuming my site<br>
            is similar to the Django admin, CPython's gonna be giving me
            better performance.<br>
            Also the debug runserver performance is kinda worrying.
            Nobody's going to be<br>
            running this in production, but it makes development a
            little slower and more<br>
            annoying than it should be.<br>
            <br>
            Is there anything to make PyPy more competitive in these
            kinds of scenarios?<br>
            <br>
            Kind regards,<br>
            Tin<br>
            _______________________________________________<br>
            pypy-dev mailing list<br>
            <a href="mailto:pypy-dev@python.org" target="_blank">pypy-dev@python.org</a><br>
            <a href="https://mail.python.org/mailman/listinfo/pypy-dev" target="_blank">https://mail.python.org/mailman/listinfo/pypy-dev</a><br>
          </blockquote>
        </div>
        <br>
      </div>
    </blockquote>
    <br>
  </div></div></div>

</blockquote></div><br></div>