2

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

客户端向网站发送post请求,然后网站查询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() File "/usr/lib/python2.7/socket.py", line 307, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) 错误:[Errno 104] Connection reset by同行

客户端:

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)

我已经为更高的 max_connections 和 timeout 调整了 mysql 配置,但它不起作用。

谁能帮我解决这个问题?谢谢。

4

0 回答 0