main website home
  • About this blog

    This blog features updates, opinions, and technical notes from Caucho engineers about Caucho products, the enterprise Java industry, and PHP. Caucho Technology is the creator of the Resin Application Server and the Quercus PHP in Java engine. A leader in Java performance since 1998, Caucho is a Sun JavaEE licensee with over 9000 customers worldwide.
  • Tags

    ajaxworld bam candi cdi cloud cluster comet configuration deploy devoxx eclipse ejb embedded flash flex google app engine hessian hmtp ioc java ee 6 javaone javazone jms messaging newsletter nyjug osgi php pomegranate quercus resin resin 4.0 REST servlet sfjug silicon valley code camp spring testing training tssjs watchdog webbeans web profile websockets wordpress
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.org
« Quercus Demos at Google I/O
Quercus/GAE at Google I/O x2, with a cool new demo! »

Resin Watchdog

Today I had a Resin user ask about the Resin watchdog and how it works. We’ve got some documentation, but I thought I’d show an example here in case you’ve never had a chance to try it out or were confused. I’ll show the actual command line input and output that you’ll see. After that, I’ll also talk about a feature we’re considering adding watchdog which we’d like feedback on.


The watchdog is a simple Java process that we introduced in the 3.1 branch to get away from the annoyances of the shell scripts of 3.0 or earlier. Writing it in Java makes the start process of Resin more portable as well. The other purpose of the watchdog is to restart Resin if the process dies. If you’re using Resin 3.1 or 4.0, you’re already using the watchdog, whether you realize it or not!

In the case of a single Resin server with id “a”, this is how we start the server with the watchdog and what processes are running after startup:

% java -jar lib/resin.jar -server a start
Resin/4.0.0 launching watchdog at 127.0.0.1:6600
Resin/4.0.0 started -server 'a' for watchdog at 127.0.0.1:6600
% jps
2356 Jps
2178 Resin
2153 WatchdogManager

If I kill the Resin instance, the watchdog will restart it. If I kill the watchdog, both Resin and the watchdog will go down. The right way to stop the processes is to use “stop” instead of “start” above though. Notice that the first line in the output after starting the Resin server is a notification that the watchdog is starting. If there’s no watchdog, the command line starts one. If there is one, the command line asks it to start the new server.

For example if we have two servers on the same machine, they’ll use the same watchdog by default:

% java -jar lib/resin.jar -server a start
Resin/4.0.0 launching watchdog at 127.0.0.1:6600
Resin/4.0.0 started -server 'a' for watchdog at 127.0.0.1:6600
% java -jar lib/resin.jar -server b start
Resin/4.0.0 started -server 'b' for watchdog at 127.0.0.1:6600
% jps
8502 Jps
8439 Resin
8299 WatchdogManager
8324 Resin

In this case, killing the watchdog kills both Resins as well. If you “stop” both of the servers, the watchdog will go away in that case as well.

One other quick note about something that tripped up a user on resin-interest earlier this week: Only Resin checks for changes to the resin.conf or resin.xml. If you change something in the configuration that affects the watchdog, you need to restart it manually yourself. This is especially important if you change the users and/or passwords in the section or admin-users.xml. Any change in the user manifest will make it impossible for the watchdog and Resin to authenticate with each other, so new Resins won’t be able to start. Of course changing the watchdog port will also cause problems…

Letting the watchdog off the leash?

Currently, when the last Resin instance is “stopped” properly, the watchdog goes away. We’re considering adding the ability to let the watchdog stay around as a permanent daemon and do remote start and stop of Resin instances via JMX and /resin-admin (and/or Maven, etc.) In fact, you could start the watchdog first without starting any Resins until later. The tradeoff is that the Watchdog code becomes more complicated. At first, we wanted the watchdog to be as simple as possible, so adding this functionality would introduce more complexity.

What do you think? Is the added functionality worth it?

This entry was posted on Thursday, May 14th, 2009 at 3:27 pm and is filed under Engineering. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.


Caucho Technology is proudly powered by WordPress and Quercus®
Entries (RSS) and Comments (RSS).

  • HOME |
  • CONTACT US |
  • DOCUMENTATION |
  • BLOG |
  • WIKI 4 |
  • WIKI 3 |
  • Resin: Java Application Server
Copyright (c) 1998-2012 Caucho Technology, Inc. All rights reserved.
caucho® , resin® and quercus® are registered trademarks of Caucho Technology, Inc.
resin® is a cloud optimized, java® application server that supports the java ee webprofile ®