Thank you!

I have to confess that my knowledge of asyncio is rather limited but I’ll give you my thoughts based on what I know.

asyncio is single-threaded and single-process but it feels like you are getting concurrency. The basic idea is that asynchronous routines can wait until they get their result and let other routines run while it is waiting. In essence, it is similar to how multithreading works but it is generally faster and scales better since it uses less resources.

The issue with asyncio is that you’ll need an async version of a library if you plan on running its functions asynchronously. Since you will probably be using functions from many different libraries in your program, I’m not sure you’ll be able to find async versions for all of them.

asyncio is also similar to multithreading in that it is good at speeding up IO bound tasks but not CPU bound tasks. You can mix asyncio with multiprocessing to sort of get the best of both worlds. I’m not sure how hard that will be in your use case though.

Unfortunately, I can’t give any specific suggestions without knowing more about what you are doing. But it sounds like you could use threads and processes to achieve what you are trying. I’d take threads/processes over TCP/IP protocol stuff any day, but I’m kinda biased. 😉

AI researcher, avid reader, fantasy and Sci-Fi geek, and fan of the Oxford comma.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store