Django显示了Python socket.error:[Errno 104]连接由peer重置

时间:2017-03-07 06:52:51

标签: mysql django python-2.7 high-traffic

我在AWS上有一个django + mysql网站。

客户端向网站发送帖子请求,然后网站查询mysql数据库并返回一个json。

我正在对它进行压力测试。 我同时向网站发送300个帖子请求并正确获得回复。 但是,如果我将发布请求的数量增加到400,则会失败并显示以下日志。

服务器端:

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()     文件" /usr/lib/python2.7/socket.py",第307行,在flush self._sock.sendall(view [write_offset:write_offset + buffer_size])错误:[Errno 104]连接重置为对等

客户方:

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)

我已经调整了mysql配置以获得更高的max_connections和超时但它没有工作。

有人可以帮我解决这个问题吗?感谢。

0 个答案:

没有答案