Recently saw PyPy can improve the operating rate of python to a very abnormal situation, coupled with the current Ryu to find a topology limited ability to meet the requirements of the experiment, so want to try to run on the PyPy
Deploy PyPy in Virtualenv, early in Python, I heard about Python's three great artifacts: Pip, virtualenv, and fabric, before just trying the next virtualenv, this time pypy is deployed in a virtual environment, Feel the virtualenv great convenience, the process is as follows:
- Installing Virtualenv
VIRTUALENV installation is relatively simple, use the following command directly:
Pip Install Virtualenv
Download PyPy
PyPy's official website is: http://pypy.org/download.html, which provides various versions and Platform PyPy, but no windows 64bit, because CPython and pypy for the int data type length definition is different, Details can be found in the official website, but StackOverflow above someone said win 32bit PyPy can be very good run on the win 64bit (URL), I did not try, we can try, if not, so it is best to use under Linux, or change the Python version to 32-bit, and choose the pypy for your environment to download. Then unzip, I downloaded the tar.bz2 format of the compressed file, so with the following command to extract, in accordance with the habit, I will unzip it into the home directory.
TAR-VXJF pypy-4.0.0-linux64.tar.bz2
Build the PyPy compilation environment in a virtual environment
Use the following command (be careful to choose your own pypy-extracted directory):
Virtualenv-p/home/cotyb/pypy/bin/pypy pypy-env
This creates a virtual environment called PYPY-ENV, an interpreter for PyPy, and then a CD pypy-env, whichjumps to the folder where the virtual environment is located and executes . bin/activate Activates the virtual environment, You can execute Python or pypy to see if the PyPy has been configured successfully
After activation, the terminal prompt is preceded by parentheses, inside the virtual environment you created, similar to (PYPY-ENV), and then using git clone git://github.com/osrg/ryu.git to download ryu,git tag and git Checkout can choose the version of Ryu that you want to use, if not, see this blog. The final Ryu installation. After that, you can run your own program.
I used mininet to build the depth=8 tree topology, with PyPy to perform the command to find the topology, in many cases will still be stuck, can not fully discover the topology, card 100 switches below, but in more than 10 experiments 2 times found a complete topology
At the same time using PyPy to perform some other operational tests, including file processing, pure arithmetic, and found that pypy efficiency is even lower than the python, and so have time to learn more about PyPy.
Run Ryu with PyPy