📄 server-tags.xtp
字号:
<document><header> <title>server: Server tag configuration</title> <version>Resin 3.1</version> <description> <p>The <server> tag configures a JVM instance in a cluster. Itconfigures HTTP and cluster sockets, keepalives and timeouts, thread pooling,load balancing, and JVM arguments.</p> </description></header><body><localtoc/><s1 title="See Also"><ul><li>See the <a href="index-tags.xtp">index</a> for a list of all the tags.</li><li>See <<a href="cluster-tags.xtp">cluster</a>> tag configuration</li></ul></s1><defun title="<accept-listen-backlog>" version="Resin 3.1"><parents>http, connection-port, protocol</parents><p><accept-listen-backlog> configures operating system TCP listenqueue size for the port.</p><p>When a browser connects to a server, the server's operatingsystem handles the TCP initialization before handing the socket tothe server's application. The operating system will hold the openedconnections in a small queue, until the application is ready toreceive them. When the queue fills up, the operating system willstart refusing new connections.</p><default>100</default></defun><defun title="<accept-thread-max>" version="Resin 3.1"><parents>http, connection-port, protocol</parents><p><accept-thread-max> configures the maximum number of threads listening for new connections on this port. <accept-thread-max>works with <accept-thread-min> to handle spiky loads withoutcreating and destroying too many threads.</p><p>Socket connections are associated with a thread which handlesthe request. In Resin, a number of threads wait to accept a newconnection and then handle the request. <accept-thread-max>specifies the maximum number of threads which are waiting fora new connection.</p><p>Larger values handle spiky loads better but require more threadsto wait for the connections. Smaller values use less threads, but maybe slower handling spikes.</p><default>10</default></defun><defun title="<accept-thread-min>" version="Resin 3.1"><parents>http, connection-port, protocol</parents><p><accept-thread-min> configures the minimum number of threads listening for new connections on this port <accept-thread-min>works with <accept-thread-max> to handle spiky loads withoutcreating and destroying too many threads.</p><p>Socket connections are associated with a thread which handlesthe request. In Resin, a number of threads wait to accept a newconnection and then handle the request. <accept-thread-min>specifies the minimum number of threads which are waiting fora new connection. If many connections appear rapidly with a smallvalue of <accept-thread-min>, the applicationmay pause until a new thread is available for the new connection.</p><p>Larger values handle spiky loads better but require more threadsto wait for the connections. Smaller values use less threads, but maybe slower handling spikes.</p></defun><defun title="<address>" version="Resin 3.1"><parents>server</parents><p>The server <address> defines the IP interface for Resincluster communication and load balancing. It will be aninternal IP address like 192.168.* for a clustered configurationor 127.* for a single-server configuration. No wild cards are allowedbecause the other cluster servers and load balancer use the addressto connect to the server.</p><default>127.0.0.1</default><example title="server address"><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></example></defun><defun title="<cluster-port>" version="Resin 3.0"><parents>server</parents><p><cluster-port> configures the cluster and load balancing socket,for load balancing, distributed sessions, and distributed management.</p><p>When configuring Resin in a load-balanced cluster, each Resin instancewill have its own <srun> configuration, which Resin uses for distributedsession management and for the load balancing itself.</p><p>When configuring multiple JVMs, each <srun> has aunique <id> which allows the -server command-line to selectwhich ports the server should listen to.</p><deftable-childtags><tr><td>address</td> <td>hostname of the interface to listen to</td> <td>*</td></tr><tr><td>jsse-ssl</td> <td>configures the port to use JSSE for SSL</td> <td>none</td></tr><tr><td>openssl</td> <td>configures the port to use OpenSSL</td> <td>none</td></tr><tr><td>port</td> <td>port to listen to</td> <td>required</td></tr><tr><td>read-timeout</td> <td>timeout waiting to read from idle client</td> <td>65s</td></tr><tr><td>write-timeout</td> <td>timeout waiting to write to idle client</td> <td>65s</td></tr><tr><td>accept-listen-backlog</td> <td>The socket factory's listen backlog for receiving sockets</td> <td>100</td></tr><tr><td>tcp-no-delay</td> <td>sets the NO_DELAY socket parameter</td> <td>true</td></tr></deftable-childtags><p>The class that corresponds to <srun> is <a href="javadoc|com.caucho.server.cluster.ClusterPort|"/></p></defun><defun title="<group-name>" version="Resin 3.1"><parents>server</parents><p><group-name> configures the operating system group Resin shouldrun as. Since the HTTP port 80 is protected in Unix, the web serverneeds to start as root to bind to port 80. For security, Resin shouldswitch to a non-root user after binding to port 80.</p><example title="resin.xml with user-name"><resin xmlns="http://caucho.com/ns/resin"> <cluster id="app-tier"> <server-default> <http port="80"/> <user-name>resin</user-name> <group-name>www</group-name> </server-default> <server id="web-a"/> ... </cluster></resin></example></defun><defun title="<http>" version="Resin 3.0"><parents>server</parents><p><http> configures a HTTP or HTTPS port listening for HTTP requests.</p><p>When configuring multiple JVMs, each <http> will have aunique <server-id> which allows the -server command-line to selectwhich ports the server should listen to.</p><deftable-childtags><tr><td>address</td> <td>IP address of the interface to listen to</td> <td>*</td></tr><tr><td>port</td> <td>port to listen to</td> <td>required</td></tr><tr><td>tcp-no-delay</td> <td>sets the NO_DELAY socket parameter</td> <td>true</td></tr><tr><td>read-timeout</td> <td>timeout waiting to read from idle client</td> <td>65s</td></tr><tr><td>write-timeout</td> <td>timeout waiting to write to idle client</td> <td>65s</td></tr><tr><td>socket-listen-backlog</td> <td>The socket factory's listen backlog for receiving sockets</td> <td>100</td></tr><tr><td>virtual-host</td> <td>forces all requests to this <http> to use the named virtual host</td> <td>none</td></tr><tr><td>openssl</td> <td>configures the port to use OpenSSL</td> <td>none</td></tr><tr><td>jsse-ssl</td> <td>configures the port to use JSSE for SSL</td> <td>none</td></tr></deftable-childtags><p>The <var>virtual-host</var> attribute overrides the browser'sHost directive, specifying the explicit host and port for<code>request.getServerName()</code> and <code>getServerPort()</code>.It is not used in most virtual host configurations.Only IP-based virtual hosts which wish to ignore the browser's Hostwill use @virtual-host.</p></defun><defun title="<jvm-arg>" version="Resin 3.1"><parents>server</parents><p><jvm-arg> configures JVM arguments to be passed to Resin onthe command line, typically -X memory parameters and -D defines.</p><example title="standard jvm-args"><resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server-default> <jvm-arg>-Xmx512m</jvm-arg> <jvm-arg>-Xss1m</jvm-arg> <jvm-arg>-verbosegc</jvm-arg> </server-default> <server id="app-a" address="192.168.2.10"/> ... </cluster></resin></example></defun><defun title="<jvm-classpath>" version="Resin 3.1.6"><parents>server</parents><p><jvm-classpath> adds a classpath entry when starting the JVM.</p><example title="adding a classpath"><resin xmlns="http://caucho.com/ns/resin"> <cluster id="web-tier"> <server-default> <jvm-classpath>/tmp/test-classpath;/jvm-classpath> </server-default> <server id="app-a" address="192.168.2.10"/> ... </cluster></resin></example></defun><defun title="<keepalive-max>" version="Resin 3.1"><parents>server</parents><p><keepalive-max> configures the maximum number of socketswhich can be used directly for <g>keepalive</g> connections.In Resin Professional, the <g>select manager</g> allows fora much larger number of keepalive sockets, since it can detachthreads from connections. Without the select manager, eachconnection is associated with a thread.</p><p>A value of -1 disables keepalives.</p><p>Keepalives are an important TCP technique used with HTTP andResin's load-balancing to avoid the heavy network cost of creatinga new socket. Since an initial HTTP request is usually immediatelyfollowed by extra requests to load files like images and stylesheets,it's generally more efficient to keep the socket open for a short timeinstead of creating a new one. The socket keepalive is even moreimportant for Resin's load balancing, to avoid creating extra socketsbetween the web-tier and the app-tier and to make distributed sessionsmore efficient.</p><p>Higher values of <keepalive-max> improve network efficiencybut increase the number of threads waiting for new client data.</p><default>100</default><example title="keepalive-thread-max in resin.xml"><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></example></defun><defun title="<keepalive-select-enable>" version="Resin 3.1"><parents>server</parents><p><keepalive-select-enable> enables the select manager forkeepalives. The select manager is a Resin Professional feature allowingmore keepalives by detaching threads from sockets.</p><p>Normally, this should be left enabled.</p><default>true</default></defun><defun title="<keepalive-select-thread-timeout>" version="Resin 3.1">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -