토네이도 프레임 워크를 사용하고 있습니다. 하지만 토네이도가 스트레스 테스트에서 30 초가 지나면 자주 실패하는 것을 발견했습니다 (다중 기계 사용). 나는 multi-mechanize에서 10 개의 쓰레드를 사용하고 약 500 요청/초, 100 초 동안 실행한다. 30 초 후에 약 15 %의 고장률이 발생합니다. 전체 테스트는 약 100 초입니다! [여기에 이미지 설명 입력] [1]. 통계에서 알다시피, 실패는 0.2 초 후에 타임 아웃으로 인한 것일 수 있습니다. 나는 웹상에서 타임 아웃을 늘리는 몇 가지 방법을 찾았지만 아무것도 작동하지 않는다. 여기 토네이도 시간 제한을 늘리는 방법
import tornado.ioloop
import tornado.web
class MainHandler(tornado.web.RequestHandler):
@tornado.web.asynchronous
def get(self):
self.write("Hello, world")
self.finish()
application = tornado.web.Application([
(r"/", MainHandler),
])
if __name__ == "__main__":
application.listen(8000)
tornado.ioloop.IOLoop.instance().start()
내 멀티 기계화 테스트 스크립트입니다 :
아래는 내 토네이도 코드
import requests
import random
import time
class Transaction(object):
def __init__(self):
pass
def run(self):
r = requests.get('http://127.0.0.1:8000')
output = r.raw.read()
assert(r.status_code == 200)
return output
if __name__ == '__main__':
trans = Transaction()
trans.run()
print trans.custom_timers
다음 내가 multimech - 실행에서받은 오류 메시지가
Traceback (most recent call last):
File "././test_scripts/v_user.py", line 12, in run
r = requests.get('http://127.0.0.1:8000')
File "/Library/Python/2.7/site-packages/requests/api.py", line 54, in get
return request('get', url, **kwargs)
File "/Library/Python/2.7/site-packages/requests/safe_mode.py", line 37, in wrapped
return function(method, url, **kwargs)
File "/Library/Python/2.7/site-packages/requests/api.py", line 42, in request
return s.request(method=method, url=url, **kwargs)
File "/Library/Python/2.7/site-packages/requests/sessions.py", line 230, in request
r.send(prefetch=prefetch)
File "/Library/Python/2.7/site-packages/requests/models.py", line 603, in send
timeout=self.timeout,
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 415, in urlopen
body=body, headers=headers)
File "/Library/Python/2.7/site-packages/requests/packages/urllib3/connectionpool.py", line 267, in _make_request
conn.request(method, url, **httplib_request_kw)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 941, in request
self._send_request(method, url, body, headers)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 975, in _send_request
self.endheaders(body)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 937, in endheaders
self._send_output(message_body)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 797, in _send_output
self.send(msg)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 759, in send
self.connect()
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/httplib.py", line 740, in connect
self.timeout, self.source_address)
File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/socket.py", line 571, in create_connection
raise err
error: [Errno 49] Can't assign requested address
그래서 초당 5,000 건의 요청을 보내고 있습니까? –
초당 5000 건의 요청을 처리해야한다면 백엔드를 더 많이 _ 추가해야합니다. 로드하는 데 30 초 이상의 시간이 걸리는 페이지는 404의 –
내 mac에서 초당 약 500 건의 요청을 처리합니다. 다중 기계화로 캡처 한 오류는 Socket.error입니다. – Jimmy