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. The easiest and fastest Resin configuration uses the Resin as the primary or only web server. This configuration provides a Java HTTP server. We recommend you start with this before trying any other configuration. The server listens at port 8080 in the default configuration and can be changed to the HTTP port 80 during deployment. Getting StartedThe following steps will start Resin for development:
unix> java -jar lib/resin.jar console May 6, 2011 3:06:05 PM com.caucho.boot.WatchdogChildTask run INFO: WatchdogChild[] starting May 6, 2011 3:06:05 PM com.caucho.boot.WatchdogChildProcess run WARNING: Watchdog starting Resin[] Resin Professional 4.0.17 (built Fri, 15 Apr 2011 06:35:56 PDT) Copyright(c) 1998-2010 Caucho Technology. All rights reserved. current.license -- 1 Resin server Caucho Starting Resin Professional on Fri, 06 May 2011 15:06:06 -0400 (EDT) [11-05-06 15:06:07.824] {main} Proxy Cache disk-size=1024M memory-size=64M [11-05-06 15:06:08.179] {main} [11-05-06 15:06:08.179] {main} Mac OS X 10.6.7 x86_64 [11-05-06 15:06:08.179] {main} Java(TM) SE Runtime Environment 1.6.0_24-b07-334-10M3326, MacRoman, en [11-05-06 15:06:08.179] {main} Java HotSpot(TM) 64-Bit Server VM 19.1-b02-334, 64, mixed mode, Apple Inc. [11-05-06 15:06:08.179] {main} [11-05-06 15:06:08.179] {main} user.name = caucho [11-05-06 15:06:08.472] {main} [11-05-06 15:06:08.479] {main} server listening to localhost:6800 [11-05-06 15:06:08.555] {main} [11-05-06 15:06:08.873] {main} [11-05-06 15:06:08.874] {main} resin.home = /Users/caucho/resin-pro-4.0.17/ [11-05-06 15:06:08.878] {main} resin.root = /Users/caucho/resin-pro-4.0.17/ [11-05-06 15:06:08.879] {main} resin.conf = /Users/caucho/resin-pro-4.0.17/conf/resin.xml [11-05-06 15:06:08.889] {main} [11-05-06 15:06:08.889] {main} server = 127.0.0.1:6800 (app-tier:default) [11-05-06 15:06:08.899] {main} stage = production [11-05-06 15:06:09.526] {main} WebApp[production/webapp/default/resin-admin] active [11-05-06 15:06:10.245] {main} WebApp[production/webapp/default/resin-doc] active [11-05-06 15:06:10.445] {main} WebApp[production/webapp/default/ROOT] active [11-05-06 15:06:10.446] {main} Host[production/host/default] active [11-05-06 15:06:10.447] {main} ProServer[id=default,cluster=app-tier] active [11-05-06 15:06:10.448] {main} JNI: file, nio keepalive (max=9984), socket [11-05-06 15:06:10.448] {main} [11-05-06 15:06:10.449] {main} [11-05-06 15:06:10.450] {main} http listening to *:8080 [11-05-06 15:06:11.023] {main} https listening to *:8443 [11-05-06 15:06:11.092] {main} [11-05-06 15:06:11.160] {main} ProResin[id=default] started in 4222ms Deployment DirectoriesWhen deploying, it's a good idea to create a bit of structure to make Resin and website upgrades easier and more maintainable.
Startup ScriptIf you installed using the .deb package or ran " /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:
The start script might look like: #!/bin/sh JAVA_HOME=/usr/java RESIN_HOME=/usr/local/resin RESIN_ROOT=/var/www java=$JAVA_HOME/bin/java export JAVA_HOME export RESIN_HOME export RESIN_ROOT $java -jar $RESIN_HOME/lib/resin.jar \ -root-directory $RESIN_ROOT \ -conf /etc/resin/resin.xml \ -server a \ $* This script would be called as The Getting Started
C:\resin-pro-4.0.17>resin.exe May 6, 2011 4:41:28 PM com.caucho.boot.WatchdogChildTask run INFO: WatchdogChild[] starting May 6, 2011 4:41:28 PM com.caucho.boot.WatchdogChildProcess run WARNING: Watchdog starting Resin[] Resin Professional 4.0.17 (built Fri, 15 Apr 2011 06:35:56 PDT) Copyright(c) 1998-2010 Caucho Technology. All rights reserved. current.license -- 1 Resin server Caucho Starting Resin Professional on Fri, 06 May 2011 16:41:29 -0400 (EDT) [11-05-06 16:41:29.895] {main} Proxy Cache disk-size=1024M memory-size=64M [11-05-06 16:41:30.083] {main} [11-05-06 16:41:30.083] {main} Windows Vista 6.0 amd64 [11-05-06 16:41:30.083] {main} Java(TM) SE Runtime Environment 1.6.0_23-b05, Cp1252, en [11-05-06 16:41:30.084] {main} Java HotSpot(TM) 64-Bit Server VM 19.0-b09, 64, mixed mode, Sun Microsystems Inc. [11-05-06 16:41:30.084] {main} [11-05-06 16:41:30.084] {main} user.name = caucho [11-05-06 16:41:30.327] {main} [11-05-06 16:41:30.329] {main} server listening to 127.0.0.1:6800 [11-05-06 16:41:30.337] {main} [11-05-06 16:41:30.604] {main} [11-05-06 16:41:30.604] {main} resin.home = C:\resin-pro-4.0.17 [11-05-06 16:41:30.605] {main} resin.root = C:\resin-pro-4.0.17 [11-05-06 16:41:30.605] {main} resin.conf = C:\resin-pro-4.0.17\conf\resin.xml [11-05-06 16:41:30.605] {main} [11-05-06 16:41:30.605] {main} server = 127.0.0.1:6800 (app-tier:default) [11-05-06 16:41:30.605] {main} stage = production [11-05-06 16:41:31.037] {main} WebApp[production/webapp/default/resin-admin] active [11-05-06 16:41:31.573] {main} WebApp[production/webapp/default/resin-doc] active [11-05-06 16:41:31.648] {main} WebApp[production/webapp/default/ROOT] active [11-05-06 16:41:31.648] {main} Host[production/host/default] active [11-05-06 16:41:31.649] {main} ProServer[id=default,cluster=app-tier] active [11-05-06 16:41:31.649] {main} JNI keepalive: not available on Windows [11-05-06 16:41:31.649] {main} JNI: file, socket [11-05-06 16:41:31.649] {main} [11-05-06 16:41:31.649] {main} [11-05-06 16:41:31.650] {main} http listening to *:8080 [11-05-06 16:41:32.022] {main} https listening to *:8443 [11-05-06 16:41:32.038] {main} [11-05-06 16:41:32.057] {main} ProResin[id=default] started in 2774ms Deploying as a Windows ServiceTo install the service run You will either need to reboot the machine or start the service from the Control Panel/Services panel to start the server. On a machine reboot, Windows will automatically start the web server. You can also start and stop the service from the command-line: C:\> net start resin ... C:\> net stop resin Processes OverviewResin runs as multiple processes that begin with the following JVM command: unix> java -jar /usr/local/resin/lib/resin.jar \ -conf /etc/resin/resin.xml \ start The watchdog process. An additional command-line option, is used in load-balanced deployments. argument tells java to run the Main-Class defined in resin.jar's manifest. The argument specifies the path to your Resin configuration file. Lastly, Resin accepts , , and arguments which are passed to theJDK 1.6 includes a jps command which will show the pids of any java processes. unix> jps 2098 Jps 2064 ResinWatchdogManager 2097 Resin When running as a daemon (eg, The first process that starts is the actual startup program,
The Watchdog ProcessThe ResinWatchdogManager is the parent process, providing automatic restarting Resin in cases of failure, and providing a single point of control for the user-name> on unix. , and 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 <ResinWatchdogManager watches Resin via a Socket connection. When the watchdog socket closes, Resin shuts itself down gracefully. The watchdog closes the socket on a or 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 ProcessesIf 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:
Because the watchdog is always managing Resin processes, if you ever need to stop Resin with , you must kill the watchdog. Just killing the Resin process results in the watchdog restarting it automatically.LoggingThe watchdog will log to . The Resin standard out/err is . ResinWatchdogManager is responsible for creating both of these log files, so is not really under the control of the Resin instance. This makes it somewhat more reliable in case of JVM deadlocks, etc.
|