←back to thread

Multi-Core by Default

(www.rfleury.com)
70 points kruuuder | 1 comments | | HN request time: 0.234s | source
Show context
jongjong ◴[] No.45539564[source]
Some code should be single core; like for example, a frontend UI for a web application... You don't want to be hoarding all of the user's CPU capacity with your frontend.

But I do like implementing my backends as multi-core by default because it forces me to architect the system in a simple way. In many cases, I find it easier to implement a multi-core approach. The code is often more maintainable and secure when you don't assume that state is always available in the current process. It forces a more FP/stateless approach. Or at least it makes you think really hard about what kind of state you want to keep in memory.

replies(1): >>45540418 #
1. procaryote ◴[] No.45540418[source]
In backends, you usually need to solve having concurrent requests from multiple users, regardless if you need it for performance. From that, the step to using multiple cores is sometimes very small.

I.e. you don't usually need to make a for loop parallel, you can just make sure different requests are parallel.