#Benchmarking NodeJS VS Python
Code used to benchmark NodeJS (using expressjs framework) and Python (using flask framework).
These instructions assume an Ubuntu Linux operating system environment, but with knowledge about one's target server, it could be deployed anywhere.
To clone this repository, type the following:
git clone https://github.com/barrysteyn/benchmark-node_vs_python.git
The following is required to be installed (I suggest installing it in the order presented below)
- npm - the node package manager. To install on ubuntu, type
sudo apt-get install npm
(works on Ubuntu versions 11.10 and higher). - nvm - the node versioning manager (look at nvm documentation for install instructions).
- NodeJS - install Node using nvm as presented above (see the nvm documentation for instructions how to do this).
Go to the node folder of the cloned repository and type npm install
. This will install Node's local dependencies that the application requires.
###Make An Upstart Service For Node Once the above has been completed, Node must be setup as an upstart service. Instructions on how to do this can be found here.
The following is required to be installed (again, install in the order presented)
- Python - this comes installed by default on Ubuntu.
- Extra python libraries -
sudo apt-get install python-pip python-dev build-essential
(very important to install). - VirtualEnv - Python virtual environment (to install, type
pip install virtualenv
). - VirtualEnvWrapper - A set of shell scripts for VirtualEnv (to install, type
pip install virtualenvwrapper
).
Create an use a virtual environment called python-flask-benchmark
by typing the following:
mkvirtualenv python-flask-benchmark
.workon python-flask-benchmark
.
Now install flask by typing pip install Flask
.
###Make an Upstart Service For Python With Uwsgi
Note: Make sure that you are still in your virtual environment. Type workon python-flask-benchmark
to ensure you are in it. Install uwsgi by typing pip install uwsgi
. In order to determine exactly where uwsgi was installed, type the following:
cd ~
find . -name uwsgi
Look out for the path that ends in python-flask-benchmark/bin/uwsgi
- this is the path that you will need. Once all this has been completed, uwsgi must be setup as an upstart service. Instructions on how to do this can be found here.