Caucho Technology
  • resin 4.0
  • server: server tag configuration


    The <server> tag configures a JVM instance in a cluster. It configures HTTP and cluster sockets, keepalives and timeouts, thread pooling, load balancing, and JVM arguments.

    descriptionschemaattributesexample

    <jvm-arg>

    child of server

    <jvm-arg> configures JVM arguments to be passed to Resin on the command line, typically -X memory parameters and -D defines.

    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>
    

    <jvm-classpath>

    child of server

    <jvm-classpath> adds a classpath entry when starting the JVM.

    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>
    

    <server>

    child of cluster

    <server> configures a JVM instance in the cluster. Each <server> is uniquely identified by its id attribute. The id 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 resin:type=Server.

    Peer servers are managed with ServerConnectorMXBean. The ObjectName is resin:type=ServerConnector,name=server-id.

    idunique server identifierrequired
    addressIP address of the cluster port127.0.0.1
    portThe cluster port6800
    server
    <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.

    • Common resources for all virtual hosts and web-apps.
    • Thread pooling
    • HTTP and Server/Cluster ports
    • Caching
    • virtual host configuration and common web-app-default

    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.

    alternate-session-url-prefixa prefix to add the session to the beginning of the URL as a path prefix instead of the standard ;jsessionid= suffix. For clients like mobile devices with limited memory, this will allow careful web designers to minimize the page size.null
    keepalive-maxthe maximum number of keepalive connections512
    keepalive-thread-timeoutthe maximum time a connection is maintained in the keepalive state120s
    alternate-session-url-prefix
    <server>
      ...
      <alternate-session-url-prefix>/~J=</alternate-session-url-prefix>
      ...
    

    EL variables and functions

    EL variables defined by <server>
    VARIABLECORRESPONDING API
    serverIdserver.getServerId()
    root-dirserver.getRootDirectory()
    server-rootserver.getRootDirectory()
    EL functions defined by <server>
    FUNCTIONCORRESPONDING API
    jndiJndi.lookup(String)

    <server-default>

    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.

    server
    <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>
    

    <shutdown-wait-max>

    child of server

    <shutdown-wait-max> configures the maximum time the server will wait for the graceful shutdown before forcing an exit.

    default 60s
    <shutdown-wait-max> schema
    element shutdown-wait-max {
      r_period-Type
    }
    

    Copyright © 1998-2011 Caucho Technology, Inc. All rights reserved.
    Resin ® is a registered trademark, and Quercustm, Ambertm, and Hessiantm are trademarks of Caucho Technology.