Try up TCP connection limits:

sysctl net.core.somaxconn=2048
sysctl net.ipv4.tcp_max_syn_backlog=2048

A sample UWSGI configuration:

https://bitbucket.org/akorn/helloworld/src/tip/01-welcome/django/uwsgi.ini

Adjust uwsgi for more processes as you find reasonable.

Thanks.

Andriy Kornatskyy

On Jan 29, 2014, at 1:42 PM, Łukasz Mierzwa <[email protected]> wrote:

> Remember that rate (N requests / second) and concurrency (N requests running 
> at the same time) are 2 different things. Single worker process can handle 
> single requests at once, but if request is handled in 0.1 second it can 
> handle 10 requests / second. So you can't really expect to have 500 
> concurrent requests being handled using only 2 worker processes. The only way 
> to handle > 1 requests at the same time using single worker process is using 
> threads (but  AFAIR django isn't thread safe and if it was threads with 
> python have limitations so don't expect linear scaling) or gevent (or other 
> async engines).
> 
> 
> 2014-01-29 Andriy Kornatskyy <[email protected]>
> Dig,
> 
> I really doubt and uwsgi can’t help there.
> 
> Look at some benchmarks here:
> http://mindref.blogspot.com/search/label/benchmark
> 
> Thanks.
> 
> Andriy Kornatskyy
> 
> On Jan 29, 2014, at 8:16 AM, Dig <[email protected]> wrote:
> 
> > Hi uWSGI,
> >
> > [Task]
> >   I have a Django application to serve my visitor for large concurrent 
> > (>500).
> > To simplify, we create empty project for deploy testing.
> >
> > [Background]
> >     Server:
> >         Env: Ubuntu 12.04 server 64bit + nginx 1.1.19 (1 worker)
> >         App: An empty Django (1.6.1) project (no database) + uWSGI (2.0)
> >         uwsgi command
> >             uwsgi --master --socket 127.0.0.1:54321 --uid 1000 --gid 1000 
> > --harakiri 120 --reload-on-rss 256 --vacuum --limit-post 10485760 
> > --post-buffering 4096 --touch-reload 
> > /home/dig/st/touch-to-reload-speed-test --python-path /home/dig/st 
> > --python-path /home/dig/st/st/ --module wsgi --socket-timeout 30 --listen 
> > 1000 --close-on-exec --processes=2
> >
> >     Test tool:
> >         OS: Ubuntu 12.04 server 64bit
> >         Apache benchmark (ab)
> >
> >     Network: 1Gbps Ethernet
> >
> > [Steps]
> > 1. start nginx, and execute test for static content
> >     $ ab ab -k -c 500 -n 10000 http://10.144.166.55/static/
> >     All requests completed, and about 10,000 requests handled per second.
> >
> > 2. create an empty Django project, and deploy with uwsgi, test with ab 
> > again:
> >     $ ab ab -k -c 500 -n 10000 http://10.144.166.55/static/
> >     I got error:
> >         Benchmarking 10.144.166.55 (be patient)
> >         apr_socket_recv: Connection reset by peer (104)
> >
> > 3. decrease the concurrent to 300:
> >     $ ab ab -k -c 300 -n 10000 http://10.144.166.55/static/
> >     it successed, and about 530 requests handled per second.
> >
> > [Question]
> >   Is there any instructions to make the empty Django application support 
> > over 500 concurrent in a single box?
> >
> > Thanks,
> > Dig
> > _______________________________________________
> > uWSGI mailing list
> > [email protected]
> > http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
> 
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi
> 
> 
> 
> -- 
> Łukasz Mierzwa
> _______________________________________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to