53

Python也能高并发-又耳笔记

 5 years ago
source link: http://blog.51cto.com/youerning/2161196
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Python怎么处理高并发?使用协程, 事件循环, 高效IO模型(比如多路复用,比如epoll), 三者缺一不可。很多时候,笔者看过的文章都是说协程如何如何,最后告诉我一些协程库或者asyncio用来说明协程的威力,最终我看懂了协程,却还是不知道它为啥能高并发,这也是笔者写本文的目的。但是一切还是得从生成器说起,因为asyncio或者大多数协程库内部也是通过生成器实现的。注意上面的三者缺一不可。如果只懂其中一个,那么你懂了三分之一,以此类推,只有都会了,你才知道为啥协程能高并发。

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK