<?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"
	>
<channel>
	<title>Comments on: Updated:I&#8217;ve already tried the &#8216;waving a dead chicken over our servers&#8217; trick</title>
	<atom:link href="http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/feed/" rel="self" type="application/rss+xml" />
	<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/</link>
	<description>My Blog, Take 4</description>
	<pubDate>Sat, 22 Nov 2008 05:04:20 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.6.3</generator>
		<item>
		<title>By: Nick Lothian</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-99</link>
		<dc:creator>Nick Lothian</dc:creator>
		<pubDate>Fri, 29 Jun 2007 03:22:49 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-99</guid>
		<description>@Brad: Yes, I'm aware of the double-checking locking pattern problems. That's not the problem here, but I think the caching may have something to do with it

@Geoff: Redhat AS3. It runs out of threads and stops responding (or actually Apache runs out of threads). Increasing the threadcount in Apache just delays hang.</description>
		<content:encoded><![CDATA[<p>@Brad: Yes, I&#8217;m aware of the double-checking locking pattern problems. That&#8217;s not the problem here, but I think the caching may have something to do with it</p>
<p>@Geoff: Redhat AS3. It runs out of threads and stops responding (or actually Apache runs out of threads). Increasing the threadcount in Apache just delays hang.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-97</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Thu, 28 Jun 2007 18:35:59 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-97</guid>
		<description>Another question and possible answer, does server actually crash or does it just stop accepting requests? If it's the latter then one initial thought I've had is that it's running out of available threads to process the requests, so it then appears to hang. If it crashes then all you need is somebody who can read dumps, right :-)</description>
		<content:encoded><![CDATA[<p>Another question and possible answer, does server actually crash or does it just stop accepting requests? If it&#8217;s the latter then one initial thought I&#8217;ve had is that it&#8217;s running out of available threads to process the requests, so it then appears to hang. If it crashes then all you need is somebody who can read dumps, right :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Geoff</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-96</link>
		<dc:creator>Geoff</dc:creator>
		<pubDate>Thu, 28 Jun 2007 18:28:42 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-96</guid>
		<description>What OS are you running on for both appserver and dbserver?</description>
		<content:encoded><![CDATA[<p>What OS are you running on for both appserver and dbserver?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brad</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-95</link>
		<dc:creator>Brad</dc:creator>
		<pubDate>Thu, 28 Jun 2007 00:08:42 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-95</guid>
		<description>“after a some hours running the site just stops responding” - i had a very similar problem. It turned out to be thread locking due to use of the double-checked locking pattern. The story went something like this..

CMS site with some custom code for dynamic content. The dynamic stuff was a bit slow so i put in some caching. It was still a bit slow so i guessed i could make things faster by eliminating synchronization of the cache access - hence the double-checking-locking. All went swimmingly, including up to 2 days of continuous heavy load testing on a single CPU server.

In case you're not familiar with the double-checked problem, its when you write code like this..

Object getCachedThing() {
 if( cached == null ) {
   synchronized {
     if( cached == null ) {
       cached = lookupFromDatabase()
    }
   }
   return cached
 }
}

There's lots of literature on it but the bottom line is it can't ever work reliably in a multi CPU environment. Note that in my case i was looking up via a key and storing in a hashmap.

Once in production (on clustered multi CPU machines) the site would gradually grind to a halt. For some reason, the double checked thing resulted in threads deadlocking - not at all an expected result even once i knew that double-checking was a no no. I thought i'd get null pointers. Looks like its something in HashMap which can make it dead lock if accessed by multiple threads.

Might not be your problem, but sound like you have the same symptoms i had

Cheers</description>
		<content:encoded><![CDATA[<p>“after a some hours running the site just stops responding” - i had a very similar problem. It turned out to be thread locking due to use of the double-checked locking pattern. The story went something like this..</p>
<p>CMS site with some custom code for dynamic content. The dynamic stuff was a bit slow so i put in some caching. It was still a bit slow so i guessed i could make things faster by eliminating synchronization of the cache access - hence the double-checking-locking. All went swimmingly, including up to 2 days of continuous heavy load testing on a single CPU server.</p>
<p>In case you&#8217;re not familiar with the double-checked problem, its when you write code like this..</p>
<p>Object getCachedThing() {<br />
 if( cached == null ) {<br />
   synchronized {<br />
     if( cached == null ) {<br />
       cached = lookupFromDatabase()<br />
    }<br />
   }<br />
   return cached<br />
 }<br />
}</p>
<p>There&#8217;s lots of literature on it but the bottom line is it can&#8217;t ever work reliably in a multi CPU environment. Note that in my case i was looking up via a key and storing in a hashmap.</p>
<p>Once in production (on clustered multi CPU machines) the site would gradually grind to a halt. For some reason, the double checked thing resulted in threads deadlocking - not at all an expected result even once i knew that double-checking was a no no. I thought i&#8217;d get null pointers. Looks like its something in HashMap which can make it dead lock if accessed by multiple threads.</p>
<p>Might not be your problem, but sound like you have the same symptoms i had</p>
<p>Cheers</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Lothian</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-94</link>
		<dc:creator>Nick Lothian</dc:creator>
		<pubDate>Wed, 27 Jun 2007 23:02:18 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-94</guid>
		<description>@insac: No pattern that we've been able to figure out.

@Tim: We've tried the index thing. It is actually possible that the default database setup has too many indexes - but as I said, database load doesn't seem to be an issue.

I suspect a threading issue, too. I have some experience debugging that kind of problem, and it's not something I want to do - especially when it isn't our code. Hence the waving of dead chickens...</description>
		<content:encoded><![CDATA[<p>@insac: No pattern that we&#8217;ve been able to figure out.</p>
<p>@Tim: We&#8217;ve tried the index thing. It is actually possible that the default database setup has too many indexes - but as I said, database load doesn&#8217;t seem to be an issue.</p>
<p>I suspect a threading issue, too. I have some experience debugging that kind of problem, and it&#8217;s not something I want to do - especially when it isn&#8217;t our code. Hence the waving of dead chickens&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim Vernum</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-93</link>
		<dc:creator>Tim Vernum</dc:creator>
		<pubDate>Wed, 27 Jun 2007 14:01:09 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-93</guid>
		<description>__Query tuning__
Depending on the queries and the database design you may be able to tune it by adding indexes without changing the queries.
Alternatively, are the queries pulled from config files? I had to tune a vendor system that did exactly that. I was able to tweak a few properties files and that sorted it out. 

__Crazy solutions__
You could write your own JDBC driver and catch the inefficient/unnecessary queries and handle them yourself.
If the queries are moderately well written, then it should be feasible enough to work. 

__Stability__
In my experience, lock ups tend to be concurrency/synchronization issues. The last one I ran into was a log4j issue (in an older version) where all the threads were locked up on the async buffer.
The thread dumps don't sound like fun, but they sound like the best path to enlightenment.</description>
		<content:encoded><![CDATA[<p>__Query tuning__<br />
Depending on the queries and the database design you may be able to tune it by adding indexes without changing the queries.<br />
Alternatively, are the queries pulled from config files? I had to tune a vendor system that did exactly that. I was able to tweak a few properties files and that sorted it out. </p>
<p>__Crazy solutions__<br />
You could write your own JDBC driver and catch the inefficient/unnecessary queries and handle them yourself.<br />
If the queries are moderately well written, then it should be feasible enough to work. </p>
<p>__Stability__<br />
In my experience, lock ups tend to be concurrency/synchronization issues. The last one I ran into was a log4j issue (in an older version) where all the threads were locked up on the async buffer.<br />
The thread dumps don&#8217;t sound like fun, but they sound like the best path to enlightenment.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: insac</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-92</link>
		<dc:creator>insac</dc:creator>
		<pubDate>Wed, 27 Jun 2007 13:00:37 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-92</guid>
		<description>&#62; The specific problem isn’t performance - it’s stability.

Just another couple of questions:
you say that "after a some hours running the site just stops responding".

There is a "time pattern" in this behaviour?
A - it stops responding after X hours from the restart
B - it stops every day at about X o'clock
C - it stops every morning when the load begins to increase

Last question: have you the possibility to increase the number of the DB connections available to the CMS. If you've already tried it, what effect it had on performance and stability?</description>
		<content:encoded><![CDATA[<p>&gt; The specific problem isn’t performance - it’s stability.</p>
<p>Just another couple of questions:<br />
you say that &#8220;after a some hours running the site just stops responding&#8221;.</p>
<p>There is a &#8220;time pattern&#8221; in this behaviour?<br />
A - it stops responding after X hours from the restart<br />
B - it stops every day at about X o&#8217;clock<br />
C - it stops every morning when the load begins to increase</p>
<p>Last question: have you the possibility to increase the number of the DB connections available to the CMS. If you&#8217;ve already tried it, what effect it had on performance and stability?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nick Lothian</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-90</link>
		<dc:creator>Nick Lothian</dc:creator>
		<pubDate>Wed, 27 Jun 2007 01:51:05 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-90</guid>
		<description>&lt;p&gt;@David Dossot: Yes - they are mainly search results.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>@David Dossot: Yes - they are mainly search results.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: David Dossot</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-89</link>
		<dc:creator>David Dossot</dc:creator>
		<pubDate>Wed, 27 Jun 2007 00:25:25 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-89</guid>
		<description>CMS are not designed for serving highly dynamic content. They usually perform too much content access (whether it is in a DB or a JCR repository) to build a single page that they underperform if the page is not cached as a whole.

Very often, the dynamic parts are minimal: most of the page comes from authored content that is pretty static, time-wise.

There are different ways to "inject" bits of dynamic data in a static cached page, some ugly, some less.

You can have the CMS generate client-side scripting that will call back the server for the dynamic bits and display them in the right places on the page. This requires caching, either at client side with a cookie, or between the client and the server.

Another option is to use the CMS as a template provider and have your application using these templates to decorate their dynamic outputs with a framework like Sitemesh.</description>
		<content:encoded><![CDATA[<p>CMS are not designed for serving highly dynamic content. They usually perform too much content access (whether it is in a DB or a JCR repository) to build a single page that they underperform if the page is not cached as a whole.</p>
<p>Very often, the dynamic parts are minimal: most of the page comes from authored content that is pretty static, time-wise.</p>
<p>There are different ways to &#8220;inject&#8221; bits of dynamic data in a static cached page, some ugly, some less.</p>
<p>You can have the CMS generate client-side scripting that will call back the server for the dynamic bits and display them in the right places on the page. This requires caching, either at client side with a cookie, or between the client and the server.</p>
<p>Another option is to use the CMS as a template provider and have your application using these templates to decorate their dynamic outputs with a framework like Sitemesh.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Doug Lane</title>
		<link>http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-88</link>
		<dc:creator>Doug Lane</dc:creator>
		<pubDate>Tue, 26 Jun 2007 21:25:43 +0000</pubDate>
		<guid isPermaLink="false">http://nicklothian.com/blog/2007/06/24/ive-already-tried-the-waving-a-dead-chicken-over-our-servers-trick/#comment-88</guid>
		<description>If your content is dynamic enough and you're using MySQL, then disable the query cache. It sounds counter-intuitive, but if the cache hit rate is below 25%, then this will definitely help. Caching carries some overhead with it.</description>
		<content:encoded><![CDATA[<p>If your content is dynamic enough and you&#8217;re using MySQL, then disable the query cache. It sounds counter-intuitive, but if the cache hit rate is below 25%, then this will definitely help. Caching carries some overhead with it.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Dynamic Page Served (once) in 0.472 seconds -->
