10 points by pkkm 2 weeks ago | 3 comments
I'm curious about your experiences with these concurrency models - which are easy to get right, and which are endless sources of bugs? I'm particularly interested in use cases where there are lots of long-running connections and correctness matters more than performance: chat servers, MMORPG servers, IoT central systems, etc.
atomicnature 1 week ago
I have limited experience with Rust, but the ownership model and the borrow checker help with avoiding concurrency bugs as well. And personally for me, Rust slowed down the speed at which I could proceed solving the problem at hand. If you have time on your hands or you're very fluent with it, rust may give better results.
chubot 1 week ago
asyncio gives you the "straight-line" style of code like Go, and good timeout support, which is necessary for robustness
asyncio.Queue gives you backpressure, just like Go
---
That's for using one core, and then if you need to use all cores, use separate processes. (Threads won't utilize all your cores)
And maybe hand-roll the worker processes the the async child process - I think anything that automagically uses the "pickle" module is bad ...
This way you're using 1 or 2 concurrency models, not 3!
---
I think Go is probably more foolproof because you don't have to make as many of these choices. (It multiplexes goroutines across OS threads, etc.) But there are still reasons to use Python, e.g. if you application revolves around C bindings to some important service, or you just like using Python
And Python's type system is actually more expressive than Go now ...
ahoka 1 week ago