我需要做许多DNS请求。我在看Python并发库,它在简介中说:
https://docs.python.org/3.4/library/concurrency.html
The appropriate choice of tool will depend on the task to be executed (CPU bound vs IO bound) and preferred style of development (event driven cooperative multitasking vs preemptive multitasking).
我的任务是IO绑定的,但是文档没有建议使用哪个模块。 哪个模块最适合IO绑定任务(例如,DNS请求)?在
如果您不受CPU的限制,我建议您尝试使用标准库asyncio模块进行i/O绑定操作。在
https://docs.python.org/3/library/asyncio.html
下面是一个第三方模块,用于依赖于asyncio的异步dns请求:
https://github.com/saghul/aiodns
干杯!在
相关问题 更多 >
编程相关推荐