Reputation: 1095
I have been researching on Google for quite some time now to understand how a server accepts a http-request and processes them. If I understand right there should be a listener on port 8080 that always keeps listening for incoming http-requests and as soon as it receives a request it should be able to create a thread and delegate the work to that thread.
With the knowledge above, what I am trying to understand is what is max-connections and max-threads while setting up http-connector. Also if we don't explicitly specify these then what is the maximum value?
<subsystem xmlns="urn:jboss:domain:web:2.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
</virtual-server>
</subsystem>
To be very specific here are my questions in bullet form:
Thank you!
Upvotes: 1
Views: 2888
Reputation: 2821
max-connections: The maximum number of connections that the server will accept and process at any given time.
If the max-connections attributes is not set on web subsystem connectors in standalone-(*).xml / domain.xml, default is computed as:
512 * Runtime.getRuntime().availableProcessors() //for default Java connector
32 * Runtime.getRuntime().availableProcessors() //for native APR connector addon
max-threads: The maximum number of request processing threads to be created by this Connector, which therefore determines the maximum number of simultaneous requests that can be handled.
EAP 6.x:
/**
* Maximum amount of worker threads.
*/
protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 64 : ((Constants.MAX_THREADS == -1) ? 512 * Runtime.getRuntime().availableProcessors() : Constants.MAX_THREADS);
public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; }
public int getMaxThreads() { return maxThreads; }
EAP 6.x with Native component:
/**
* Maximum amount of worker threads.
*/
protected int maxThreads = (org.apache.tomcat.util.Constants.LOW_MEMORY) ? 32 : ((Constants.MAX_THREADS == -1) ? 32 * Runtime.getRuntime().availableProcessors() : Constants.MAX_THREADS);
public void setMaxThreads(int maxThreads) { this.maxThreads = maxThreads; }
public int getMaxThreads() { return maxThreads; }
I believe both are same. I have never used max-connections attribute. Whenever custom max thread count was required, I used to create separate thread factory and thread pool. for more information refer to: redhat doc, SO Question Ans
Upvotes: 2