<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"	>
<channel>
	<title>Comments on: Why and how to use Jetty in mission-critical production</title>
	<atom:link href="http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/feed/" rel="self" type="application/rss+xml" />
	<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/</link>
	<description>Johannes Brodwall&#039;s Musings on Software Architecture and Programming</description>
	<lastBuildDate>Fri, 13 Apr 2012 19:13:00 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Embedded Jetty 7 webapp executable with Maven &#8211; BEKK Open</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128568</link>
		<dc:creator>Embedded Jetty 7 webapp executable with Maven &#8211; BEKK Open</dc:creator>
		<pubDate>Fri, 14 Jan 2011 13:55:13 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128568</guid>
		<description>[...] year Johannes Brodwall wrote an excellent blog post on the why and hows of using Jetty in production, I really recommend that post as a good background [...]</description>
		<content:encoded><![CDATA[<p>[...] year Johannes Brodwall wrote an excellent blog post on the why and hows of using Jetty in production, I really recommend that post as a good background [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johannes Brodwall</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128495</link>
		<dc:creator>Johannes Brodwall</dc:creator>
		<pubDate>Sat, 11 Dec 2010 00:03:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128495</guid>
		<description>I&#039;ve used NimBUS to monitor the Jetty process by periodically performing an HTTP request. When Jetty doesn&#039;t respond, NimBUS raises an error in the operations room.

In this case, operations can use the init.d script to restart the server.

Our plan was to implement automatically restart as we knew more about the patterns of failure that would require restart. Automatically restart is, of course, a pretty high-risk function. As Jetty was extremely stable in our environment, we never found the need to implement automatic restart.</description>
		<content:encoded><![CDATA[<p>I&#8217;ve used NimBUS to monitor the Jetty process by periodically performing an HTTP request. When Jetty doesn&#8217;t respond, NimBUS raises an error in the operations room.</p>
<p>In this case, operations can use the init.d script to restart the server.</p>
<p>Our plan was to implement automatically restart as we knew more about the patterns of failure that would require restart. Automatically restart is, of course, a pretty high-risk function. As Jetty was extremely stable in our environment, we never found the need to implement automatic restart.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tor Arne Kvaløy</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128494</link>
		<dc:creator>Tor Arne Kvaløy</dc:creator>
		<pubDate>Fri, 10 Dec 2010 16:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128494</guid>
		<description>Thanks for your answers. This is very interesting. 

When deploying jetty like this, do you have another process on the same server that monitors and make sure that it runs? And that is capable of starting the process if it&#039;s down, like Commons Daemons?  

I&#039;m not an operation expert, but I would like to understand what&#039;s common practice. ;)

As for configurations I have become an avid user of Constretto, where the configuration is embedded in the jar - living up the idea that &quot;the environment is part of the design&quot;..
</description>
		<content:encoded><![CDATA[<p>Thanks for your answers. This is very interesting. </p>
<p>When deploying jetty like this, do you have another process on the same server that monitors and make sure that it runs? And that is capable of starting the process if it&#8217;s down, like Commons Daemons?  </p>
<p>I&#8217;m not an operation expert, but I would like to understand what&#8217;s common practice. ;)</p>
<p>As for configurations I have become an avid user of Constretto, where the configuration is embedded in the jar &#8211; living up the idea that &#8220;the environment is part of the design&#8221;..</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johannes Brodwall</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128493</link>
		<dc:creator>Johannes Brodwall</dc:creator>
		<pubDate>Thu, 09 Dec 2010 21:59:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128493</guid>
		<description>Thanks for you comment and questions, Tor Arne.

The short answer is: Yes, I&#039;ve used Jetty in production, and I recommend others to do it if possible. You&#039;re exactly right about the deployment being an OS process and not within an application server.

Contrary to popular belief (or at least vendor claims), operations people that I talk to love this. I don&#039;t know any operations people who feel an app server is within their comfort zone.

I&#039;ve used a system with shell scripts that will start a Java main-class (or &quot;java -jar&quot;) and capture the PID to a file if run with the argument &quot;start&quot;. If started with the argument &quot;stop&quot;, the script will issue &quot;kill `cat pidfile`&quot;.

I&#039;ve also used a separate Servlet Context to control the server. Connecting to http://localhost:/shutdown from localhost with a secret HTTP parameter will cause Jetty to stop. The main-class of my server will try to do this before starting its own listener. I haven&#039;t used this scheme in production yet.

My plan is that &quot;cd /opt/application/production; java -jar application.war restart&quot; will restart the server. This will make for good init.d-support.

On my previous production deployment with Jetty, we used Apache HTTPD as a reverse proxy in front of the server (mod_proxy). I was pretty happy with this approach. If given free reign, I probably would prefer to use Nginx in the same way.

I read a property file (named application.property) from the CWD and add it to System.getProperties() at startup. This file contains necessary configuration like http port (and database connection properties).

Hope this helps. Keep up the good questions!</description>
		<content:encoded><![CDATA[<p>Thanks for you comment and questions, Tor Arne.</p>
<p>The short answer is: Yes, I&#8217;ve used Jetty in production, and I recommend others to do it if possible. You&#8217;re exactly right about the deployment being an OS process and not within an application server.</p>
<p>Contrary to popular belief (or at least vendor claims), operations people that I talk to love this. I don&#8217;t know any operations people who feel an app server is within their comfort zone.</p>
<p>I&#8217;ve used a system with shell scripts that will start a Java main-class (or &#8220;java -jar&#8221;) and capture the PID to a file if run with the argument &#8220;start&#8221;. If started with the argument &#8220;stop&#8221;, the script will issue &#8220;kill `cat pidfile`&#8221;.</p>
<p>I&#8217;ve also used a separate Servlet Context to control the server. Connecting to <a href="http://localhost:/shutdown" rel="nofollow">http://localhost:/shutdown</a> from localhost with a secret HTTP parameter will cause Jetty to stop. The main-class of my server will try to do this before starting its own listener. I haven&#8217;t used this scheme in production yet.</p>
<p>My plan is that &#8220;cd /opt/application/production; java -jar application.war restart&#8221; will restart the server. This will make for good init.d-support.</p>
<p>On my previous production deployment with Jetty, we used Apache HTTPD as a reverse proxy in front of the server (mod_proxy). I was pretty happy with this approach. If given free reign, I probably would prefer to use Nginx in the same way.</p>
<p>I read a property file (named application.property) from the CWD and add it to System.getProperties() at startup. This file contains necessary configuration like http port (and database connection properties).</p>
<p>Hope this helps. Keep up the good questions!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tor Arne Kvaløy</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128492</link>
		<dc:creator>Tor Arne Kvaløy</dc:creator>
		<pubDate>Thu, 09 Dec 2010 21:45:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128492</guid>
		<description>Hey Johannes, and first of all, thanks for this post; I found this approach really nice and elegant! It&#039;s an important improvement over my current solution which uses the maven assembly plugin.

However, there are a few hurdles and missing pieces, that I really want to find out about.


I am curious, do you deploy the application like this in production? I would think that it would be smart to have some monitoring process that checks if the process is running and restarts if it&#039;s not. Do you use Common Deamons for that? In that case, there are some &quot;integration issues&quot;, because they would have to share the pid-file. Let&#039;s say the Common Daemons is monitoring the process and we do a new deploy like described in your post, then the app will get a new process id and Daemons will try to start a new one... trouble.

It would have been nice to have had a framework that would support /etc/init.d/start-stop-script, process monitoring and fast &quot;hot&quot;-deployment as you described in this post. ;)

I guess something like the Rails guys have; Capistrano.

This would be different from normal java containers like Tomcat, because the control will be on the OS-process-level and not within Java.

I wish this existed.

Another issue I find with this approach, versus deploying wars to a Tomcat, is that each jetty instance would need to have their own http and JMX port configured uniquely, and hence would raise the need for a httpd front server and some more configuration. What are your thoughts on this?</description>
		<content:encoded><![CDATA[<p>Hey Johannes, and first of all, thanks for this post; I found this approach really nice and elegant! It&#8217;s an important improvement over my current solution which uses the maven assembly plugin.</p>
<p>However, there are a few hurdles and missing pieces, that I really want to find out about.</p>
<p>I am curious, do you deploy the application like this in production? I would think that it would be smart to have some monitoring process that checks if the process is running and restarts if it&#8217;s not. Do you use Common Deamons for that? In that case, there are some &#8220;integration issues&#8221;, because they would have to share the pid-file. Let&#8217;s say the Common Daemons is monitoring the process and we do a new deploy like described in your post, then the app will get a new process id and Daemons will try to start a new one&#8230; trouble.</p>
<p>It would have been nice to have had a framework that would support /etc/init.d/start-stop-script, process monitoring and fast &#8220;hot&#8221;-deployment as you described in this post. ;)</p>
<p>I guess something like the Rails guys have; Capistrano.</p>
<p>This would be different from normal java containers like Tomcat, because the control will be on the OS-process-level and not within Java.</p>
<p>I wish this existed.</p>
<p>Another issue I find with this approach, versus deploying wars to a Tomcat, is that each jetty instance would need to have their own http and JMX port configured uniquely, and hence would raise the need for a httpd front server and some more configuration. What are your thoughts on this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johannes Brodwall</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128426</link>
		<dc:creator>Johannes Brodwall</dc:creator>
		<pubDate>Thu, 21 Oct 2010 07:15:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128426</guid>
		<description>Hi, Hugo

Your questions are very insightful, and I&#039;m happy to see that you&#039;re exploring the code. :-)


  WarExtractor &quot;reaches around&quot; and tries to find what one-jar jar file was used to start it. It then unpacks the WAR-file from this Jar file and puts it in a temporary location on the file system in order to execute it. It&#039;s a ... hack. :-)
  ShutdownControl and StatusHandler are both used to control an already running server. If I start the server in the background and then leave the console, I can use ShutdownController to shut it down from another console. Similarly, I can use StatusHandler/checkStatus from another console to decide whether I need to start a new server instance or not
  ShutdownControl is also useful when I run WebServer under the debugger in Eclipse or IDEA. I can then just start the debugger again, and it will kill any already running session.
  I use the WebServer in embedded-container-web for development testing (start it in an Eclipse/IDEA debugger session). ServerControl is the one that&#039;s started when you execute &quot;java -jar ...&quot; after deploying to a test or production environment.
 The block with &quot;server.checkStatus&quot; is to avoid running a second jetty on the same computer (on the same port). If you run &quot;java -Dserver.checkStatus -jar ....&quot; this is the behavior you get.

Thanks for the questions. Please do ask more. :-)
</description>
		<content:encoded><![CDATA[<p>Hi, Hugo</p>
<p>Your questions are very insightful, and I&#8217;m happy to see that you&#8217;re exploring the code. :-)</p>
<p>  WarExtractor &#8220;reaches around&#8221; and tries to find what one-jar jar file was used to start it. It then unpacks the WAR-file from this Jar file and puts it in a temporary location on the file system in order to execute it. It&#8217;s a &#8230; hack. :-)<br />
  ShutdownControl and StatusHandler are both used to control an already running server. If I start the server in the background and then leave the console, I can use ShutdownController to shut it down from another console. Similarly, I can use StatusHandler/checkStatus from another console to decide whether I need to start a new server instance or not<br />
  ShutdownControl is also useful when I run WebServer under the debugger in Eclipse or IDEA. I can then just start the debugger again, and it will kill any already running session.<br />
  I use the WebServer in embedded-container-web for development testing (start it in an Eclipse/IDEA debugger session). ServerControl is the one that&#8217;s started when you execute &#8220;java -jar &#8230;&#8221; after deploying to a test or production environment.<br />
 The block with &#8220;server.checkStatus&#8221; is to avoid running a second jetty on the same computer (on the same port). If you run &#8220;java -Dserver.checkStatus -jar &#8230;.&#8221; this is the behavior you get.</p>
<p>Thanks for the questions. Please do ask more. :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Johannes Brodwall</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128425</link>
		<dc:creator>Johannes Brodwall</dc:creator>
		<pubDate>Thu, 21 Oct 2010 07:12:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128425</guid>
		<description>Type your reply...</description>
		<content:encoded><![CDATA[<p>Type your reply&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hugo</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-128424</link>
		<dc:creator>Hugo</dc:creator>
		<pubDate>Wed, 20 Oct 2010 22:04:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-128424</guid>
		<description>Hi Johannes,

So I&#039;m starting with Java (only having programmed for the web in Django), and I wanted to avoid the complexity of application servers and all that J2EE stuff for now.
So your post was a great find, the demo worked perfectly, but there are several things I don&#039;t get there, such as:

- What does the WarExtractor do? Is it being used when I run java -jar embedded-..container-one.jar ?

- I kinda understood (and tested) ShutdownControl, but I don&#039;t understand why do you would want it. What&#039;s the difference between this and a Ctrl-c in the screen session, or killing the process? BTW, when I shutdown (via cookie method) it said it could not stop a thread - did that happen to you? No idea which thread is this.

- In the function StatusHandler.java/checkStatus, you use your own HTTP service to check the status. Why would you do this instead of just calling the method?

- Are the files under embedded-container-web only for testing? Would you be running the main() inside WebServer.java or the one inside ServerControl.java for development?

- What is the purpose of the block which starts with  &quot;if (getBooleanProperty(&quot;server.checkStatus&quot;, false))&quot; on ServerControl.java? To avoid running a second jetty in the same computer?

I know it might seem silly, but I don&#039;t want to start my project using code that I don&#039;t understand, of course...

Thanks in advance,
Hugo</description>
		<content:encoded><![CDATA[<p>Hi Johannes,</p>
<p>So I&#8217;m starting with Java (only having programmed for the web in Django), and I wanted to avoid the complexity of application servers and all that J2EE stuff for now.<br />
So your post was a great find, the demo worked perfectly, but there are several things I don&#8217;t get there, such as:</p>
<p>- What does the WarExtractor do? Is it being used when I run java -jar embedded-..container-one.jar ?</p>
<p>- I kinda understood (and tested) ShutdownControl, but I don&#8217;t understand why do you would want it. What&#8217;s the difference between this and a Ctrl-c in the screen session, or killing the process? BTW, when I shutdown (via cookie method) it said it could not stop a thread &#8211; did that happen to you? No idea which thread is this.</p>
<p>- In the function StatusHandler.java/checkStatus, you use your own HTTP service to check the status. Why would you do this instead of just calling the method?</p>
<p>- Are the files under embedded-container-web only for testing? Would you be running the main() inside WebServer.java or the one inside ServerControl.java for development?</p>
<p>- What is the purpose of the block which starts with  &#8220;if (getBooleanProperty(&#8220;server.checkStatus&#8221;, false))&#8221; on ServerControl.java? To avoid running a second jetty in the same computer?</p>
<p>I know it might seem silly, but I don&#8217;t want to start my project using code that I don&#8217;t understand, of course&#8230;</p>
<p>Thanks in advance,<br />
Hugo</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-127914</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Fri, 20 Aug 2010 14:13:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-127914</guid>
		<description>100MB is too much just for Jetty. Also as I know JVM can share memory between several processes. See it here http://docs.sun.com/app/docs/doc/819-3659/6n5s6m57s?l=en&amp;a=view
&quot;If multiple applications or modules refer to the same libraries, classes in those libraries are automatically shared. This can reduce the memory footprint and allow sharing of static information.&quot;

Anyway, I would better create a simple test case that shows how much memory overhead this solution has.</description>
		<content:encoded><![CDATA[<p>100MB is too much just for Jetty. Also as I know JVM can share memory between several processes. See it here <a href="http://docs.sun.com/app/docs/doc/819-3659/6n5s6m57s?l=en&#038;a=view" rel="nofollow">http://docs.sun.com/app/docs/doc/819-3659/6n5s6m57s?l=en&#038;a=view</a><br />
&#8220;If multiple applications or modules refer to the same libraries, classes in those libraries are automatically shared. This can reduce the memory footprint and allow sharing of static information.&#8221;</p>
<p>Anyway, I would better create a simple test case that shows how much memory overhead this solution has.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Markus</title>
		<link>http://johannesbrodwall.com/2010/03/08/why-and-how-to-use-jetty-in-mission-critical-production/comment-page-1/#comment-127915</link>
		<dc:creator>Markus</dc:creator>
		<pubDate>Fri, 20 Aug 2010 14:05:00 +0000</pubDate>
		<guid isPermaLink="false">http://johannesbrodwall.com/?p=519#comment-127915</guid>
		<description>There are many &quot;service wrapper&quot; libraries. Some of them

http://commons.apache.org/daemon/
http://wrapper.tanukisoftware.com/doc/english/download.jsp
http://yajsw.sourceforge.net/
http://forge.ow2.org/projects/javaservice

I would recommend to start trying from Apache Commons Daemon. It used for Apache Tomcat for example.</description>
		<content:encoded><![CDATA[<p>There are many &#8220;service wrapper&#8221; libraries. Some of them</p>
<p><a href="http://commons.apache.org/daemon/" rel="nofollow">http://commons.apache.org/daemon/</a><br />
<a href="http://wrapper.tanukisoftware.com/doc/english/download.jsp" rel="nofollow">http://wrapper.tanukisoftware.com/doc/english/download.jsp</a><br />
<a href="http://yajsw.sourceforge.net/" rel="nofollow">http://yajsw.sourceforge.net/</a><br />
<a href="http://forge.ow2.org/projects/javaservice" rel="nofollow">http://forge.ow2.org/projects/javaservice</a></p>
<p>I would recommend to start trying from Apache Commons Daemon. It used for Apache Tomcat for example.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

