Details
-
Improvement
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.2.0
-
None
Description
We have a test where we send 100 messages simultaneously. James does not handle this well. With a standard setup 40-70 messages are NOT handled. After tweaking the config file (allocating more threads and connections) still 10-30 messages are not picked up.
We discovered that James specifies a very tight 'backLog' value when creating a ServerSocket. This happens in org.apache.james.core.AbstractJamesService.initialize() on line 302:
ServerSocket serverSocket = factory.createServerSocket(port, 5, bindTo);
(Sorry no time to do a proper diff)
We suppose that eventually a java.net.ServerSocket is created with this value. According to the javadoc of ServerSocket, the default value is 50. This can be specified by setting the backLog parameter to 0. See http://java.sun.com/j2se/1.4.2/docs/api/java/net/ServerSocket.html
We changed the above line in AbstractJamesService to
ServerSocket serverSocket = factory.createServerSocket(port, 0, bindTo);
With this fix all 100 messages are accepted (on Windows 2000 Server).
We advise that James uses the default value for the backLog parameter. If there is a special reason why the default value should be 5, please make it a parameter we can specify in the config file.
Thanks
Hes.