It works, apparently I still have a lot to learn, my bad :) Thanks for your help :)
After setting stack size to 512k, results are: With 10 workers and 1 thread, without custom stack: from 134MB to 171MB With 1 worker and 10 threads, without custom stack: from 134MB to 214MB With 1 worker and 10 threads, with stack at 512k: from 134MB to 146MB With 5 workers and 10 threads, with stack at 512k: from 134MB to 180MB 2012/6/29 Roberto De Ioris <[email protected]> > > > Hi, i ran into strange issue. > > > > My server have a 590MB of RAM. > > Until today i had about 800 request per hour for Django app and uWSGI > > works > > very well with it, but as a result of massive advertising i manage to get > > about 10 000 requests per hour. So, i was forced to increase number of > > requests that uWSGI can handle. Before applying new config file, i make > > some performance test and i was suprised that increase threads number > from > > one, as is was so far, to 10 blows out my server. > > > > Until now uWSGI runs with 10 workers and one thread, with 512 listen > > queue. > > With 10 workers and 10 threads, uWSGI eats all of my RAM and constantly > > respawn workers. > > > > I make some simple test with default wsgi app and there's a result: > > > > uWSGI --workers 10 --threads 1 used about 38MB RAM > > uWSGI --workers 1 --threads 10 used about 79MB RAM > > uWSGI --workers 10 --threads 10 used hmm. All of it. > > uWSGI --workers 100 --threads 1 used about 350MB. > > uWSGI --workers 1 --threads 100 again eats all of my RAM. > > > > I understood, 10 threads with one worker uses 79MB of RAM, and with 10 > > threads it's should use about a 800MB, but in preforking mode i was able > > to > > run a 100 workers and it takes only a 350MB. > > > > > > It is a bug or not? Why uWSGI with 10 threads used almost a double of RAM > > than with 10 workers, with the same app and configuration, when threads > > should be a more memory-efficient? > > > > There's a screenshots from htop and console running uWSGI (don't blame me > > for using Windows, different memory manage etc. :) > > > > uWSGI --workers 100 --threads 1: http://i.minus.com/iRY7Ynupo1RiC.png > > uWSGI --workers 1 --threads 100: http://i.minus.com/ib2u1C1EJAXI9S.png > > > > uWSGI --workers 10 --threads 10 (here was worse than with 100 threads, > > memory usage was jumped from 40 to 100%, CPU was fully utilized, and i > > barely managed to kill uWSGI with Ctrl+C): > > http://i.minus.com/ibrlHVjC64tG9N.png > > And after kill: http://i.minus.com/iYbDACS6nfDMP.png > > _______________________________________________ > > > > On Linux systems, each python thread allocate various megabytes for the > stack (even 8MB). > > As uWSGI is not more than 2MB alone, this could lead to this huge nonsense > :) > > Try adding > > thread-stacksize = 512 > > this will reduce the thread stacksize to 512K. In my experience it is more > than enough (never had to increase that) > > > -- > Roberto De Ioris > http://unbit.it > _______________________________________________ > 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
