<?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:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
		>
<channel>
	<title>Comments on: Why memcached is probably a bad idea for your Java app</title>
	<atom:link href="http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/feed/" rel="self" type="application/rss+xml" />
	<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/</link>
	<description>it's all rather confusing really...</description>
	<lastBuildDate>Thu, 12 Nov 2009 21:36:10 +0000</lastBuildDate>
	<generator>http://wordpress.com/</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Alex</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4727</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Tue, 28 Jul 2009 16:48:49 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4727</guid>
		<description>A great post and some insightful comments.

What you are talking about is a pretty massive infrastructure needed by only a handful of large companies (i.e. ebay, google, etc); for medium-large companies with traffic up to say 1-10 mil pageviews/day , some degree of server-stickiness with 80 odd servers is probably not the worst thing in the world.</description>
		<content:encoded><![CDATA[<p>A great post and some insightful comments.</p>
<p>What you are talking about is a pretty massive infrastructure needed by only a handful of large companies (i.e. ebay, google, etc); for medium-large companies with traffic up to say 1-10 mil pageviews/day , some degree of server-stickiness with 80 odd servers is probably not the worst thing in the world.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Brett</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4722</link>
		<dc:creator>Brett</dc:creator>
		<pubDate>Tue, 21 Jul 2009 16:02:13 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4722</guid>
		<description>Anyone who is a student of truly large scale server design knows by now that Java servlet sessions and session replication don&#039;t scale.  I suggest two items of study.  First, watch the Google IO sessions from 2008/09.  Strongly dis-recommended is almost any kind of what has traditionally been known as &quot;session state&quot; on the server.  Everything is moving to the client.  The server should be, _as nearly as practicable_ (let me emphasize that), stateless.

Second item of study reinforces what Google says.  Read ebay&#039;s write-up on scalability (google: ebay scalability).  Ebay architecture has evolved through the school of hard-knocks.  One of those hard-knocks was servlet sessions.  Ebay was simply being crushed in 2002.  Now they serve over two BILLION pages views PER DAY.  Something according to them (don&#039;t take my word for it) they could never have done if they had persisted with their server-side session-based architecture.

This is &quot;Web 2.0&quot; and beyond kids.  Java can scale massively; better despite any language debate than any modern language thanks to the JIT.  But a well architected Ruby site (for christ sake!) can beat a poorly architected Java one.  Let go of your &quot;servlet sessions&quot; and 1990&#039;s server architecture.  

Memcache, combined properly with client-homed sessions and &quot;stateless&quot; servers is the way of the future.  Computing clouds, instant and seamless fail-over are the goal here.  &quot;Session&quot; or &quot;server&quot; affinity are be a thing of the past.  Login to ebay and look at your cookies -- nearing 2 dozen -- that&#039;s ALL your state.  Do you think any two of your requests go to the same server at ebay?  You would be wrong.</description>
		<content:encoded><![CDATA[<p>Anyone who is a student of truly large scale server design knows by now that Java servlet sessions and session replication don&#8217;t scale.  I suggest two items of study.  First, watch the Google IO sessions from 2008/09.  Strongly dis-recommended is almost any kind of what has traditionally been known as &#8220;session state&#8221; on the server.  Everything is moving to the client.  The server should be, _as nearly as practicable_ (let me emphasize that), stateless.</p>
<p>Second item of study reinforces what Google says.  Read ebay&#8217;s write-up on scalability (google: ebay scalability).  Ebay architecture has evolved through the school of hard-knocks.  One of those hard-knocks was servlet sessions.  Ebay was simply being crushed in 2002.  Now they serve over two BILLION pages views PER DAY.  Something according to them (don&#8217;t take my word for it) they could never have done if they had persisted with their server-side session-based architecture.</p>
<p>This is &#8220;Web 2.0&#8243; and beyond kids.  Java can scale massively; better despite any language debate than any modern language thanks to the JIT.  But a well architected Ruby site (for christ sake!) can beat a poorly architected Java one.  Let go of your &#8220;servlet sessions&#8221; and 1990&#8217;s server architecture.  </p>
<p>Memcache, combined properly with client-homed sessions and &#8220;stateless&#8221; servers is the way of the future.  Computing clouds, instant and seamless fail-over are the goal here.  &#8220;Session&#8221; or &#8220;server&#8221; affinity are be a thing of the past.  Login to ebay and look at your cookies &#8212; nearing 2 dozen &#8212; that&#8217;s ALL your state.  Do you think any two of your requests go to the same server at ebay?  You would be wrong.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4681</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Thu, 11 Jun 2009 08:26:50 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4681</guid>
		<description>Quite frankly, most banks hire monkeys to do their coding (and yes, I&#039;ve worked in that sector). That said, my banks IB site is much faster than the local competition, and it&#039;s the only one built in Java.

I&#039;ve seen a PHP dev coding Java (apparently for 2 years already) make their doGet and doPost methods synchronized in a Servlet. It&#039;s not that PHP is simpler, just Java has more intricacies (like threads) that monkey devs don&#039;t &quot;understand&quot;.

One other point on Java and corporates is: most go with J2EE sites in the most stupid ways imaginable. For example:

Data Object -&gt; Data Store EJB -&gt; JDBC Driver -&gt; Database

See the additional network round-trip in there? That structure is the norm with Java monkeys, and it&#039;s just plain idiotic. I have a very low opinion of most J2EE developers (their are a few exceptions), since most seem to be covering their own incompetence with a framework.</description>
		<content:encoded><![CDATA[<p>Quite frankly, most banks hire monkeys to do their coding (and yes, I&#8217;ve worked in that sector). That said, my banks IB site is much faster than the local competition, and it&#8217;s the only one built in Java.</p>
<p>I&#8217;ve seen a PHP dev coding Java (apparently for 2 years already) make their doGet and doPost methods synchronized in a Servlet. It&#8217;s not that PHP is simpler, just Java has more intricacies (like threads) that monkey devs don&#8217;t &#8220;understand&#8221;.</p>
<p>One other point on Java and corporates is: most go with J2EE sites in the most stupid ways imaginable. For example:</p>
<p>Data Object -&gt; Data Store EJB -&gt; JDBC Driver -&gt; Database</p>
<p>See the additional network round-trip in there? That structure is the norm with Java monkeys, and it&#8217;s just plain idiotic. I have a very low opinion of most J2EE developers (their are a few exceptions), since most seem to be covering their own incompetence with a framework.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Enzo</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4680</link>
		<dc:creator>Enzo</dc:creator>
		<pubDate>Wed, 10 Jun 2009 17:39:02 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4680</guid>
		<description>So why do java based websites suck so much?

PHP / Memcached sites are light years ahead of Java sites in terms of speed. Look at any typical Java based banking site...my god are they slow.</description>
		<content:encoded><![CDATA[<p>So why do java based websites suck so much?</p>
<p>PHP / Memcached sites are light years ahead of Java sites in terms of speed. Look at any typical Java based banking site&#8230;my god are they slow.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nemanja</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4676</link>
		<dc:creator>Nemanja</dc:creator>
		<pubDate>Mon, 08 Jun 2009 11:40:15 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4676</guid>
		<description>Whole year is just for example. 
We are using URL rewriter to extract sessionid. 
And I don&#039;t want to go oftopic here.I was just curious how to store sessions on mulpitple servers and that&#039;s it. And your answer is load balancer over memcache. 
Thank you. :)</description>
		<content:encoded><![CDATA[<p>Whole year is just for example.<br />
We are using URL rewriter to extract sessionid.<br />
And I don&#8217;t want to go oftopic here.I was just curious how to store sessions on mulpitple servers and that&#8217;s it. And your answer is load balancer over memcache.<br />
Thank you. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4666</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Wed, 03 Jun 2009 06:31:33 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4666</guid>
		<description>I apologize if I came across as impolite, that was not my intention.

As for the cookie problem, there is a solution in the servlet api: &lt;a href=&quot;http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)&quot; rel=&quot;nofollow&quot;&gt;HttpServletResponse.encodeURL&lt;/a&gt;. This method will automatically detect if the user doesn&#039;t have cookies, and encode URL&#039;s with the session ID if they don&#039;t. It&#039;s considered bad practice when it comes to SEO, however the crawlers all seem to support cookies as well (so they will only see it on one page).

To fix the URL&#039;s in JSP pages, you can use the JSTL tag &lt;c:url&gt; to both produce an absolute path to a resource, and encode the session ID if required.

I&#039;m curious to know how you would go about tracking a customer for a whole year with memcached, considering it&#039;s likely to throw the session away &lt;i&gt;long&lt;/i&gt; before that time is reached, and without cookies or some form of URL encoding you can&#039;t tell one user from the next.

You could crank the session timeout as high as you like. Inactive sessions are serialized to disk (some servlet containers also do this between restarts), and so their timeout is guaranteed rather than based on load.</description>
		<content:encoded><![CDATA[<p>I apologize if I came across as impolite, that was not my intention.</p>
<p>As for the cookie problem, there is a solution in the servlet api: <a href="http://java.sun.com/products/servlet/2.2/javadoc/javax/servlet/http/HttpServletResponse.html#encodeURL(java.lang.String)" rel="nofollow">HttpServletResponse.encodeURL</a>. This method will automatically detect if the user doesn&#8217;t have cookies, and encode URL&#8217;s with the session ID if they don&#8217;t. It&#8217;s considered bad practice when it comes to SEO, however the crawlers all seem to support cookies as well (so they will only see it on one page).</p>
<p>To fix the URL&#8217;s in JSP pages, you can use the JSTL tag &lt;c:url&gt; to both produce an absolute path to a resource, and encode the session ID if required.</p>
<p>I&#8217;m curious to know how you would go about tracking a customer for a whole year with memcached, considering it&#8217;s likely to throw the session away <i>long</i> before that time is reached, and without cookies or some form of URL encoding you can&#8217;t tell one user from the next.</p>
<p>You could crank the session timeout as high as you like. Inactive sessions are serialized to disk (some servlet containers also do this between restarts), and so their timeout is guaranteed rather than based on load.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nemanja</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4664</link>
		<dc:creator>Nemanja</dc:creator>
		<pubDate>Tue, 02 Jun 2009 15:13:29 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4664</guid>
		<description>As far as I know, if someone turns off cookie in browser (or for mobile, where many browsers don&#039;t support cookie), than servlet container will track session using jsessionid, for example. And that session will not be remembered when you come again on site. And what if I need to track one customer whole year, for example.

As for the load balancer concerns, that is a good idea. And we are using it, already.

P.S. You could be more polite to people who posts here. Just a suggestion. :)</description>
		<content:encoded><![CDATA[<p>As far as I know, if someone turns off cookie in browser (or for mobile, where many browsers don&#8217;t support cookie), than servlet container will track session using jsessionid, for example. And that session will not be remembered when you come again on site. And what if I need to track one customer whole year, for example.</p>
<p>As for the load balancer concerns, that is a good idea. And we are using it, already.</p>
<p>P.S. You could be more polite to people who posts here. Just a suggestion. <img src='http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4661</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Thu, 28 May 2009 07:48:12 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4661</guid>
		<description>Session management for users is a standard feature of the Servlet containers. Why would you introduce memcached to manage sessions in a Java environment? The standard session management is generally going to be much more efficient (and stable) than using memcached (unless you&#039;re using Jetty).

If you&#039;re concerned with session migration, have your load balancer run sticky sessions, which will provide a much faster solution than memcached, since the users sessions will never need to move across the network (we run this way on 80 machines with no problems).

If you are going to use memcached with Java, use it for a cache. Tracking sessions with memcached in Java is a really bad idea (not to mention a terrible waste of resources).</description>
		<content:encoded><![CDATA[<p>Session management for users is a standard feature of the Servlet containers. Why would you introduce memcached to manage sessions in a Java environment? The standard session management is generally going to be much more efficient (and stable) than using memcached (unless you&#8217;re using Jetty).</p>
<p>If you&#8217;re concerned with session migration, have your load balancer run sticky sessions, which will provide a much faster solution than memcached, since the users sessions will never need to move across the network (we run this way on 80 machines with no problems).</p>
<p>If you are going to use memcached with Java, use it for a cache. Tracking sessions with memcached in Java is a really bad idea (not to mention a terrible waste of resources).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nemanja</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4660</link>
		<dc:creator>Nemanja</dc:creator>
		<pubDate>Thu, 28 May 2009 07:31:39 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4660</guid>
		<description>I read the article and all the comments and i must say that, Jason, didn&#039;t answer the question. What to use instead if you have farm of servers and you must track a session for each user?</description>
		<content:encoded><![CDATA[<p>I read the article and all the comments and i must say that, Jason, didn&#8217;t answer the question. What to use instead if you have farm of servers and you must track a session for each user?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jason</title>
		<link>http://lemnik.wordpress.com/2008/09/10/why-memcached-is-probably-a-bad-idea-for-your-java-app/#comment-4584</link>
		<dc:creator>Jason</dc:creator>
		<pubDate>Thu, 04 Dec 2008 07:28:49 +0000</pubDate>
		<guid isPermaLink="false">http://lemnik.wordpress.com/?p=156#comment-4584</guid>
		<description>I would advise you to look closer at pure Java caches. Most of them &lt;b&gt;don&#039;t&lt;/b&gt; update the entire distributed cache, since as you point out: it&#039;s a &lt;i&gt;cache&lt;/i&gt;. Some have highly configurable option stacks which allow 100% replication, power-of-three replication, last-accessed replication and many other options.</description>
		<content:encoded><![CDATA[<p>I would advise you to look closer at pure Java caches. Most of them <b>don&#8217;t</b> update the entire distributed cache, since as you point out: it&#8217;s a <i>cache</i>. Some have highly configurable option stacks which allow 100% replication, power-of-three replication, last-accessed replication and many other options.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
