resin web server

This document describes how to install and run Resin
"standalone" (without Apache or IIS).

Resin provides a reliable, fast Web server which can also
be used as a load balancer. In our benchmarks, it serves static
pages faster than Apache. For most sites, Resin is ideal
because of its performance, security and reliability.

Create a startup script and configure the server to start it when the machine reboots.

Startup Script

If you installed using the .deb package or ran "sudo make install",
the installer created a file named /etc/init.d/resin
which contains a standard Unix init.d startup file. This file will start
Resin when invoked as:

/etc/init.d/resin start

Use the tools that came with your system to execute the script
on startup.

Or you can create your own startup script which will start and stop
the ResinWatchdog, and will pass any command-line arguments. The script
might typically do a number of things:

This script would be called as ./start.sh start to start
and ./start.sh stop to stop.

The -server argument is only
necessary if you have multiple servers (JVM instances) either
on different machines or the same machine.
The load balancing and
distributed sessions pages describe when
you might use -server.

Windows

Getting Started

Install JDK 1.6 or later.

Check that the environment variable JAVA_HOME is set to the JDK
location, e.g. c:\java\jdk1.6.0_14

Unzip resin-4.0.x.zip

Define the environment variable RESIN_HOME to the location of
Resin, for example c:\resin-4.0.x

Running Resin

Processes Overview

The -jar argument tells java to run the Main-Class defined
in resin.jar's manifest. The -conf argument specifies the
path to your Resin configuration file. Lastly, Resin accepts start,
stop, and restart arguments which are passed to the watchdog
process. An additional command-line option, -server is used
in load-balanced deployments.

JDK 1.6 includes a
jps
command which will show the pids of any java processes.

Example jps Process List

unix> jps
2098 Jps
2064 ResinWatchdogManager
2097 Resin

When running as a daemon (eg, resin.sh start)
ResinWatchdogManager is the watchdog and Resin
is the actual Resin instance. When running Resin as a foreground process,
the process list displays resin.jar, which acts as the watchdog.

The first process that starts is the actual startup program,
java -jar resin.jar. It passes command-line arguments to
the second process, the ResinWatchdogManager. This watchdog process takes care of
starting the actual Resin process(es). ResinWatchdogManager monitors the state
of Resin and restarts it if necessary, improving reliability.

The Watchdog Process

The ResinWatchdogManager is the parent process, providing automatic restarting
Resin in cases of failure, and providing a single point of control for
the start, stop and restart of all Resin
processes. It is responsible for launching
Resin with the correct JVM arguments and environment options such as starting
Resin as the specified user, e.g. for <user-name> on unix.

ResinWatchdogManager watches Resin via a Socket connection. When
the watchdog socket closes, Resin shuts itself down gracefully. The
watchdog closes the socket on a stop or restart
or if the watchdog itself is killed. If Resin exits for any reason,
the watchdog will automatically start a new Resin process. This socket connection
approach avoids the need for any signals or actual killing of Resin from the watchdog,
and also makes it easy to stop all the Resins if necessary by just killing
the watchdog.

The ResinWatchdogManager doesn't actually kill Resin or even check Resin's status,
it just checks to see if Resin is alive or not. So if the JVM were to completely
lock up, the watchdog would still think Resin was okay and would take no action.

Resin Processes

If Resin detects a major error (like running out of memory) or if the resin.xml changes,
it will exit and the watchdog would start a new Resin instance. Reasons a Resin instance
might exit include:

resin.xml changes

out of memory error

detected deadlocks

segv and other severe errors

Because the watchdog is always managing Resin processes, if you ever
need to stop Resin with kill, you must kill the watchdog. Just killing
the Resin process results in the watchdog restarting it automatically.

Logging

The watchdog will log to log/watchdog-manager.log.
The Resin standard out/err is log/jvm-servername.log.
ResinWatchdogManager is responsible for creating both of these log files,
so jvm-servername.log is not really under the control of the Resin instance.
This makes it somewhat more reliable in case of JVM deadlocks, etc.

Cloud-optimized Resin Server is a Java EE certified Java Application Server, and Web Server, and Distributed Cache Server (Memcached).Leading companies worldwide with demand for reliability and high performance web applications including SalesForce.com, CNET, DZone and many more are powered by Resin.