private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery
To achieve optimal fair handling for all users of a server, it can be necessary to limit the resources that each user/connection can utilize so as to maximize throughput for the server or to ensure that the entire server runs within the limitations of it's runtime
An instance of LowResourcesMonitor may be added to a Jetty Server to monitor for low resources situations and to take action to limit the number of idle connections on the server. To configure the low resources monitor, you can uncomment the jetty-lowresources.xml line from the start.ini configuration file, which has the effect of including the following XML configuration:
<?xml version="1.0"?> <!DOCTYPE Configure PUBLIC "-//Jetty//Configure//EN" "http://www.eclipse.org/jetty/configure_9_0.dtd"> <!-- =============================================================== --> <!-- Mixin the Low Resources Monitor --> <!-- =============================================================== --> <Configure id="Server" class="org.eclipse.jetty.server.Server"> <Call name="addBean"> <Arg> <New class="org.eclipse.jetty.server.LowResourceMonitor"> <Arg name="server"><Ref refid='Server'/></Arg> <Set name="period">1000</Set> <Set name="lowResourcesIdleTimeout">200</Set> <Set name="monitorThreads">true</Set> <Set name="maxConnections">0</Set> <Set name="maxMemory">0</Set> <Set name="maxLowResourcesTime">5000</Set> </New> </Arg> </Call> </Configure>
The monitor is configured with a period in milliseconds at which it will scan the server looking for a low resources condition, which may be one of:
If monitorThreads is configured as true and a connectors Executor is an instance of ThreadPool, then its isLowOnThreads() method is used to detect low resources.
If maxConnections is configured to a number >0 then if the total number of connections from all monitored connectors exceeds this value, then low resources state is entered.
If the maxMemory field is configured to a number of bytes >0 then if the JVMs total memory minus its idle memory exceeds this value, then low resources state is entered.
Once low resoureces state is detected, then the monitor will iterate over all existing connections and set their IdleTimeout to its configured lowResourcesIdleTimeout in milliseconds. This allows the idle time of existing connections to be reduced so that the connection is quickly closed if no further request are received.
If the low resources state persists longer than the time in milliseconds configured for the maxLowResourcesTime field, the the lowResourcesIdleTimeout is repeatedly applied so that new connections as well as existing connections will be limited.
TBD (see DoSFilter).
See an error or something missing? Contribute to this documentation at Github!