django - Twisted connections timeout under heavy load -
we have django web app serves moderate number of users, running on ubuntu machine 8 cores , @ least 32gb ram. have no problems users connecting via browser. however, on backend (on same server) running twisted server. django webapp tries connect our twisted server, after 1100-1200 such connections (including bunch of persistent connections other devices on backend), connections start timeout. our twisted server worked fine under low load server seems unable handle new connections django. connections time out. not see wrong our code (which have been working on couple of years should pretty stable). have set our soft , hard ulimits in /etc/security/limits.conf 50000/65000 , have upped somaxconn 65536. print of limits our twisted process listed below. total number of files across tope 25 processes on 5000. unfortunately still cannot more 1100-1200 simultaneous connections our twisted server. things should @ make our twisted connections start connecting again? there other sysctl or other ubuntu linux parameters need change? there twisted parameters need change?
limit soft limit hard limit units max cpu time unlimited unlimited seconds max file size unlimited unlimited bytes max data size unlimited unlimited bytes max stack size 8388608 unlimited bytes max core file size 0 unlimited bytes max resident set unlimited unlimited bytes max processes 465901 465901 processes max open files 50000 65000 files max locked memory 65536 65536 bytes max address space unlimited unlimited bytes max file locks unlimited unlimited locks max pending signals 465901 465901 signals max msgqueue size 819200 819200 bytes max nice priority 0 0 max realtime priority 0 0 max realtime timeout unlimited unlimited
twisted thin shell around application. when there performance problem, always, problem somewhere inside application , not in twisted. there no general answer question.
that said, there couple of investigation techniques use. twisted process consuming 100% cpu? if so, going need split multiple processes somehow (using spawnprocess
, sendfiledescriptor
, adoptstreamport
allow i/o done in subprocesses). if not, problem inadvertent blocking i/o preventing reactor servicing requests: might use twisted_hang
diagnose hot-spots reactor getting "stuck".
there's possibility problem on django's side of connection. however, no information how django making connections, there's little more can guess.
Comments
Post a Comment