Last active
January 2, 2016 08:48
-
-
Save lifuzu/8278468 to your computer and use it in GitHub Desktop.
performance analysis of gevent, eventlet and node.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ab -n 1000 -c 100 http://localhost:6785/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 100 requests | |
... | |
Finished 1000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 6785 | |
Document Path: / | |
Document Length: 12 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 0.639 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo pip install gevent | |
$ ab -n 1000 -c 100 http://localhost:8912/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 100 requests | |
... | |
Finished 1000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 8912 | |
Document Path: / | |
Document Length: 12 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 0.360 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ab -n 1000 -c 100 http://localhost:9124/ | |
This is ApacheBench, Version 2.3 <$Revision: 655654 $> | |
Copyright 1996 Adam Twiss, Zeus Technology Ltd, http://www.zeustech.net/ | |
Licensed to The Apache Software Foundation, http://www.apache.org/ | |
Benchmarking localhost (be patient) | |
Completed 100 requests | |
... | |
Finished 1000 requests | |
Server Software: | |
Server Hostname: localhost | |
Server Port: 9124 | |
Document Path: / | |
Document Length: 12 bytes | |
Concurrency Level: 100 | |
Time taken for tests: 0.186 seconds |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import eventlet | |
from eventlet import wsgi | |
def app(environ,start_response): | |
start_response("200 OK",[("Content-Type","text/plain")]) | |
return "Hello World\n" | |
if __name__=="__main__": | |
wsgi.server(eventlet.listen(("localhost",6785)),app) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import gevent | |
from gevent import wsgi,pool | |
#the application to handle the response | |
def app(environ,start_response): | |
start_response("200 OK",[("Content-Type","text/plain")]) | |
return "Hello World\n" | |
if __name__=="__main__": | |
print "The sweet thing is running on http://localhost:8912/" | |
pool=gevent.pool.Pool() #A pool of greenlets.Each greenlets runs the above defined function app for a client request | |
server=wsgi.WSGIServer(("localhost",8912),app,spawn=pool) #the server is created and runs multiple greenlets concurrently | |
server.serve_forever() #the server is made to run in loop |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo lshw -short | |
H/W path Device Class Description | |
======================================================= | |
system 23445LU (LENOVO_MT_2344) | |
/0 bus 23445LU | |
/0/1 processor Intel(R) Core(TM) i7-3520M CPU @ 2.90GHz | |
/0/1/3 memory 32KiB L1 cache | |
/0/1/4 memory 256KiB L2 cache | |
/0/1/5 memory 4MiB L3 cache | |
/0/2 memory 32KiB L1 cache | |
/0/7 memory 8GiB System Memory | |
/0/7/0 memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns) | |
/0/7/1 memory 4GiB SODIMM DDR3 Synchronous 1600 MHz (0.6 ns) | |
/0/e memory 128KiB BIOS | |
/0/100 bridge 3rd Gen Core processor DRAM Controller | |
/0/100/2 display 3rd Gen Core processor Graphics Controller | |
/0/100/14 bus 7 Series/C210 Series Chipset Family USB xHCI Host Controller | |
/0/100/16 communication 7 Series/C210 Series Chipset Family MEI Controller #1 | |
/0/100/16.3 communication 7 Series/C210 Series Chipset Family KT Controller | |
/0/100/19 eth0 network 82579LM Gigabit Network Connection | |
/0/100/1a bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #2 | |
/0/100/1b multimedia 7 Series/C210 Series Chipset Family High Definition Audio Controller | |
/0/100/1c bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 1 | |
/0/100/1c/0 generic MMC/SD Host Controller | |
/0/100/1c.1 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 2 | |
/0/100/1c.1/0 wlan0 network Centrino Advanced-N 6205 [Taylor Peak] | |
/0/100/1c.2 bridge 7 Series/C210 Series Chipset Family PCI Express Root Port 3 | |
/0/100/1d bus 7 Series/C210 Series Chipset Family USB Enhanced Host Controller #1 | |
/0/100/1f bridge QM77 Express Chipset LPC Controller | |
/0/100/1f.2 storage 7 Series Chipset Family 6-port SATA Controller [AHCI mode] | |
/0/100/1f.3 bus 7 Series/C210 Series Chipset Family SMBus Controller | |
/0/0 scsi0 storage | |
/0/0/0.0.0 /dev/sda disk 512GB M4-CT512M4SSD1 | |
/0/0/0.0.0/1 /dev/sda1 volume 350MiB Windows NTFS volume | |
/0/0/0.0.0/2 /dev/sda2 volume 257GiB Windows NTFS volume | |
/0/0/0.0.0/3 /dev/sda3 volume 218GiB Extended partition | |
/0/0/0.0.0/3/5 /dev/sda5 volume 211GiB Linux filesystem partition | |
/0/0/0.0.0/3/6 /dev/sda6 volume 6887MiB Linux swap / Solaris partition | |
/0/0/0.0.0/3/7 /dev/sda7 volume 1000MiB Linux filesystem partition | |
/0/3 scsi1 storage | |
/0/3/0.0.0 /dev/cdrom1 disk DVD RW AD-7740H | |
/1 power 45N1005 | |
/2 vethJwdXc5 network Ethernet interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var http=require("http"); | |
http.createServer(function(req,res){ | |
res.writeHead(200,{"Content-Type":"text/plain"}); | |
res.end("Hello World\n"); | |
}).listen(9124,"localhost"); | |
console.log("The sweet thing is running on http://localhost:9124"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat /etc/lsb-release | |
DISTRIB_ID=Ubuntu | |
DISTRIB_RELEASE=12.04 | |
DISTRIB_CODENAME=precise | |
DISTRIB_DESCRIPTION="Ubuntu 12.04.3 LTS" | |
$ uname -a | |
Linux ThinkPad-T430 3.8.0-34-generic #49~precise1-Ubuntu SMP Wed Nov 13 18:05:00 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment