Skip to content
GitLab
Projects Groups Topics Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Register
  • Sign in
  • pypy pypy
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributor statistics
    • Graph
    • Compare revisions
  • Issues 697
    • Issues 697
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 16
    • Merge requests 16
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Container Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • PyPyPyPy
  • pypypypy
  • Issues
  • #2305
Closed
Open
Issue created May 22, 2016 by Bitbucket Importer@bitbucket_importerMaintainer

asyncio benchmarks from uvloop project slower on PyPy3 than on CPython

Created originally on Bitbucket by squeaky

http://magic.io/blog/uvloop-blazing-fast-python-networking/

PyPy3 nightly server & client
-----------------------------

1KiB

pypy3 client.py --num 10000 --workers 10 --msize 1000
will connect to: ('127.0.0.1', 25000)
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
100000 in 27.98492121696472
3573.352921907783 requests/sec

10KiB

pypy3 client.py --num 10000 --workers 10 --msize 10000
will connect to: ('127.0.0.1', 25000)
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
100000 in 42.212645053863525
2368.9583979492295 requests/sec

100 KiB

pypy3 client.py --num 10000 --workers 10 --msize 100000
will connect to: ('127.0.0.1', 25000)
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
100000 in 231.10237002372742
432.7086736052639 requests/sec


CPython 3.5 server & client
---------------------------

1KiB

/usr/bin/python3.5 client.py --num 10000 --workers 10 --msize 1000
will connect to: ('127.0.0.1', 25000)
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
100000 in 24.576037406921387
4069.004223269812 requests/sec


10KiB

/usr/bin/python3.5 client.py --num 10000 --workers 10 --msize 10000
will connect to: ('127.0.0.1', 25000)
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
100000 in 20.850675344467163
4796.007723871425 requests/sec


100KiB

/usr/bin/python3.5 client.py --num 10000 --workers 10 --msize 100000
will connect to: ('127.0.0.1', 25000)
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
Sending 10000 messages
100000 in 52.21383476257324
1915.2012192691843 requests/sec

Steps to reproduce:

I edited the benchmarks from https://github.com/MagicStack/uvloop/tree/master/examples/bench to not use async and await keywords


1. Get the latest nightly of pypy3
2. If you are running a system that is not exactly like Ubuntu 14.04 LTS 
  * `ldd bin/pypy3` to lookup broken symbols and libraries,
  * you can get openssl from http://packages.ubuntu.com/trusty/amd64/libssl1.0.0/download,
    unpack it and drop libssl.so.1.0.0 and libcrypto.so.1.0.0 into `bin` where `pypy3` binary resides 
  * everything else works with symlinking in your `/usr/lib64`
3. Get the develop branch of virtualenv https://github.com/pypa/virtualenv/archive/develop.zip and unzip it
4. Given your pypy3 tarball was unpacked to `pypy-c-jit-84568-d463dd98e6a6-linux64`:


LD_LIBRARY_PATH=pypy-c-jit-84568-d463dd98e6a6-linux64/bin virtualenv-develop/virtualenv.py -p pypy-c-jit-84568-d463dd98e6a6-linux64/bin/pypy3 venv-pypy3


5. Fix virtualenv by coping `libssl.so.1.0.0` and `libcrypto.so.1.0.0` into `venv-pypy3/bin`
   if you had problems with openssl
6. Activate virtualenv and `pip install asyncio`
6a. Fix missing `time.get_clock_info` in PyPy by hardcoding your monotonic clock resolution
    in `asyncio/base_events.py`, I got my resolution from CPython 3.5

Substitute

self._clock_resolution = time.get_clock_info('monotonic').resolution

with

self._clock_resolution = 1e-09


7. Run the attached server.py


python server.py --print


8. Run the client

python client.py --num 10000 --workers 5


9. Play with other options and see your results

Attachments: client.pyserver.py

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking