<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xml:base="http://www.hermann-uwe.de" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
 <title>Uwe Hermann - How to run 65535 web servers on a single laptop - Comments</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop</link>
 <description>Comments for &quot;How to run 65535 web servers on a single laptop&quot;</description>
 <language>en</language>
<item>
 <title>But in that&#039;s not the point</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78064</link>
 <description>&lt;p&gt;If I understood correctly, the idea was to run 65536 webservers at the same time, and using just one and vhosts takes all the fun about the idea :-)&lt;br /&gt;
Probably it wasn&#039;t efficient, but i&#039;m sure it was &quot;fun&quot; (or something)&lt;/p&gt;
</description>
 <pubDate>Fri, 21 Aug 2009 18:54:29 +0200</pubDate>
 <dc:creator>Mauro</dc:creator>
 <guid isPermaLink="false">comment 78064 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>&gt;65535 servers?</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78035</link>
 <description>&lt;p&gt;If you want more then 65535 servers (lets face it - who doesn&#039;t) try running additional servers on other ip addresses.  There are lots of those especially when using IPv6.  :-)&lt;/p&gt;
&lt;p&gt;The steps are left as an exercise to the reader.&lt;/p&gt;
</description>
 <pubDate>Thu, 20 Aug 2009 05:38:21 +0200</pubDate>
 <dc:creator>More</dc:creator>
 <guid isPermaLink="false">comment 78035 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>bash</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78028</link>
 <description>&lt;p&gt;Fixed, thanks.&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Aug 2009 23:51:57 +0200</pubDate>
 <dc:creator>Uwe Hermann</dc:creator>
 <guid isPermaLink="false">comment 78028 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>benchmarks</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78027</link>
 <description>&lt;p&gt;That&#039;s left as an excercise for the reader :-)&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Aug 2009 23:50:17 +0200</pubDate>
 <dc:creator>Uwe Hermann</dc:creator>
 <guid isPermaLink="false">comment 78027 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>bashism</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78024</link>
 <description>&lt;p&gt;s,/bin/sh,/bin/bash,&lt;br /&gt;
The arithmetic syntax you are using is not required by SUSv3, it&#039;s a bashism.&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Aug 2009 21:06:08 +0200</pubDate>
 <dc:creator>Raphael Geissert</dc:creator>
 <guid isPermaLink="false">comment 78024 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>OK, now how well do they</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78021</link>
 <description>&lt;p&gt;OK, now how well do they stand up to apachebench? ;)&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Aug 2009 19:28:34 +0200</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 78021 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>Howto visit a site on</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78020</link>
 <description>&lt;p&gt;Howto visit a site on localhost with no TCP Ports available?&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Aug 2009 16:10:40 +0200</pubDate>
 <dc:creator>Florian Bender</dc:creator>
 <guid isPermaLink="false">comment 78020 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>the loop can much shorter</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78019</link>
 <description>&lt;p&gt;the loop can much shorter :)&lt;/p&gt;
&lt;p&gt;for i in {1..300}; do&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Aug 2009 15:46:34 +0200</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 78019 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>just use vhosting</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comment-78018</link>
 <description>&lt;p&gt;Would be a lot more efficient to bind a single lighttpd instance to all the ports and use vhosting ...&lt;/p&gt;
</description>
 <pubDate>Wed, 19 Aug 2009 15:18:24 +0200</pubDate>
 <dc:creator>Anonymous</dc:creator>
 <guid isPermaLink="false">comment 78018 at http://www.hermann-uwe.de</guid>
</item>
<item>
 <title>How to run 65535 web servers on a single laptop</title>
 <link>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop</link>
 <description>&lt;p&gt;OK, so here&#039;s what crazy computer geeks come up with when they&#039;re bored of just sitting in the subway and staring out of the window.&lt;/p&gt;
&lt;p&gt;Web servers usually run on port 80. &lt;a href=&quot;http://en.wikipedia.org/wiki/TCP_and_UDP_port&quot;&gt;TCP/UDP ports&lt;/a&gt; range from 1 to 65535 (&lt;a href=&quot;http://www.faqs.org/rfcs/rfc1700.html&quot;&gt;port 0 is reserved&lt;/a&gt;). You can run multiple web servers on different ports at the same time... Do you think what I think?&lt;/p&gt;
&lt;p&gt;Well, first you need a web server (duh). I decided to use &lt;a href=&quot;http://www.lighttpd.net/&quot;&gt;lighttpd&lt;/a&gt;, as it&#039;s said to be small and memory-efficient (which sounded pretty important given what I was trying to do). Apache would probably not be a good choice here. Mind you, I have &lt;em&gt;not&lt;/em&gt; done any benchmarks at all, I&#039;m just guessing...&lt;/p&gt;
&lt;pre&gt;
  $ &lt;strong&gt;apt-get install lighttpd&lt;/strong&gt;
&lt;/pre&gt;&lt;p&gt;
Then, I wrote a little shell script containing a loop, which invoked lighttpd on port 1, 2, 3, 4, ..., 65535. That&#039;s it ;)&lt;/p&gt;
&lt;pre&gt;
  #!/bin/bash
  TMPDIR=/tmp
  CONFFILE=&quot;server.document-root       = \&quot;/var/www/\&quot;
           index-file.names           = ( \&quot;index.html\&quot; )&quot;
  for ((i = 1; i &lt; 300; i = i + 1)) do
    echo &quot;+++ Starting web server on port $i&quot;
    echo $CONFFILE &gt; $TMPDIR/lighttpd.conf
    echo &quot;server.port = $i&quot; &gt;&gt; $TMPDIR/lighttpd.conf
    /usr/sbin/lighttpd -f $TMPDIR/lighttpd.conf
    rm -f $TMPDIR/lighttpd.conf
  done 
&lt;/pre&gt;&lt;p&gt;
I&#039;m sure this can be optimized a lot, but it&#039;s sufficient for now, and it works.&lt;/p&gt;
&lt;p&gt;You can test any of the web servers by running &quot;&lt;code&gt;wget http://localhost:3556/&lt;/code&gt;&quot; (for example). You can kill them all with &lt;code&gt;killall lighttpd&lt;/code&gt;. If you already run some other daemons on some ports, you cannot start a lighttpd on the same port, so you&#039;ll end up with fewer than 65535 servers.&lt;/p&gt;
&lt;p&gt;In case you try this on your hardware, make sure you have lots of RAM and lots of swap. Don&#039;t run this on production hardware. Feel free to post your experiences in the comments.&lt;/p&gt;
</description>
 <comments>http://www.hermann-uwe.de/blog/how-to-run-65535-web-servers-on-a-single-laptop#comments</comments>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1475">65535</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/271">crazy</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1479">daemon</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/53">funny</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/203">laptop</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1478">lighttpd</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/989">port</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1190">script</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/845">shell</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1476">web server</category>
 <category domain="http://www.hermann-uwe.de/taxonomy/term/1477">webserver</category>
 <pubDate>Wed, 19 Aug 2009 14:36:03 +0200</pubDate>
 <dc:creator>Uwe Hermann</dc:creator>
 <guid isPermaLink="false">1499 at http://www.hermann-uwe.de</guid>
</item>
</channel>
</rss>
