I'm trying to make a Scala application server based on the classic worker pool model. Given that:
- the machine has a quad-core processor
- there is a scheduler actor which is dedicated to blocking network I/O to listen
- worker actors are all non-blocking.
What would be the best value for corePoolSize to maximize the performance? Ideally the performance is maximized when the size of the worker thread pool is equal to the number of processor cores. So in this case, I guess the best value would be 5 (1 for the scheduler and the other 4 for the workers), or alternatively I could set the value to 4 and override the scheduler method of the scheduler actor so that it will not share the thread pool with the workers.
Is this correct? Any advice appreciated. Thanks!