<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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:slash="http://purl.org/rss/1.0/modules/slash/"
	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>Kristian Lyngstol&#039;s Blog</title>
	<atom:link href="http://kristianlyng.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://kristianlyng.wordpress.com</link>
	<description>A free software-hacker&#039;s blog</description>
	<lastBuildDate>Thu, 01 Dec 2011 15:25:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='kristianlyng.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Kristian Lyngstol&#039;s Blog</title>
		<link>http://kristianlyng.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://kristianlyng.wordpress.com/osd.xml" title="Kristian Lyngstol&#039;s Blog" />
	<atom:link rel='hub' href='http://kristianlyng.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Varnish Training</title>
		<link>http://kristianlyng.wordpress.com/2011/12/01/varnish-training/</link>
		<comments>http://kristianlyng.wordpress.com/2011/12/01/varnish-training/#comments</comments>
		<pubDate>Thu, 01 Dec 2011 14:55:12 +0000</pubDate>
		<dc:creator>Kristian</dc:creator>
				<category><![CDATA[Varnish]]></category>
		<category><![CDATA[informational]]></category>
		<category><![CDATA[training]]></category>

		<guid isPermaLink="false">http://kristianlyng.wordpress.com/?p=375</guid>
		<description><![CDATA[As anyone who&#8217;s worked with me should realize by now, I&#8217;m big on documentation, be it source code comments or other types of documentation. The only reason I&#8217;m not more active in the documentation section of Varnish Cache is because I&#8217;ve maintained our (Varnish Software&#8217;s) training material ever since Tollef Fog Heen wrote the initial [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=375&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>As anyone who&#8217;s worked with me should realize by now, I&#8217;m big on documentation, be it source code comments or other types of documentation. The only reason I&#8217;m not more active in the documentation section of Varnish Cache is because I&#8217;ve maintained our (Varnish Software&#8217;s) training material ever since Tollef Fog Heen wrote the initial slides in 2009.</p>
<p>I&#8217;ve held the course more times than I can remember, and usually done improvements after every course. Others have also held the course, including Redpill Linpro&#8217;s Kacper Wysocki, maintainer of <a href="https://github.com/comotion/security.vcl">security.vcl</a> and Magnus Hagander (Postgresql god/swede). Feedback and gradual improvements have turned a set of slides into a pretty good course material.</p>
<p>We recently started holding on-line courses too. This revealed several new challenges. The obvious challenges are things like getting basic voice communication working (it sounds easy, but you&#8217;d be amazed&#8230;). It was also interesting when I held the course in my apartment on Australian time, and my ISP decided to perform maintenance on my cable modem (it was 2AM local, after all). So I&#8217;ve had to hold the course on a 3G connection, communicating with Australia. Fun. Then there&#8217;s the lack of or severely reduced feedback, which presents challenges in how we do exercises and generally deal with the course. In a class room I can easily determine if the participants are able to keep up, if I&#8217;m going too slow or too fast and whether or not a subject is more interesting than an other. All of that is, at best, very difficult in an on-line session.</p>
<p>The last few weeks I&#8217;ve finally gotten around to merging the sysadmin course with the web development course that Jérôme Renard has written for us. It proved the perfect opportunity to give the course an other big update. While the course was already updated for Varnish 3, I&#8217;ve made several other Varnish 3-related additions. More importantly is that the flow of the course has changed from one oriented on Varnish functionality to tasks you wish to accomplish with Varnish. Instead of teaching you about Varnish architecture first, then Varnish parameters, the course now has a chapter devoted to Tuning.</p>
<p>Instead of just throwing in purging or banning when talking about VCL, there&#8217;s now a chapter called Cache Invalidation, that attempts to give broader understanding of the alternatives you have and when to use which solution. Similarly, there&#8217;s a chapter called Saving The Request, which starts out with the core Grace mechanisms, moves on to health checks, saint mode, req.hash_always_miss, directors and more.</p>
<p>There are several reasons I write about this. First of all: I&#8217;m very excited about the material. I&#8217;ve worked on it regularly for several years, doing everything from hacking rst2s5, tweaking the type setting and design to updating the content, reorganizing the course and of course holding it. It may seem like one big marketing stunt, but I can promise you that I never blog about something I&#8217;m not passionate about, regardless of whether it is work-related or not.</p>
<p>The other reason is that I&#8217;m holding the course next week. This will be the first time we hold it using the changed structure. I would have wanted to hold it in a class room first, but holding it on-line is still exciting.</p>
<p>If you wish to participate, head over to <a href="https://www.varnish-software.com/products-services/training/varnish-administration-course">https://www.varnish-software.com/products-services/training/varnish-administration-course</a> and convince your boss it will be awesome!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kristianlyng.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kristianlyng.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kristianlyng.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kristianlyng.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kristianlyng.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kristianlyng.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kristianlyng.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kristianlyng.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kristianlyng.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kristianlyng.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kristianlyng.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kristianlyng.wordpress.com/375/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kristianlyng.wordpress.com/375/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kristianlyng.wordpress.com/375/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=375&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kristianlyng.wordpress.com/2011/12/01/varnish-training/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/98ce072867be34c306871f4411ca766b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">kristianlyng</media:title>
		</media:content>
	</item>
		<item>
		<title>Varnish 3.0.0 &#8211; RSN!</title>
		<link>http://kristianlyng.wordpress.com/2011/06/09/varnish-3-0-0-rsn/</link>
		<comments>http://kristianlyng.wordpress.com/2011/06/09/varnish-3-0-0-rsn/#comments</comments>
		<pubDate>Thu, 09 Jun 2011 14:35:15 +0000</pubDate>
		<dc:creator>Kristian</dc:creator>
				<category><![CDATA[/dev/random]]></category>
		<category><![CDATA[informational]]></category>
		<category><![CDATA[Oslo]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[preview]]></category>
		<category><![CDATA[Varnish]]></category>
		<category><![CDATA[Varnish Software]]></category>

		<guid isPermaLink="false">http://kristianlyng.wordpress.com/?p=359</guid>
		<description><![CDATA[Varnish 3.0.0 beta2 was just released, and we&#8217;re aiming for 3.0.0 next week. The release date is set for Thursday the 16th (next week(June, 2011, for the potential future archive crawlers)), and several release parties are planned. Varnish Software will be present in Santa Clara, London and Oslo, but numerous parties are planned all around [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=359&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Varnish 3.0.0 beta2 was <a href="http://www.varnish-cache.org/lists/pipermail/varnish-announce/2011-June/000032.html" title="just released">just released</a>, and we&#8217;re aiming for 3.0.0 next week.</p>
<p>The release date is set for Thursday the 16th (next week(June, 2011, for the potential future archive crawlers)), and several release parties are planned. <a href="http://www.varnish-software.com">Varnish Software</a> will be present in Santa Clara, London and Oslo, but numerous parties are planned <a href="http://v3party.varnish-cache.org/">all around the world</a>.</p>
<p>This will be a very special day for everyone in Varnish Software. Varnish 2.0.0 was released roughly the same week I started working at Redpill Linpro, before I was really involved with Varnish, and I still regret that I didn&#8217;t snatch one of those fancy 2.0-t-shirts.</p>
<h2>What&#8217;s new?</h2>
<p>While there are too many news to mention, there are two that stand out more than anything.</p>
<p>The first is gzip compression and the second is the Varnish module-architecture, or simply vmods. That most of ESI has been re-factored under the hood will be evident in future releases, and the same goes for streaming delivery.</p>
<h2>Compression</h2>
<p>- &#8220;What, you don&#8217;t already have compression?!&#8221;</p>
<p>Remember, Varnish is a caching service. Most of the time you don&#8217;t need it to do the compression, because the web server will do it for you. But there are good reasons for why you want it. ESI is the primary use-case.</p>
<p>With ESI, Varnish needs to parse the content, and it can&#8217;t do that if it doesn&#8217;t understand the transfer encoding. With Varnish 2.1, you have to send uncompressed data to Varnish if you want to use ESI. This means you have to either deliver uncompressed content to your clients, or use yet an other service in front of Varnish.</p>
<p>But let me get a bit technical, because Varnish 3.0&#8242;s compression is pretty awe-inspiring.</p>
<p>So with ESI, you have multiple, individually cached elements that make up a single user-visible page. So what we could do, is glue it all together and compress it before we send it. The downside is that we&#8217;ll do the compression over and over. An alternative would be to cache the compressed result as long as the individual elements are unchanged, but that will require more space and more complexity.</p>
<p>So what does Varnish 3.0 does? It stores the elements compressed, modifies the right gzip-bits and glues it all together on the fly, without decompressing it. If a single element is changed, only that element needs to be updated. This is probably the best solution, even if the complexity of meddling with binary gzip headers directly can lead to some pretty tricky code. I challenge you to find a solution that handles compression in a smarter way.</p>
<p>Varnish 3.0 also does decompression. If your browser doesn&#8217;t support compression (Possibly a script or other tool, real browsers support compression), Varnish will decompress the object for you on the fly. This is an other huge improvement over Varnish 2.1. In Varnish 2.1, this is solved using Vary: and storing different copies of the same object based on compression.</p>
<p>We can also do the same with the backend-data: If ESI needs to read the data, Varnish 3.0 can decompress it on the fly, parse it, then re-compress it before storing it.</p>
<p>And for you, the user, the complexity is fairly non-existent. Push the button, remove that nginx(no hard feelings)server you had doing compression, ????, profit!</p>
<h2>VMODS!</h2>
<p>VCL, the Varnish Configuration Language, is a flexible way of configuring Varnish. Since it is already translated from VCL to C, the compiled and linked in to the running Varnish instance, VCL has &#8220;always&#8221; had in-line C: Anywhere you want to, you can tell the VCL compiler that this is pure C code, and pass it directly to the compiler instead of trying to translate from VCL to C first. This was mainly provided because: </p>
<p>1. It didn&#8217;t add any complexity and was actually less work.<br />
2. It  provided an escape chute for features we didn&#8217;t want in Varnish-proper, but were valid for some users.</p>
<p>What features could that be? Syslog-support, geoip-integration, cryptographic verification of authorization headers, etc.</p>
<p>It turned out to be very useful, but impractical and difficult to re-use. Since it was all glued to your VCL, it meant that you had to stick C code in the middle of your regular configuration, and it made it very hard to combine two different features if you didn&#8217;t know C yourself. And linking towards external libraries required parameter changes.</p>
<p>Enter varnish modules.</p>
<p>Simply put, vmods are a way of letting you do the same thing you can do with in-line C, but in a more sustainable manner. A vmod will typically have a few functions exposed to VCL, and the VCL just has to declare that it imports the vmod to use the functions without a single line of C-code in your VCL.</p>
<p>This also means that the vmod has its own build system, own linking process, flexible development environment and are much easier to share.</p>
<p>In the time to come, I expect us to have a community-site for vmods. I also expect that you will see a lot of minor yet important changes to Varnish during the Varnish 3.0-cycle that exposes more of the internal varnish utilities so vmods can use them.</p>
<p>Small disclaimer, though: There is no API guarantee. We don&#8217;t wish to slow the pace of Varnish-development by restricting what we can change. That said, we wont tear things apart just to see our vmod-contributors bleed.</p>
<p>I plan to write a blog post on vmod-hacking in the near future, so expect more detail there.</p>
<h2>Finishing words</h2>
<p>Varnish 1.0 was, as any 1.0-release is, important. I was not involved with the project back then, but as I understand it, Varnish 1 was very much tailored to a specific site, or type of site.</p>
<p>With Varnish 2.0, Varnish became useful for anyone with a high-traffic site. The 2.0-series was a good release-series, adding a healthy mixture of bug fixes and non-intrusive features with each release. But constantly focused on real-world usage. We also saw the first Varnish User Group meeting during that time.</p>
<p>Varnish 2.1 has been a sort of intermittent release. Director-refactoring, ESI and to a certain degree persistent storage paved the way for architectural changes that had to be done. Meanwhile, the user-base really exploded.</p>
<p>Now, with Varnish 3.0.0 coming out, we are already seeing how useful vmods are for Varnish Software-customers like <a href="http://en.softonic.com/"> Softonic</a>, who&#8217;re sponsoring a VMOD to allow header-modification targeted at the Set-Cookie header (which can&#8217;t be treated like the RFC2616 specifies, due to how this has been implemented historically). Doing this in a vmod allows the VCL to remain clean. It also lets us share the code that isn&#8217;t site-specific but widely useful, since it is all contained in a <a href="https://github.com/KristianLyng/libvmod-header">header vmod</a>(Still under development). Gzip also means there are no drawbacks to using ESI with Varnish. You don&#8217;t need to add a second service to compress data.</p>
<p>It all boils down to Varnish being a more useful part of your architecture. It&#8217;s easy to get fast and maintainable C-code in there if you need it, you can even pay someone to write just that bit for you. Without being confined to Varnish&#8217; own road map and release cycle. There are no longer any downsides to using ESI. It&#8217;s fast. It&#8217;s free software. There are professional service and support offerings <a href="http://www.varnish-software.com">available</a>. Varnish follow standards &#8211; unless you tell it not to. And so forth.</p>
<p>I&#8217;m not usually one to pat myself too much on the back, but as I&#8217;m writing this, I feel proud to be part of the team that gives you Varnish 3.0.</p>
<p>If you&#8217;re in Oslo, I&#8217;ll see you next Thursday!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kristianlyng.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kristianlyng.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kristianlyng.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kristianlyng.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kristianlyng.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kristianlyng.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kristianlyng.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kristianlyng.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kristianlyng.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kristianlyng.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kristianlyng.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kristianlyng.wordpress.com/359/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kristianlyng.wordpress.com/359/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kristianlyng.wordpress.com/359/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=359&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kristianlyng.wordpress.com/2011/06/09/varnish-3-0-0-rsn/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/98ce072867be34c306871f4411ca766b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">kristianlyng</media:title>
		</media:content>
	</item>
		<item>
		<title>The many pitfalls of benchmarking</title>
		<link>http://kristianlyng.wordpress.com/2011/03/16/the-many-pitfalls-of-benchmarking/</link>
		<comments>http://kristianlyng.wordpress.com/2011/03/16/the-many-pitfalls-of-benchmarking/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 22:23:24 +0000</pubDate>
		<dc:creator>Kristian</dc:creator>
				<category><![CDATA[/dev/random]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[informational]]></category>
		<category><![CDATA[stress testing]]></category>
		<category><![CDATA[Varnish]]></category>

		<guid isPermaLink="false">http://kristianlyng.wordpress.com/?p=350</guid>
		<description><![CDATA[I was made aware of a synthetic benchmark that concerned Varnish today, and it looked rather suspicious. The services tested was Varnish, nginx, Apache and G-Wan. And G-Wan came out an order of magnitude faster than Varnish. This made me question the result. The first thing I noticed was AB, a tool I&#8217;ve long since [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=350&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I was made aware of a synthetic benchmark that concerned Varnish today, and it looked rather suspicious. The services tested was Varnish, nginx, Apache and G-Wan. And G-Wan came out an order of magnitude faster than Varnish. This made me question the result. The first thing I noticed was AB, a tool I&#8217;ve long since given up trying to make behave properly. As there was no detailed data, I decided to give it a spin myself.</p>
<p>You will not find graphs. You will not find &#8220;this is best!&#8221;-quotes. I&#8217;m not even backing up my statements with httperf-output.</p>
<h2>Disclaimer</h2>
<p>This is not a comparison of G-Wan versus Varnish. It is not complete. It is not even a vague attempt at making either G-Wan or Varnish perform better or worse. It is not realistic. Not complete and in no way a reflection on the overall functionality, usability or performance of G-Wan.</p>
<p>Why not? Because I would be stupid to publicize such things without directly consulting the developers of G-Wan so that the comparison would be fair. I am a Varnish-developer.</p>
<p>This is a text about stress testing. Not the result of stress testing. Nothing more.</p>
<h2>The basic idea</h2>
<p>So G-Wan was supposedly much faster than Varnish. The feature-set is also very narrow, as it goes about things differently. The test showed that Varnish, Apache and nginx were almost comparable in performance, whereas G-Wan was ridiculously much faster. The test was also conducted on a local machine (so no networking) and using AB. As I know that it&#8217;s hard to get nginx, Apache and Varnish to perform within the same level, this indicated that G-Wan did something differently that affected the test to me.</p>
<p>I installed g-wan and Varnish on a virtual machine and started playing with httperf.</p>
<h2>What to test</h2>
<p>The easiest number to demonstrate in a test is the maximum request rate. It tells you what the server can do under maximum load. However, it is also the hardest test to do precisely and fairly across daemons of vastly different nature.</p>
<p>Other things I have rarely written about is the response time of Varnish for average requests. This is often much more interesting to the end user, as your server isn&#8217;t going to be running at full capacity anyway. The fairness and concurrency is also highly relevant. A user doing a large download shouldn&#8217;t adversely affect other users.</p>
<p>I wasn&#8217;t going to bother with all that.</p>
<h2>First test</h2>
<p>The first test I did was &#8220;max req/s&#8221;-like. It quickly showed that G-Wan was very fast, and in fact faster than Varnish. At first glance. The actual request-rate was faster. The CPU-usage was lower. However, Varnish is massively multi-threaded, which offsets the cpu measurements greatly and I wasn&#8217;t about to trust it.</p>
<p>Looking closer I realized that the real bottleneck was in fact httperf. With Varnish, it was able to keep more connections open and busy at the same time, and thus hit the upper limit of concurrency. This in turned gave subtle and easily ignored errors on the client which Varnish can do little about. It seemed G-Wan was dealing with fewer sessions at the same time, but faster, which gave httperf an easier time. This does not benefit G-Wan in the real world (nor does it necessarily detract from the performance), but it does create an unbalanced synthetic test.</p>
<p>I experimented with this quite a bit, and quickly concluded that the level of concurrency was much higher with varnish. But it was difficult to measure. Really difficult. Because I did not want to test httperf.</p>
<p>The hardware I used was my home-computer, which is ridiculously overpowered. The VM (KVM) was running with two CPU cores and I executed the clients from the host-OS instead of booting up physical test-servers. (&#8230; That 275k req/s that&#8217;s so much quoted? Spotify didn&#8217;t skip a beat while it was running (on the same machine). <img src='http://s1.wp.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> )</p>
<h2>Conclusion</h2>
<p>The more I tested this, the more I was able to produce any result I wanted by tweaking the level of concurrency, the degree of load, the amount of bandwidth required and so forth.</p>
<p>The response time of G-Wan seemed to deteriorate with load. But that might as well be the test environment. As the load went up, it took a long time to get a response. This is just not the case with Varnish at all. I ended up doing a little hoodwinking at the end to see how far this went, and the results varied extremely with tiny variations of test-parameters. The concurrency is a major factor. And the speed of Varnish at each individual connection played a huge part. At large amounts of parallel requests Varnish would be sufficiently fast with all the connections that httperf never ran into problems, while G-Wan would be more uneven and thus trigger failures (and look slower)&#8230;</p>
<p>My only conclusion is that it will take me several days to properly map out the performance patterns of Varnish compared to G-Wan. They treat concurrent connections vastly different and perform very different depending on the load-pattern you throw at them. Relating this to real traffic is very hard.</p>
<p>But this confirms my suspicion of the bogus-ness of the blog post that lead me to perform these tests. It&#8217;s not that I mind Varnish losing performance tests if we are actually slower, but it&#8217;s very hard to stomach when the nature of the test is so dubious. The art of measuring realistic performance with synthetic testing is not one that can be mastered in an afternoon.</p>
<h2>Lessons learned</h2>
<p>(I think conclusions are supposed to be last, but never mind)</p>
<p>First: Be skeptical of unbalanced results. And of even results.</p>
<p>Second: Measure more than one factor. I&#8217;ve mainly focused on request-rate in my posts because I do not compare Varnish to anything but itself. Without a comparison it doesn&#8217;t make that much sense to provide reply latency (though I suppose I should start supplying a measure of concurrency, since that&#8217;s one of the huge strong-points of Varnish.).</p>
<p>Third: Conclude carefully. This is an extension of the first lesson.</p>
<p>&#8230;</p>
<p>A funny detail: While I read the license for the non-free G-Wan, which I always do for proprietary software, I was happy to see that it didn&#8217;t have a benchmark-clause (Oracle, anyone?). But it does forbid removing or modifying the Server:-header. It also forces me to give the G-Wan-guys permission to use my using of G-Wan in their marketing… Hmm — maybe I should &#8230; — err, never mind.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kristianlyng.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kristianlyng.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kristianlyng.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kristianlyng.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kristianlyng.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kristianlyng.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kristianlyng.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kristianlyng.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kristianlyng.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kristianlyng.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kristianlyng.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kristianlyng.wordpress.com/350/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kristianlyng.wordpress.com/350/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kristianlyng.wordpress.com/350/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=350&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kristianlyng.wordpress.com/2011/03/16/the-many-pitfalls-of-benchmarking/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/98ce072867be34c306871f4411ca766b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">kristianlyng</media:title>
		</media:content>
	</item>
		<item>
		<title>Varnish Seminar in Paris</title>
		<link>http://kristianlyng.wordpress.com/2011/03/16/varnish-seminar-in-paris/</link>
		<comments>http://kristianlyng.wordpress.com/2011/03/16/varnish-seminar-in-paris/#comments</comments>
		<pubDate>Wed, 16 Mar 2011 09:15:33 +0000</pubDate>
		<dc:creator>Kristian</dc:creator>
				<category><![CDATA[/dev/random]]></category>
		<category><![CDATA[informational]]></category>
		<category><![CDATA[paris]]></category>
		<category><![CDATA[presentation]]></category>
		<category><![CDATA[Varnish]]></category>

		<guid isPermaLink="false">http://kristianlyng.wordpress.com/?p=347</guid>
		<description><![CDATA[I will be in Paris next week to participate in a seminar on Varnish at Capgemini&#8217;s premises. If you are in the area and interested in Varnish, take a look at ﻿https://www.varnish-software.com/paris. The nature of the event is informational for technical minds. (This must be my shortest blog-post by far)<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=347&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I will be in Paris next week to participate in a seminar on Varnish at Capgemini&#8217;s premises. If you are in the area and interested in Varnish, take a look at ﻿<a href="https://www.varnish-software.com/paris">https://www.varnish-software.com/paris</a>. The nature of the event is informational for technical minds.</p>
<p>(This must be my shortest blog-post by far)</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kristianlyng.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kristianlyng.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kristianlyng.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kristianlyng.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kristianlyng.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kristianlyng.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kristianlyng.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kristianlyng.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kristianlyng.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kristianlyng.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kristianlyng.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kristianlyng.wordpress.com/347/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kristianlyng.wordpress.com/347/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kristianlyng.wordpress.com/347/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=347&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kristianlyng.wordpress.com/2011/03/16/varnish-seminar-in-paris/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/98ce072867be34c306871f4411ca766b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">kristianlyng</media:title>
		</media:content>
	</item>
		<item>
		<title>High-End Varnish &#8211; 275 thousand requests per second.</title>
		<link>http://kristianlyng.wordpress.com/2010/10/23/275k-req/</link>
		<comments>http://kristianlyng.wordpress.com/2010/10/23/275k-req/#comments</comments>
		<pubDate>Sat, 23 Oct 2010 12:28:54 +0000</pubDate>
		<dc:creator>Kristian</dc:creator>
				<category><![CDATA[/dev/random]]></category>
		<category><![CDATA[experiment]]></category>
		<category><![CDATA[tuning]]></category>
		<category><![CDATA[Varnish]]></category>

		<guid isPermaLink="false">http://kristianlyng.wordpress.com/?p=341</guid>
		<description><![CDATA[Varnish is known to be quite fast. But how fast? My very first Varnish-job was to design a stress testing scheme, and I did so. But it was never really able to push things to the absolute max. Because Varnish is quite fast. In previous posts I&#8217;ve written I about hitting 27k requests per second [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=341&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Varnish is known to be quite fast. But how fast? My very first Varnish-job was to design a stress testing scheme, and I did so. But it was never really able to push things to the absolute max. Because Varnish is quite fast.</p>
<p>In previous posts I&#8217;ve written I about hitting 27k requests per second on an aging Opteron (see ﻿<a href="http://kristianlyng.wordpress.com/2009/10/19/high-end-varnish-tuning/">http://kristianlyng.wordpress.com/2009/10/19/high-end-varnish-tuning/</a>) and then again about reaching 143k requests per second on a more modern quad-core using a ton of test-clients. (see <a href="http://kristianlyng.wordpress.com/2010/01/13/pushing-varnish-even-further/">http://kristianlyng.wordpress.com/2010/01/13/pushing-varnish-even-further/</a>).</p>
<p>Recently, we were going to do a stress test at a customer setup before putting it live. The setup consisted of two dual Xeon x5670 machines. The X5670 is a 2.93GHz six-core cpu with hyperthreading, giving these machines 12 cpu-cores and 24 cpu threads. Quite fast. During our tests, I discovered some httperf secrets (sigh&#8230;). And was able to push things quite far. This is what we learned.</p>
<h2>The hardware and software</h2>
<p>As described above, we only had two machines for the test. One is the target and one would be the originating machine. The network was gigabit.</p>
<p>Varnish 2.1.3 on 64bit Linux.</p>
<p>Httperf for client load.</p>
<h2>The different setups to be tested</h2>
<p>Our goal was not to reach the maximum limits of Varnish, but to ensure the site was ready for production. That&#8217;s quite tricky on many accounts.</p>
<p>The machines were originally configured with heartbeat and haproxy.</p>
<p>One test I&#8217;m quite fond of is site traversal while hitting a &#8220;hot&#8221; set at the same time. The intention is to test how your site fares if a ruthless search bot hits your site. Does your front page slow down? As far as Varnish goes, it tests the LRU-capabilities and how it deals with possibly overloaded backend servers.</p>
<p>We also switched out haproxy in favor of a dual-varnish setup. Why? Two reasons: 1. Our expertise is within the realm of Varnish. 2. Varnish is fast and does keep-alive.</p>
<p>When testing a product like Varnish we also have to take the balance between requests and connections into account. You&#8217;ll see shortly that this is very important.</p>
<p>During our tests, we also finally got httperf to stress the threading model of Varnish. With a tool like siege, concurrency is defined by the threading level. That&#8217;s not the case with httperf, and we were able to do several thousand _concurrent_ connections.</p>
<p>As the test progressed, we reduced the size of the content and it became more theoretical in nature.</p>
<p>As the specifics of the backends is not that relevant, I&#8217;ll keep to the Varnish-specific bits for now.</p>
<p>I ended up using a 301 redirect as a test this time. Mostly because it was there. Towards the end, I had to remove various varnish-headers to free up bandwidth.</p>
<h2>Possible bottlenecks</h2>
<p>The most obvious bottleneck during a test like this is bandwidth. That is the main reason for reducing the size of objects served during testing.</p>
<p>An other bottleneck is how fast your web servers are. A realistic test requires cache misses, and cache misses requires responsive web servers.</p>
<p>Slow clients are a problem too. Unfortunately testing that synthetically isn&#8217;t easy. Lack of test-clients has been an issue in the past, but we&#8217;ve solved this now.</p>
<p>CPU? Traditionally, the cpu-speed isn&#8217;t much of an issue with Varnish, but when you rule out slow backends, bandwidth and slow clients, the cpu is the next barrier.</p>
<p>One thing that&#8217;s important in this test is that the sheer amount of parallel execution threads is staggering. My last &#8220;big&#8221; test had 4 execution threads, this one has 24. This means we get to test contention points that only occur if you have  massive parallelization. The most obvious bottleneck is the acceptor-thread. The thread charged with accepting connections and delegating them to a thread. Even if multiple thread pools is designed to leverage this problem, the actual accept()-call is done in a single thread of execution.</p>
<h2>Connections</h2>
<p>As Artur Bergman of Wikia has already demonstrated, the amount of TCP connections Varnish is able to accept per second is currently our biggest bottleneck. Fortunately for most users, Artur&#8217;s work-load is very different from most other Varnish users. We (Varnish Software) typically see a 1:10 ration between connections and requests. Artur suggested he&#8217;s closer to 1:3 or 1:4.</p>
<p>During this round of tests I was easily able to reach about 40k connections/s. However, going much above that is hard. For a &#8220;normal&#8221; workload, that would allow 400k requests/second, which is more than enough. However, it should be noted that the accept-rate goes somewhat down as the general load increases.</p>
<p>It was interesting to note that this was largely unaffected by having two varnishes in front of each other. This essentially confirms that the acceptor is the bottleneck.</p>
<p>There wasn&#8217;t much we could do to affect this limit either. Increasing the listen_depth isn&#8217;t going to help you in a synthetic test. The listen_depth defines how many outstanding connections is allowed to queue up before the kernel starts dropping them. In the real world, the connection-rate will be sporadic and on an almost-overloaded system, it might help to increase the listen depth, but in a synthetic test the connection rate is close to constant. That means increasing the listen depth just means there&#8217;s a bigger queue to fill &#8211; and it will fill anyway.</p>
<p>The number of thread pools had little effect too. By the time the connection is delegated to a thread pool, it&#8217;s already past the accept() bottleneck.</p>
<p>Now, keep in mind that this is still a staggering number. But it&#8217;s also an obvious bottleneck for us.</p>
<h2>Request rate</h2>
<p>The raw request rate is essentially defined by how big the request is compared to bandwidth, how much CPU power is available and how fast you can get the requests into a thread.</p>
<p>As we have already established that the acceptor-thread is a bottleneck, we needed to up the number of requests per connection. I tested mostly with a 1:10 ratio. This is the result of one such test:</p>
<p><img class="alignnone" title="Request rate" src="http://kristian.bohemians.org/varnish/record/varnish-200k-20k.png" alt="" width="609" height="76" /></p>
<p>The above image shows 202832 requests per second while doing roughly 20 000 connections/s. Quite a number.</p>
<p>It proved difficult to exceed this.</p>
<p>At about 226k req/s the bandwidth limit of 1gbit was easily hit. To reach that, I had to reduce the connection-rate somewhat. The main reason for that, I suspect, is increased latency when the network is saturated.</p>
<p>At this point, Varnish was not saturating the CPU. It still had 30-50% idle CPU power.</p>
<p>Just for kicks and giggles, I wanted to see how far we could really get, so I threw in a local httperf, thereby ignoring large parts of the network issue. This is a screenshot of Varnish serving roughly 1gbit traffic over network and a few hundred mbit locally:</p>
<p><img class="alignnone" title="275k" src="http://kristian.bohemians.org/varnish/record/varnish-275k.png" alt="" width="508" height="36" /></p>
<p>So that&#8217;s 275k requests/s. The connection rate at that point was lousy, so not very interesting. And because httperf was running locally, the load on the machine wasn&#8217;t very predictable. Still, the machine was snappy.</p>
<h2>But what about the varnish+varnish setup?</h2>
<p>The above numbers are for a single Varnish server. However, when we tested with varnish as a load balancer in front of Varnish, the results were pretty identical &#8211; except divided by two.</p>
<p>It was fairly easy to do 100k requests/second on both the load balancer and the varnish server behind it &#8211; even though both were running on the same machine.</p>
<p>The good thing about Varnish as load balancer is the keep alive-nature, speed and flexibility. The contention-point of Varnish is long before any balancing is actually done, so you can have a ton of logic in your &#8220;Varnish Load balancer&#8221; without worrying about load increasing with complexity.</p>
<p>We did, however, discover that the number of HTTP header overflows would spike on the second varnish server. We&#8217;re investigating this. The good news is that it was not visible on the user-side.</p>
<h2>The next step</h2>
<p>I am re-doing part of our internal test infrastructure (or rather: shifting it around a bit) to test the acceptor thread regularly.</p>
<p>I also discovered an assert issue during some sort of race at around 220k req/s, but that was only under certain very very specific situations. It was not possible to reproduce on anything that wasn&#8217;t massively parallel and almost saturated on CPU.</p>
<p>We&#8217;re also constantly improving our test routines both for customer setups and internal quality assurance on the Varnish code base. I&#8217;ve already written several load-generating scripts for httperf to allow us to test even more realistic work loads on a regular basis.</p>
<h2>What YOU should care about</h2>
<p>The <em>only</em> thing that made a real difference while tuning Varnish was the number of threads. And making sure it actually caches.</p>
<p>Beyond that, it really doesn&#8217;t matter much. Our defaults are good.</p>
<p>However, keep in mind that this does NOT address what happens when you start hitting disk. That&#8217;s a different matter entirely.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kristianlyng.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kristianlyng.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kristianlyng.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kristianlyng.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kristianlyng.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kristianlyng.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kristianlyng.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kristianlyng.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kristianlyng.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kristianlyng.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kristianlyng.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kristianlyng.wordpress.com/341/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kristianlyng.wordpress.com/341/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kristianlyng.wordpress.com/341/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=341&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kristianlyng.wordpress.com/2010/10/23/275k-req/feed/</wfw:commentRss>
		<slash:comments>11</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/98ce072867be34c306871f4411ca766b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">kristianlyng</media:title>
		</media:content>

		<media:content url="http://kristian.bohemians.org/varnish/record/varnish-200k-20k.png" medium="image">
			<media:title type="html">Request rate</media:title>
		</media:content>

		<media:content url="http://kristian.bohemians.org/varnish/record/varnish-275k.png" medium="image">
			<media:title type="html">275k</media:title>
		</media:content>
	</item>
		<item>
		<title>The Client director</title>
		<link>http://kristianlyng.wordpress.com/2010/09/28/the-client-director/</link>
		<comments>http://kristianlyng.wordpress.com/2010/09/28/the-client-director/#comments</comments>
		<pubDate>Tue, 28 Sep 2010 19:14:20 +0000</pubDate>
		<dc:creator>Kristian</dc:creator>
				<category><![CDATA[/dev/random]]></category>
		<category><![CDATA[director]]></category>
		<category><![CDATA[informational]]></category>
		<category><![CDATA[Varnish]]></category>

		<guid isPermaLink="false">http://kristianlyng.wordpress.com/?p=334</guid>
		<description><![CDATA[Some time in the middle of the night before 2.1.0, I implemented a director that used the client IP to direct traffic. The goal was to direct the same machine to the same backend &#8211; cheap session stickyness. Took about an hour to hack up and an other to pretty up. Some time during roughly [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=334&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Some time in the middle of the night before 2.1.0, I implemented a director that used the client IP to direct traffic. The goal was to direct the same machine to the same backend &#8211; cheap session stickyness. Took about an hour to hack up and an other to pretty up.</p>
<p>Some time during roughly the same night, PHK refactored all the director infrastructure and in the process implemented a client director and a hash director as a sort of side-job. PHK&#8217;s version obviously entered trunk and mine never saw the light of day (possibly because it was December and there isn&#8217;t much daylight to see here in December anyway). At least the duplicated effort wasn&#8217;t significant.</p>
<p><span style="font-size:13.1944px;">We&#8217;ve kept that somewhat hidden, mostly because the actual code for the hash and client director is about a screenfull of text once the VCL-bits are taken care of. And it&#8217;s such a small feature. Truth be told, they both live within the random director and are just special exceptions. The VCL syntax is the same, except now it&#8217;s called a client director instead of random.</span></p>
<p>The first up, the client director, will use the ascii-representation of the client IP to pick a &#8220;random&#8221; backend. (see why it&#8217;s the ascii representation here: <a href="http://varnish-cache.org/trac/browser/trunk/varnish-cache/bin/varnishd/cache_dir_random.c?rev=5304#L99">http://varnish-cache.org/trac/browser/trunk/varnish-cache/bin/varnishd/cache_dir_random.c?rev=5304#L99</a>)</p>
<p>There isn&#8217;t much to say about it. Your VCL will be the same as if it was a random director. If the &#8220;canonical backend&#8221; for the client is sick, the regular random algorithm will be used to pick a backend from the healthy ones.</p>
<p>In Varnish 2.1.4 you will also get a &#8220;client.identifier&#8221; VCL variable that you can use to tell varnish what identifies this as a unique client. In theory, you could pass a cookie to it and avoid wondering what happens if an IP changes. If it is set, the client director will use that instead of the IP. The only problem I have come up with using that approach is bootstrapping.</p>
<p>He very first request a client makes will have no cookies, so no data can be passed to client.identifier. The backend will presumably set a session-cookie of some sort so the next request could use that session cookie, but that means the first and second request is likely to go to different backends, even if the following requests will all go to the same backend.</p>
<p>Typical load balancers solve this by just setting the cookie them self. I suspect that is what it will come to, and I also suspect that it will be a lot nicer to do that in Varnish 3.0.0 when vmods are in place which could easily deal with these sort of things without messing up your regular VCL&#8230;</p>
<p>But until then, try out the client director for normal IP&#8217;s at least. The client director is available in 2.1.3 (I think it&#8217;s even in 2.1.0, though I can&#8217;t remember. Definitely not documented in 2.1.0, though).</p>
<p>﻿<a href="http://www.varnish-cache.org/docs/trunk/reference/vcl.html#the-client-director">http://www.varnish-cache.org/docs/trunk/reference/vcl.html#the-client-director</a></p>
<p>I&#8217;m very interested in your take on how to deal with sessions, if just basing it on IP is &#8220;close enough&#8221; and if you think the client director will be able to solve most session-stickyness scenarios.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/kristianlyng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/kristianlyng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/kristianlyng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/kristianlyng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/kristianlyng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/kristianlyng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/kristianlyng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/kristianlyng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/kristianlyng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/kristianlyng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/kristianlyng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/kristianlyng.wordpress.com/334/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/kristianlyng.wordpress.com/334/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/kristianlyng.wordpress.com/334/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=kristianlyng.wordpress.com&amp;blog=13096927&amp;post=334&amp;subd=kristianlyng&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://kristianlyng.wordpress.com/2010/09/28/the-client-director/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/98ce072867be34c306871f4411ca766b?s=96&#38;d=http%3A%2F%2F1.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96&#38;r=G" medium="image">
			<media:title type="html">kristianlyng</media:title>
		</media:content>
	</item>
	</channel>
</rss>
