Common Idioms for a simple server loop
- Single process with a main server loop
- Expects to handle all messages efficiently
- Best managed by a single receive statement
- Selective receive is a tradeoff between efficiency and simplifying code logic
- Manually unloading the message queue may be necessary
- Only if message receive has performance problems
- When selective receive is used excessively in a stateless situation
- If code splinters to multiple receive statements
- When it is necessary to search the entire queue periodically
- Extreme cases require splitting to multiple processes
- Main process unloads queue and routes messages
- Other processes can receive uniformly classified messages
- Shared data may end up in yet another process