[英]Tornado failing on OSX but working on Ubuntu
我們正在對龍卷風進行一些性能測試。 這是代碼
import tornado.websocket
import tornado.ioloop
import tornado.web
class TestTornado(tornado.websocket.WebSocketHandler):
def open(self):
self.set_nodelay(True)
pass
def on_message(self, message):
self.write_message(message)
self.close()
def on_close(self):
pass
def main():
applicationList = []
applicationList.append((r"/ws", TestTornado))
application = tornado.web.Application(applicationList)
application.listen(8888)
myIOLoopInstance = tornado.ioloop.IOLoop.instance()
myIOLoopInstance.start()
if __name__ == "__main__":
main()
並且我們正在使用thor --amount 10000 --messages 100 ws://localhost:8888/ws
但是,在OS X中,或多或少地經過7000個連接后,它始終會失敗,但是在Ubuntu上根本沒有錯誤。 請注意,我在說的是連接 ,而不是文件,因此問題與OS X可以處理的最大打開文件無關(它已經設置為1000000)。
所以..為什么會這樣? 我們可以在OS X上進行任何配置更改以使其正常運行嗎?
這是OSX本身的問題。 這些參數應該會有所幫助,但是我們不再在OS X上進行測試,因此不確定。
kern.ipc.maxsockbuf=4194304
kern.ipc.somaxconn=2048
kern.ipc.nmbclusters=2048
net.inet.tcp.rfc1323=1
net.inet.tcp.win_scale_factor=4
net.inet.tcp.sockthreshold=16
net.inet.tcp.sendspace=1042560
net.inet.tcp.recvspace=1042560
net.inet.tcp.mssdflt=1448
net.inet.tcp.v6mssdflt=1428
net.inet.tcp.msl=15000
net.inet.tcp.always_keepalive=0
net.inet.tcp.delayed_ack=3
net.inet.tcp.slowstart_flightsize=20
net.inet.tcp.local_slowstart_flightsize=20
net.inet.tcp.blackhole=2
net.inet.udp.blackhole=1
net.inet.icmp.icmplim=50
資料來源: https : //rolande.wordpress.com/2010/12/30/performance-tuning-the-network-stack-on-mac-osx-10-6/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.