Resin Documentationapp server |
cluster and network tags referenceThis page is a quick reference to all the tags used for Resin clustering and load-balancing including <cluster>, <server>, <host>, <resin:LoadBalance>, <persistence-store> and <use-persistence-store>.
child of <server>
default 127.0.0.1The server <address> defines the IP interface for Resin cluster communication and load balancing. It will be an internal IP address like 192.168.* for a clustered configuration or 127.* for a single-server configuration. No wild cards are allowed because the other cluster servers and load balancer use the address to connect to the server. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server-default> <http port="80"/> </server-default> <server id="web-a" address="192.168.1.1" port="6800"/> <server id="web-b" address="192.168.1.2" port="6800"/> ... </cluster> <cluster id="app-tier"> <server id="app-a" address="192.168.2.11" port="6800"/> <server id="app-b" address="192.168.2.12" port="6800"/> ... </cluster> </resin> child of <resin>
<cluster> configures a set of identically-configured servers. The cluster typically configures a set of <server>s, each with some ports, and a set of virtual <host>s. Only one <cluster> is active in any on server. At runtime, the <cluster> is selected by the <server> with matching the -server on the command line.
element cluster { attribute id { string } & environment resources & access-log? & cache? & connection-error-page? & ear-default* & error-page* & host* & host-default* & host-deploy* & ignore-client-disconnect? & invocation-cache-size? & invocation-cache-max-url-length? & machine* & ping* & redeploy-mode? & resin:choose* & resin:import* & resin:if* & rewrite-dispatch? & root-directory? & server* & server-default* & server-header? & session-cookie? & url-character-encoding? & url-length-max? & web-app-default* } <resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server-default> <http port="8080"/> </server-default> <server id="a" address="192.168.0.10"/> <server id="b" address="192.168.0.11"/> <host host-name="www.foo.com"> ... </host> </cluster> </resin> child of <resin>
<cluster-default> defines default cluster configuration for all clusters in the <resin> server. <resin xmlns="http://caucho.com/ns/resin"> <cluster-default> <cache entries="16384" memory-size="64M"/> </cluster-default> <cluster id="web-tier"> ... </cluster> <cluster id="app-tier"> ... </cluster> </resin> child of <cluster>
<host> configures a virtual host. Virtual hosts must be configured explicitly. It is recommended that any <host> using a regexp include a <host-name> to set the canonical name for the host.
<host host-name="www.foo.com"> <host-alias>foo.com</host-alias> <host-alias>web.foo.com</host-alias> <root-directory>/opt/www/www.foo.com</root-directory> <web-app id="/" root-directory="webapps/ROOT"> </web-app> ... </host> <host regexp="([^.]+)\.foo\.com"> <host-name>${host.regexp[1]}.foo.com</host-name> <root-directory>/var/resin/hosts/www.${host.regexp[1]}.com</root-directory> ... </host> child of <cluster>
Defaults for a virtual host. The host-default can contain any of the host configuration tags. It will be used as defaults for any virtual host. child of <server>
<http> configures a HTTP or HTTPS port listening for HTTP requests. When configuring multiple JVMs, each <http> will have a unique <server-id> which allows the -server command-line to select which ports the server should listen to. Note The attribute overrides the browser's
Host directive, specifying the explicit host and port for
request.getServerName() and getServerPort() .
It is not used in most virtual host configurations.
Only IP-based virtual hosts which wish to ignore the browser's Host
will use @virtual-host.
element http { (id | server-id) & (address | host )? & port? & accept-listen-backlog? & accept-thread-idle-timeout? & accept-thread-min? & accept-thread-max? & connection-max? & keepalive-connection-time-max? & keepalive-max? & keepalive-select-enable? & keepalive-select-thread-timeout? & keepalive-timeout? & secure? & socket-timeout? & suspend-reaper-timeout? & suspend-time-max? & tcp-no-delay? & throttle-concurrent-max? & virtual-host? & (openssl | jsse-ssl)? } child of <server>
default 100<keepalive-max> configures the maximum number of sockets which can be used directly for keepalive connections. In Resin Professional, the select manager allows for a much larger number of keepalive sockets, since it can detach threads from connections. Without the select manager, each connection is associated with a thread. A value of -1 disables keepalives. Keepalives are an important TCP technique used with HTTP and Resin's load-balancing to avoid the heavy network cost of creating a new socket. Since an initial HTTP request is usually immediately followed by extra requests to load files like images and stylesheets, it's generally more efficient to keep the socket open for a short time instead of creating a new one. The socket keepalive is even more important for Resin's load balancing, to avoid creating extra sockets between the web-tier and the app-tier and to make distributed sessions more efficient. Higher values of <keepalive-max> improve network efficiency but increase the number of threads waiting for new client data. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server-default> <http port="80"/> <thread-max>512</thread-max> <keepalive-max>100</keepalive-max> </server-default> <server id="web-a" address="192.168.0.10"/> ... </cluster> </resin> child of <server>
default true<keepalive-select-enable> enables the select manager for keepalives. The select manager is a Resin Professional feature allowing more keepalives by detaching threads from sockets. Normally, this should be left enabled. child of <server>
default 15s<keepalive-timeout> configures how long a keepalive connection should wait for a new request before closing. Keepalives are used both for HTTP connections and for load-balancing and clustering connections. HTTP connections generally have a single HTML page, followed by a number of image requests. By using keepalives, all the requests can use a single socket. The <keepalive-timeout> should be long enough to catch all the HTTP burst requests, but can close after the burst is complete. A value of 5s or 15s is generally sufficient. The load-balancing and clustering keepalives have a different timeout behavior. Since load-balancing sockets are reused for multiple clients, they can have longer timeouts. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server-default> <http port="80"/> <thread-max>512</thread-max> <keepalive-max>100</keepalive-max> <keepalive-timeout>15s</keepalive-timeout> </server-default> <server id="web-a" address="192.168.0.10"/> ... </cluster> </resin> javadoc <resin:LoadBalance> <resin:LoadBalance> requires Resin Professional
Load balance to a cluster of backend Resin servers.
<resin xmlns="http://caucho.com/ns/resin" xmlns:resin="urn:java:com.caucho.resin"> <cluster id='app-tier'> <server id='a' port='6810'/> <server id='b' port='6820'/> ... </cluster> <cluster id='web-tier'> <server id='http' port='80'/> <host id=''> <resin:LoadBalance cluster="app-tier"/> </host> </cluster> </resin> child of <server>
default 100load-balance-weight assigns a load-balance weight to a backend server. Servers with higher values get more requests. Servers with lower values get fewer requests. In some cases, some app-tier servers may be more powerful than others. load-balance-weight lets the load-balancer assign more connections to the more powerful machines. Test and profiling servers can also use load-balance-weight to receive a small number of connections for profiling purposes. Larger values tell the load-balancer to assign more requests to the app-tier server. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <server id="a" address="192.168.0.10" port="6800"/> <server id="b" address="192.168.0.10" port="6800"/> <server id="test" address="192.168.0.100" port="6800"> <load-balance-weight>1</load-balance-weight> </server> <host id=""> ... </cluster> </resin> child of <server>
default 5s<load-balance-connect-timeout> configures the maximum time a client connection to a cluster-port should take. The load balance and persistent sessions use load-balance-connect-timeout to connect to backend or peer servers in the cluster. Lower values detect failed servers more quickly, but a too-low value can timeout too quickly for a live server with some network congestion. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <server-default> <load-balance-connect-timeout>2s</load-balance-connect-timeout> </server-default> <server id="a" address="192.168.0.10" port="6800"/> <server id="b" address="192.168.0.11" port="6800"/> <host id=""> ... </cluster> </resin> child of <server>
default keepalive-timeout - 1s<load-balance-idle-time> is the maximum time the load balancer and distributed sessions will leave an idle socket before closing it. The default value is normally sufficient, since it tracks the keepalive of the cluster port. load-balance-idle-time must be less than the cluster-port. value of the targetThe load balancer and distributed sessions reuse sockets to the cluster peer and app-tier servers to improve TCP performance. The load-balance-idle-time limits the amount of time those sockets can remain idle. Higher values may improve the socket pooling, but may also increase the chance of connecting to a closed server. child of <server>
default keepalive-timeout - 1s<load-balance-idle-time> is the maximum time the load balancer and distributed sessions will leave an idle socket before closing it. The default value is normally sufficient, since it tracks the keepalive of the cluster port. load-balance-idle-time must be less than the cluster-port. value of the targetThe load balancer and distributed sessions reuse sockets to the cluster peer and app-tier servers to improve TCP performance. The load-balance-idle-time limits the amount of time those sockets can remain idle. Higher values may improve the socket pooling, but may also increase the chance of connecting to a closed server. child of <server>
default 60sThe time the load balancer uses to throttle connections to an app-tier server that's just starting up. Java web-applications often start slowly while they initialize caches. So a newly-started application will often be slower and consume more resources than a long-running application. The warmup-time increases Resin's reliability by limiting the number of requests to a new app-tier server until the server has warmed up. Larger values give the application a longer time to warm up. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <server-default> <load-balance-warmup-time>60s</load-balance-warmup-time> </server-default> <server id="a" address="192.168.0.10" port="6800"/> <server id="b" address="192.168.0.11" port="6800"/> <host id=""> ... </cluster> </resin> child of <server>
default 15s<load-balance-recover-time> is the maximum time the load balancer will consider the server dead after a failure before retrying the connection. Resin uses the load-balance-recover-time to avoid wasting time trying to connect to an unavailable app-tier server. Lower values let the load balancer use a restarted app-tier server faster, but lower values also increase the overhead of trying to contact unavailable servers. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <server-default> <load-balance-recover-time>10s</load-balance-recover-time> </server-default> <server id="a" address="192.168.0.10" port="6800"/> <server id="b" address="192.168.0.11" port="6800"/> <host id=""> ... </cluster> </resin> child of <server>
default 6800The server <port> defines the TCP port for Resin cluster communication and load balancing. Most server instances will use a common port like 6800, while machines with multiple servers may use multiple ports like 6800 and 6801. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <server id="app-a" address="192.168.1.11" port="6800"/> <server id="app-b" address="192.168.1.11" port="6801"/> <server id="app-b" address="192.168.2.12" port="6800"/> <server id="app-c" address="192.168.2.12" port="6801"/> ... </cluster> </resin> child of <server>
Defines default port parameters for all <http>, <protocol>, and <cluster-port>. child of <cluster>
<server> configures a JVM instance in the cluster. Each <server> is uniquely identified by its attribute. The will match the -server command line argument.The server listens to an internal network address, e.g. 192.168.0.10:6800 for clustering, load balancing, and administration. The current server is managed with a ServerMXBean. The ObjectName is . Peer servers are managed with ServerConnectorMXBean. The ObjectName is .
<resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server id="a" address="192.168.0.10" port="6800"> <http port="8080"/> </server> <server id="b" address="192.168.0.11" server-port="6800"> <http port="8080"/> </server> <server id="c" address="192.168.0.12" server-port="6800"> <http port="8080"/> </server> <host id=""> ... </cluster> </resin> Main configuration for the server, configuring ports, threads and virtual hosts.
The <server> will generally contain a <class-loader> configuration which loads the resin/lib jars dynamically, allowing for system-wide jars to be dropped into resin/lib. <server> configures the main dynamic environment. Database pools common to all virtual hosts, for example, should be configured in the <server> block. The <server> configures the <thread-pool> and a set of <http> and <server> ports which share the thread pool. Requests received on those ports will use worker threads from the thread pool.
<server> ... <alternate-session-url-prefix>/~J=</alternate-session-url-prefix> ... EL variables and functions
child of <cluster>
<server-default> defines default values for all <server> instances. Since most <server> configuration is identical for all server instances, the shared configuration belongs in a <server-default>. For example, <http> ports, timeouts, JVM arguments, and keepalives are typically identical for all server instances and therefore belong in a server-default. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server-default> <thread-max>512</thread-max> <jvm-arg>-Xmx512m -Xss1m</jvm-arg> <http port="8080"/> </server-default> <server id="a" address="192.168.0.10" port="6800"/> <server id="b" address="192.168.0.11" port="6800"/> <server id="c" address="192.168.0.12" port="6800"/> <host id=""> ... </cluster> </resin> <session-config> configures Resin's session handling, including the cookies Resin sends, the maximum sessions, and session persistence and clustering. See also: Resin clustering for more information about distributed sessions and persistence.
element session-config { always-load-session? & always-save-session? & cookie-append-server-index? & cookie-domain? & cookie-domain-regexp? & cookie-length? & cookie-max-age? & cookie-port? & cookie-secure? & cookie-version? & enable-cookies? & enable-url-rewriting? & ignore-serialization-errors? & invalidate-after-listener? & reuse-session-id? & save-mode? & save-on-shutdown? & serialization-type? & session-max? & session-timeout? & use-persistent-store? } The <web-app id='/dir'> <session-config> <!-- 2 hour timeout --> <session-timeout>120</session-timeout> <session-max>4096</session-max> </session-config> </web-app> is used to limit the maximum length for the session's generated cookie for special situations like WAP devices. Reducing this value reduces the randomness in the cookie and increases the chance of session collisions. defaults to true so that Resin can share the session id amongst different web-apps. The class that corresponds to <session-config> is com.caucho.server.session.SessionManager child of <cluster>
default ;jsessionid=Configures the URL prefix used for session rewriting. Note Session rewriting is discouraged as a potential security issue.element session-cookie { string } <socket-timeout> is the maximum time a socket load balancer and distributed sessions will wait for a read or write to a cluster socket. Crashed servers may never respond to a read request or accept a write. The socket-timeout lets Resin recover from these kinds of crashes. Lower values can detect crashes more quickly, but too-low values may report bogus failures when the server machine is just a little slow. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <server-default> <socket-timeout>60s</socket-timeout> </server-default> <server id="a" address="192.168.0.10" port="6800"/> <server id="b" address="192.168.0.11" port="6800"/> <host id=""> ... </cluster> </resin> web-app configures a web application. When specified by <url-regexp>, the application will be initialized at the first request. This means that servlets may start later than expected for applications. , the application will be initialized on server start. When specified by
The following example creates a web-app for /apache using the Apache htdocs directory to serve pages. <host id=''> <web-app id='/apache' root-directory='/usr/local/apache/htdocs'> ... </host> The following example sets the root web-app to the IIS root directory. <web-app id='/' root-directory='C:/inetpub/wwwroot'> When the is specified with a , can use replacement variables ( ).In the following, each user gets his or her own independent application using .<host id=''> <web-app url-regexp='/~([^/]*)' root-directory='/home/$1/public_html'> ... </web-app> </host> child of <cluster>
<web-app-default> defines default values for any web-app in the cluster. <resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <web-app-default> <servlet servlet-name="resin-php" servlet-class="com.caucho.quercus.servlet.QuercusServlet"/> <servlet-mapping url-pattern="*.php" servlet-name="resin-php"/> </web-app-default> <host id=""> ... </cluster> </resin>
|