4

关于 Python 「多进程」「异步」

 2 years ago
source link: https://www.v2ex.com/t/847290
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.
neoserver,ios ssh client

V2EX  ›  Python

关于 Python 「多进程」「异步」

  maobukui · 59 分钟前 · 174 次点击

首先声明,不讨论数据爬取的道德&法律问题,只是一个技术上的尝试。

尝试了一下 python 的多进程或者异步 2 中写法发起网络请求,都没问题。

不过,异步的本质还是一个线程在执行,效率虽然已经很高,但是仍然没有发挥多核优势。对于大量的数据,能否多进程+异步完成?

尝试了下,始终没能成功,网上多进程+同步,或者单进程+异步倒是挺多的,但是多进程+异步相关资料比较少,有大神实践过吗。感谢

用到的异步请求库 httpx


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK