What is the best way for server to achieve high performance with Python asyncio API?
Skip to first unread message
Apr 27, 2022, 10:30:00 PMApr 27
Reply to author
Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Report message as abuse
Sign in to report message as abuse
Show original message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
My ideas are:
Multithreading using [migration_thread_pool](https://grpc.github.io/grpc/python/grpc_asyncio.html#create-server). Each thread has its own event loop and coroutines can be executed in different threads and it could utilize all CPUs. But coroutines must be thread-safe as coroutines executed in different threads can access the same data.
Multiprocessing. Each process has its main thread where event loop runs. In this case we don't need care about thread-safety as each process has its own memory space. Also read-only large data such as machine learning models can be shared in copy-on-write manner.
Which is better or is there any better way? Any other considerations?