Overview

EJServer uses two different Threadpools to manage serverside tasks:

  • one pool for reading and processing client requests
  • another one for dispatching server responses
If not deviating indicated EJServer starts with
  • four threads for reading and processing client requests
  • two threads for dispatching server responses
All in all just six threads for a full featured network server? Does it sound a little bit less? In most cases these six threads are more than sufficient. Which values cause however optimal throughput and hardware extent of utilization, differs from hardware to hardware and platform to platform. In principle the following rule of thumb applies:

A relationship of 2/1 between threads for reading and processing client requests and threads for dispatching server responses offers the most balanced server behavior on the average .

The respective threadpool can be adjusted using the method setMaxReadProcessors respectively setMaxWriteProcessors of EJServer:

import de.netseeker.ejoe.EJServer;
...
{
	EJServer server = new EJServer( ... ); 
	//expected server load?
	//available hardware resources? 
	//how many read/process-threads are required? 
	server.setMaxReadProcessors( number of read/process-threads );
	//how many write-threads are required? 
 	server.setMaxWriteProcessors( number of write-threads );	
	//start the server
	server.start();
	...
}