<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
  <link>http://mikewatkins.ca/tags/vps/</link>
  <atom:link href="http://mikewatkins.ca/tags/vps/feeds/rss" type="application/rss+xml" rel="self"/>
  <lastBuildDate>Wed, 11 Mar 2009 03:03:38 GMT</lastBuildDate>
  <title>mike watkins dot ca</title>
  <description>XML Feed for mike watkins dot ca</description>
  <language>en</language>
  <generator>Parlez/0.1</generator>
<item>
  <title>Reducing RAM resource usage on a VPS</title>
  <link>http://mikewatkins.ca/2009/03/10/reducing-ram-resource-usage-on-a-vps/</link>
  <description><![CDATA[
<div class="document">
<p>Here are some miscellaneous notes as I tweak a new virtual private server (VPS). It's a time of fear and wonder as I'm leaving FreeBSD's ample and soft bosom for the as yet unknown pleasures to be found in the arms of my new Debian lover.</p>
<dl class="docutils">
<dt>HTTP Daemon:</dt>
<dd><p class="first">Problem? I think it's self evident.  Yes, I know you can tune Apache and yes, I've been down that road before myself, but nothing I've done to tune Apache beats a simple <tt class="docutils literal"><span class="pre">lighttpd</span></tt> implementation, at least not with my application stack.</p>
<p>Solution: Uninstall Apache. Install <tt class="docutils literal"><span class="pre">lighttpd</span></tt>.</p>
<p>As a bonus, <a class="reference external" href="http://www.lighttpd.net/">lighttpd</a> supports SCGI (and FCGI) natively (to my knowledge, another popular lightweight httpd - <a class="reference external" href="http://nginx.net/">nginx</a> - does not support SCGI natively although contribs are available) which gives you deployment options for a variety of <a class="reference external" href="http://www.djangoproject.com/">popular</a> and <a class="reference external" href="http://www.mems-exchange.org/software/qp/">not so popular</a> Python web application frameworks.</p>
<p>Incidentally, QP deployed with SCGI (whether via <tt class="docutils literal"><span class="pre">lighttpd</span></tt> or Apache <tt class="docutils literal"><span class="pre">httpd</span></tt>) provides a nice combo that would be compatible with a multi-user shared hosting environment.</p>
<p class="last">One of these days I'll get off my but and migrate my weblog over, and enable comments here in doing so, in order that I can satisfy a selfish desire to ask the <em>lazy web</em> if anyone has worked with a reasonable webmail application developed in Python. I'd really like to avoid supporting PHP in the future and at this point I only support PHP for a webmail application.</p>
</dd>
</dl>
<dl class="docutils">
<dt>rsyslogd</dt>
<dd><p class="first">This daemon appears to be the default system logging daemon on Debian; for some reason it uses many times more RAM than the default FreeBSD syslogd, even when it isn't actually doing any remote logging.</p>
<p class="last">Solution: Add a call to <tt class="docutils literal"><span class="pre">ulimit</span> <span class="pre">-s</span> <span class="pre">128</span></tt> in <tt class="docutils literal"><span class="pre">do_start()</span></tt> in <tt class="docutils literal"><span class="pre">/etc/init.d/rsyslog</span></tt> before the daemon is started to reduce the stack size.</p>
</dd>
<dt>DNS</dt>
<dd><p class="first"><tt class="docutils literal"><span class="pre">bind9</span></tt> is a huge monster, something not often needed for a VPS or dedicated server that might need to also be an authoritative name server for a few domains. I'm sure there is some tweaking that can be done to reduce its footprint (no threads?) but for a clean break lets try another.</p>
<p class="last">Solution: <a class="reference external" href="http://www.maradns.org/">MaraDNS</a>. Simple to configure (not that <tt class="docutils literal"><span class="pre">bind</span></tt> is all that hard, but some complain just the same), fast, and small. Config file uses Python syntax (n.b. use &quot;somevalue&quot; rather than single quotes 'some value').</p>
</dd>
</dl>
<p><strong>Total savings so far</strong>: 80 - 120MB (more if one factors in Apache), which is pretty substantial given many low end VPS accounts start at 64 - 128MB of RAM allocation.</p>
</div>

]]></description>
  <guid isPermaLink="false">tag:mikewatkins.ca,2007-10-10:journal:mw:entry:700</guid>
  <pubDate>Wed, 11 Mar 2009 03:03:38 GMT</pubDate>
  <category>debian</category>
  <category>python</category>
  <category>technical</category>
  <category>vps</category>
</item>
</channel></rss>
