更新时间:2022-11-03 22:57:57
异步服务器支持更大的客户端同时连接数。更传统的服务器遇到了线程和进程限制服务大量并发用户,尤其是那些长期连接的时候。因为他们避免了如管理费用异步服务器也可以提供更好的性能线程上下文切换。
Asynchronous servers support much larger numbers of simultaneous client connections. More conventional servers come up against thread and process limits when servicing large number of concurrent clients, particularly those with long-lived connections. Async servers can also provide better performance as they avoid the overheads of e.g. thread context switching.
还有扭曲
框架,也有在Python的标准库异步服务器构建模块:previously asyncore
和 asynchat
,但现在还 ASYNCIO
。
As well as the Twisted
framework, there are also asynchronous server building blocks in Python's standard library: previously asyncore
and asynchat
, but now also asyncio
.