I have a django+mysql website on AWS.
Client send post request to website, then the website query the mysql database and return a json.
I am doing stress testing to it. I send 300 post requests simultaneously to the website and get responses correctly. But if I increase the number of post request to 400, it fails with following log.
Server side :
File "/usr/lib/python2.7/wsgiref/handlers.py", line 86, in run
self.finish_response()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 128, in finish_response
self.write(data)
File "/usr/lib/python2.7/wsgiref/handlers.py", line 212, in write
self.send_headers()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 270, in send_headers self.send_preamble()
File "/usr/lib/python2.7/wsgiref/handlers.py", line 191, in send_preamble self._write('HTTP/%s %s\r\n' % (self.http_version,self.status))
File "/usr/lib/python2.7/wsgiref/handlers.py", line 391, in _write self.stdout.write(data)
File "/usr/lib/python2.7/socket.py", line 328, in write
self.flush() File "/usr/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 104] Connection reset by peer
Client side:
HTTPConnectionPool(host='mywebsite.com', port=3456): Max retries exceeded with url: /project/result.json (Caused by <class 'socket.error'>: [Errno 104] Connection reset by peer)
I have tuned the mysql configuration for higher max_connections and timeout but it doesn't work.
Can anyone help me to resolve the issue? Thanks.