1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
ab -n100000 -c1000 -r http://localhost:9004/ # append /etc/security/limits.conf # for a specific user # sudo sh -c 'printf "'$USER' soft nofile 1000000" >> /etc/security/limits.conf' # for all users sudo sh -c 'printf " * soft nofile 1000000 * hard nofile 1000000 * soft nproc 1000000 * hard nproc 1000000" >> /etc/security/limits.conf' # sudo vim /etc/security/limits.conf http://linux-quirks.blogspot.de/2011/02/too-many-open-files.html # append /etc/sysctl.conf sudo sh -c 'echo "fs.file-max = 1000000" >> /etc/sysctl.conf' # sudo vim /etc/sysctl.conf sudo sysctl -p otherwise restart server! a@t400:~$ ulimit -n 999999 bash: ulimit: open files: cannot modify limit: Operation not permitted root@ubuntu:~# sudo su - ulimit -n 999999 ------- ulimit -n socket: Too many open files (24) Error ------------------------------------------------- http://www.cyberciti.biz/faq/linux-unix-nginx-too-many-open-files/ http://askubuntu.com/questions/100183/nginx-testing-with-ab-not-working-with-high-number-of-concurrent-connections ------------------------------------------------- wget http://gevent.googlecode.com/files/gevent-1.0b2.tar.gz tar -xvf gevent-1.0b2.tar.gz cd gevent-1.0b2 sudo python setup.py install |
1 2 3 |
# https://github.com/mopemope/meinheld sudo easy_install -ZU meinheld |
1 2 3 4 5 6 7 8 9 10 11 |
from meinheld import server def hello_world(environ, start_response): status = '200 OK' res = "Hello world!" response_headers = [('Content-type','text/plain'),('Content-Length',str(len(res)))] start_response(status, response_headers) return [res] server.listen(("0.0.0.0", 8000)) server.run(hello_world) |