What is the best way for server to achieve high performance with Python asyncio API?
151 views
Skip to first unread message
Yusuke Nishioka
unread,
Apr 27, 2022, 10:30:00 PM4/27/22
Reply to author
Sign in to reply to author
Forward
Sign in to forward
Delete
You do not have permission to delete messages in this group
Copy link
Report message
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
to grpc.io
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?