Last Updated: February 25, 2016
·
1.395K
· davetron5000

Three concurrency methods, summed up

Run lots of processes

fork or just run the same process many times. You won't have problems with shared state, and your code will be easy to understand, but you'll waste a lot of memory

Evented I/O

For I/O bound tasks (which are the most common), you'll get great performance gains, but everything must be evented or you'll kill your app. Plus, your code is strewn throughout callbacks, making it hard to piece together just what your business logic is

Threads

You'll need to use thread management code like in java.util.concurrent to make this easy, but your code will be easy to understand and write. You just need to make sure everything you use is thread-safe.