<?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:creativeCommons="http://backend.userland.com/creativeCommonsRssModule"
>
<channel>
	<title>G-Loaded Journal &#187; Performance</title>
	<atom:link href="http://www.g-loaded.eu/tag/performance/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.g-loaded.eu</link>
	<description>An open-source software and technology related journal</description>
	<lastBuildDate>Mon, 05 Dec 2011 19:55:24 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
		<item>
		<title>Speed up Apache by including htaccess files into httpd.conf</title>
		<link>http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/</link>
		<comments>http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 05:12:59 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Security]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=2522</guid>
		<description><![CDATA[It is widely known that, if virtual hosts in Apache (httpd) are configured to permit vhost administrators override specific configuration options at the directory level using htaccess files, the web server consumes valuable time in order to check whether an htaccess file exists in every directory included in the requested path and parse it. On [...]]]></description>
			<content:encoded><![CDATA[<p>It is widely known that, if virtual hosts in Apache (httpd) are configured to permit vhost administrators override specific configuration options at the directory level using htaccess files, the web server consumes valuable time in order to check whether an htaccess file exists in every directory included in the requested <em>path</em> and parse it. On the other hand, many popular web applications utilize htaccess files, especially those residing in the <em>DocumentRoot</em>, in order to implement pretty URLs or HTTP redirections, which is extremely convenient since the virtual host owner does not have to edit httpd&#8217;s configuration directly. So, I had the idea to include the htaccess file of the DocumentRoot directory on the filesystem into the virtual host&#8217;s configuration.<br />
<span id="more-2522"></span><br />
Suppose we have the <code>/home/example.org/public_html/</code> directory on the filesystem, which serves as the document root of our virtualhost. The relevant httpd configuration for that vhost would look like this:</p>
<pre class="codesnp">
&lt;VirtualHost 123.123.123.123:80&gt;
  ServerName example.org:80
  ...
  DocumentRoot /home/example.org/public_html
  &lt;Directory /home/example.org/public_html&gt;
    AllowOverride All
    ...
  &lt;/Directory&gt;
  ...
&lt;/VirtualHost&gt;
</pre>
<p>In order to prevent the htaccess lookups on the filesystem without losing the htaccess functionality &#8211; at least at the DocumentRoot level- I transformed the configuration to the following:</p>
<pre class="codesnp">
&lt;VirtualHost 123.123.123.123:80&gt;
  ServerName example.org:80
  ...
  DocumentRoot /home/example.org/public_html
  &lt;Directory /home/example.org/public_html&gt;
    AllowOverride None
    Include /home/example.org/public_html/.htaccess
    ...
  &lt;/Directory&gt;
  ...
&lt;/VirtualHost&gt;
</pre>
<p>Let&#8217;s see what we have accomplished with this:</p>
<ol>
<li>httpd does not waste any time looking for and parsing htaccess files resulting in faster request processing,</li>
<li>the virtual host administrator can still override the configuration options of the document root manually or through the web interface of the web application.</li>
</ol>
<p>Seems like a win-win situation performance and functionality wise.</p>
<p>But, as usual, there is no win-win situation without a downside. In this case, the above trick weakens the server&#8217;s security. Let&#8217;s see how.</p>
<p>Although the configuration of a directory can be set in both <code>httpd.conf</code> and the directory&#8217;s htaccess file, not all directives can be used in both contexts. htaccess files support a subset of the directives that can be used in the <code>Directory</code> context within <code>httpd.conf</code>. By including the htaccess file in httpd&#8217;s configuration the vhost admin is no longer restricted to that subset of directives.</p>
<p>This means that by implementing the above configuration the virtual host administrator is granted more privileges regarding the configuration of the virtual host. This also means that a potential attacker, that would exploit a vulnerability of the web application, would be granted the same privileges once he got write access to that htaccess file.</p>
<p>So, although this trick may seem like a good idea at first, it is in fact a rather <strong>bad idea</strong> and <em>should never be used in production, unless you trust the virtual host administrator and the web application</em>. I do not intend to use such a configuration and I do not recommend it. There are by far better ways to speed up Apache.</p>
<p>Your comments and suggestions are welcome.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/">Speed up Apache by including htaccess files into httpd.conf</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/02/21/htaccess-cheat-sheet/" rel="bookmark">.htaccess Cheat Sheet</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/" rel="bookmark">Use mod_deflate to Compress Web Content delivered by Apache</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/18/using-the-mod_dav_svn-svnparentpath-directive-with-multiple-authz-files/" rel="bookmark">Using the mod_dav_svn SVNParentPath directive with multiple authz files</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>High CPU usage while running CentOS as guest on Virtualbox or VMware</title>
		<link>http://www.g-loaded.eu/2009/12/18/high-cpu-usage-centos-guest-virtualbox-vmware/</link>
		<comments>http://www.g-loaded.eu/2009/12/18/high-cpu-usage-centos-guest-virtualbox-vmware/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 01:30:36 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Kernel]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Virtualbox]]></category>
		<category><![CDATA[Virtualization]]></category>
		<category><![CDATA[VMware]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=1500</guid>
		<description><![CDATA[During the last six months, running a CentOS server as a guest in Virtualbox or VMware has been as common for me as running a web browser. This is because I&#8217;ve constantly been trying to streamline the server configuration and utilize new technologies or techniques attempting to get better performance or just make it easier [...]]]></description>
			<content:encoded><![CDATA[<p>During the last six months, running a <strong>CentOS</strong> server as a guest in <strong>Virtualbox</strong> or <strong>VMware</strong> has been as common for me as running a web browser. This is because I&#8217;ve constantly been trying to streamline the server configuration and utilize new technologies or techniques attempting to get better performance or just make it easier to maintain. The only issue I had to face during all this time was the <strong>high CPU usage</strong> on the host, which in some cases exceeded 40%, even when the guest (CentOS server) was in idle state. At first, I had thought that the host&#8217;s operating system, Windows 7 RC (Release Candidate), was somehow incompatible with Virtualbox/VMware.<br />
<span id="more-1500"></span><br />
It was only a few weeks ago that I decided to investigate the issue and soon I found several reports all around the web. It turned out that the real cause of the problem was the <strong>high frequency</strong> at which the stock CentOS kernel is clocked, <em>1000Hz</em>. Lowering the frequency of the internal clock of the kernel on the guest OS drastically reduced the CPU utilization of the host. At first, this was only possible by recompiling the kernel, but, fortunately, now we can use some boot kernel options to adjust the clock frequency.</p>
<p>For instance, my virtual CentOS server GRUB configuration has the following entry:</p>
<pre class="codesnp">
title CentOS (2.6.18-164.6.1.el5)
    root (hd0,0)
    kernel /vmlinuz-2.6.18-164.6.1.el5 ro root=/dev/VGSERVER/LVROOT divider=10 clocksource=acpi_pm
    initrd /initrd-2.6.18-164.6.1.el5.img
</pre>
<p>The <strong>divider</strong> option adjusts the kernel&#8217;s internal clock by dividing its default frequency by 10. So, my kernel is now clocked at: <code>1000Hz / 10 = 100Hz</code>. Well, that&#8217;s not optimal, but suits my current needs. Until CentOS/RHEL 5.3, this option also served as a workaround for time synchronization between the host and the guest OS. For CentOS 5.4 and later, we just need the &#8220;<em>divider</em>&#8221; in order to <strong>underclock the kernel</strong> without actually recompiling it. Also, the &#8220;<em>clocksource</em>&#8221; option is not required any more.</p>
<p>You can find information about whether the divider option is supported by your distribution by checking the <a href="http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&#038;cmd=displayKC&#038;externalId=1006427">Timekeeping best practices for Linux guests</a> article on the VMware knowledge base.</p>
<p>But, make no mistake. All the above are just a <strong>workaround</strong>. The kernel configuration includes the option to configure it as &#8220;<em>tickless</em>&#8221; (<strong>CONFIG_TICK_ONESHOT</strong> &#038; <strong>CONFIG_NO_HZ</strong>):</p>
<pre class="codesnp">
Processor type and features ---> [*] Tickless System (Dynamic Ticks)
</pre>
<p>From the kernel docs:</p>
<blockquote><p>This option enables a tickless system: timer interrupts only trigger on an as-needed basis both when the system is busy and when the system is idle.</p></blockquote>
<p>This sounds like a <strong>Real Solution&trade;</strong>. I tried to build a minimal kernel (version 2.6.32), using the &#8220;tickless&#8221; feature, specifically for Virtualbox, but, after spending many hours with it, I could not make it recognize my root LVM volumes. So, being extremely frustrated, I abandoned the whole project and used the <em>divider</em> option as I mentioned above.</p>
<p>If anyone has built a minimal custom kernel specifically for Virtualbox or VMware, which supports LVM/RAID and can actually boot a root LVM system, please let me know.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2009/12/18/high-cpu-usage-centos-guest-virtualbox-vmware/">High CPU usage while running CentOS as guest on Virtualbox or VMware</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2007/11/05/howto-run-vmware-on-a-physical-windows-partition/" rel="bookmark">Howto: Run VMWare on a Physical Windows Partition</a></li>
<li><a href="http://www.g-loaded.eu/2011/05/12/running-supervisor-3-on-centos-5/" rel="bookmark">Running supervisor 3 on CentOS 5</a></li>
<li><a href="http://www.g-loaded.eu/2008/12/11/centos-debian-freebsd-opensolaris/" rel="bookmark">CentOS, Debian, FreeBSD, OpenSolaris</a></li>
<li><a href="http://www.g-loaded.eu/2011/02/28/awaiting-centos-6/" rel="bookmark">Awaiting CentOS 6</a></li>
<li><a href="http://www.g-loaded.eu/2009/04/13/install-opensolaris-in-virtualbox-screencast/" rel="bookmark">Install OpenSolaris in VirtualBox &#8211; Screencast</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2009/12/18/high-cpu-usage-centos-guest-virtualbox-vmware/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>How to enable WP-Super-Cache in WordPress</title>
		<link>http://www.g-loaded.eu/2008/11/29/how-to-enable-wp-super-cache-in-wordpress/</link>
		<comments>http://www.g-loaded.eu/2008/11/29/how-to-enable-wp-super-cache-in-wordpress/#comments</comments>
		<pubDate>Sat, 29 Nov 2008 13:45:03 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Cache]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=696</guid>
		<description><![CDATA[It was about time I started using a cache in WordPress. After doing some research, I found out that WP-Super-Cache is sophisticated enough and works quite well, judging by the posts of many satisfied users. In this post I will outline the installation procedure step-by-step, because the installation instructions of the README file were a [...]]]></description>
			<content:encoded><![CDATA[<p>It was about time I started using a cache in WordPress. After doing some research, I found out that <a href="http://ocaoimh.ie/wp-super-cache/">WP-Super-Cache</a> is sophisticated enough and works quite well, judging by the posts of many satisfied users. In this post I will outline the <strong>installation procedure</strong> <em>step-by-step</em>, because the installation instructions of the README file were a bit confusing. I mainly post this for my own reference, but I am almost 100% certain that it will work for you too.<br />
<span id="more-696"></span></p>
<h4>Requirements</h4>
<p>Speaking about <a href="http://httpd.apache.org/">httpd</a> (Apache), the following modules should be loaded:</p>
<pre class="codesnp">
LoadModule rewrite_module modules/mod_rewrite.so
LoadModule expires_module modules/mod_expires.so
LoadModule headers_module modules/mod_headers.so
LoadModule mime_module modules/mod_mime.so
</pre>
<p>The modules above are so standard, that there is high probability that they are already loaded.</p>
<h4>Installation</h4>
<ul>
<li>Before installing WP-Super-Cache, make sure you have properly uninstalled any other caching plugin. This step is not covered by this guide. Please, consult each plugin&#8217;s documentation.</li>
</ul>
<ul>
<li>Download the plugin (<code>wp-super-cache.X.X.X.zip</code>) and unzip it in your plugins directory, so that you have a directory structure like <code>/wp-content/plugins/wp-super-cache/</code>. Assuming you are in the root directory of your website (DocumentRoot):</li>
</ul>
<pre class="console">
cd wp-contents/plugins/
wget http://downloads.wordpress.org/plugin/wp-super-cache.X.X.X.zip
unzip wp-super-cache.X.X.X.zip
rm wp-super-cache.X.X.X.zip
</pre>
<ul>
<li>Make the directory <code>wp-content</code> writeable by the Apache web server. If this is not possible, give write permission to the &#8220;<em>world</em>&#8220;. Do not worry, this is a temporary modification. Permissions will be reverted after we are finished. To enable write access for the the &#8220;<em>world</em>&#8220;:</li>
</ul>
<pre class="console">
chmod o+w wp-content
</pre>
<ul>
<li>Go to the WordPress plugin administration panel and enable <strong>WP Super Cache</strong></li>
<li>Then, edit <code>wp-config.php</code> and make sure you add the following line anywhere above the &#8220;<code>require_once(ABSPATH.'wp-settings.php');</code>&#8221; line</li>
</ul>
<pre class="codesnp">
define( 'WP_CACHE', true );
</pre>
<ul>
<li>Go to the plugin&#8217;s administration panel in WordPress (that will be under the <strong>Settings</strong> menu) and <strong>enable caching</strong> (that is in the very first configuration section &#8220;<em>WP Super Cache Status</em>&#8220;).</li>
<li>Put the mod_rewrite rules in the <strong>.htaccess</strong> file located in the root directory of your website. Make sure you paste them above WordPress&#8217; rewrite rules. The plugin guides you in an excellent way for this, so follow the on-screen instructions. There are also some other settings that need to be placed in <code>wp-content/cache/.htaccess</code>, but these should have been created automatically.</li>
<li>Remove the write permission we had set in a previous step. If you had enabled it for the apache user, then remove it from that user. If you had enabled it for the &#8220;<em>world</em>&#8220;, do the following:</li>
</ul>
<pre class="console">
chmod o-w wp-content
</pre>
<p>The benefits of using the supercache are that your content is delivered fast and the system resources are not wasted. WP-Super-Cache creates and serves static versions (pure HTML) of your webpages and thus php is utilized less and less SQL queries are sent to your database server (MySQL, PostgreSQL, etc).</p>
<p>At this point, the plugin should have started caching your content as you visit web pages. Sit back and enjoy!</p>
<h4>Upgrade WP-Super-Cache</h4>
<p>For step-by-step instructions about how to upgrade WP-Super-Cache to newer versions, please read the &#8220;<em>How to <a href="http://www.g-loaded.eu/2009/03/03/how-to-upgrade-wp-super-cache/">Upgrade WP-Super-Cache</a></em>&#8221; article.</p>
<p>PS: The use of this plugin also implies that I have stopped using my <a href="http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/">Fast-Static-Feed</a> plugin, since wp-supercache caches feeds too.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/11/29/how-to-enable-wp-super-cache-in-wordpress/">How to enable WP-Super-Cache in WordPress</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2009/03/03/how-to-upgrade-wp-super-cache/" rel="bookmark">How to upgrade WP-Super-Cache</a></li>
<li><a href="http://www.g-loaded.eu/2010/09/17/cpu-time-saved-by-wp-super-cache/" rel="bookmark">CPU Time saved by WP-Super-Cache</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/" rel="bookmark">Fast-Static-Feed WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2007/01/27/wordpress-21/" rel="bookmark">WordPress 2.1</a></li>
<li><a href="http://www.g-loaded.eu/2007/01/31/wordpress-meta-tags-plugin-stable-release/" rel="bookmark">WordPress Meta Tags plugin stable release</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/11/29/how-to-enable-wp-super-cache-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Using SSH for networking</title>
		<link>http://www.g-loaded.eu/2008/05/16/using-ssh-for-networking/</link>
		<comments>http://www.g-loaded.eu/2008/05/16/using-ssh-for-networking/#comments</comments>
		<pubDate>Fri, 16 May 2008 00:13:02 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Networking]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=474</guid>
		<description><![CDATA[This is mainly a note to myself about two patches, just in case I ever decide to use OpenSSH for networking, in addition to remote administration. First, is the cipler-none patch that adds none as a valid argument to the -c command line option. By using it, the transferred data is not encrypted. Pros: eliminates [...]]]></description>
			<content:encoded><![CDATA[<p>This is mainly a note to myself about two patches, just in case I ever decide to use <a href="http://www.openssh.org/">OpenSSH</a> for networking, in addition to remote administration.</p>
<p><strong>First</strong>, is the <strong>cipler-none</strong> patch that adds <code>none</code> as a valid argument to the <strong>-c</strong> command line option. By using it, the transferred data is not encrypted. <em>Pros</em>: eliminates the data encryption overhead. <em>Cons</em>: totally insecure method of transferring sensitive data.</p>
<p><a href="http://arctic.org/~dean/patches/openssh-3.8.1p1-cipher-none.patch">cipher-none-patch</a></p>
<p><em>Note</em>: the OpenSSH server, even if it has been patched with this code, does not accept unencrypted connections by default. This has to be enabled explicitly in the sshd configuration (<code>sshd_config</code>) by adding the <em>none</em> &#8220;cipher&#8221; to the list of the accepted ciphers:</p>
<pre class="codesnp">Ciphers aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour,aes192-cbc,aes256-cbc,rijndael-cbc@lysator.liu.se,aes128-ctr,aes192-ctr,aes256-ctr,none</pre>
<p><em>Note2</em>: here is <em>step-by-step</em> guide how to configure the <em><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/">SSH authentication using public keys</a></em>.</p>
<p><strong>Second</strong>, is a set of patches, created at the <a href="http://www.psc.edu/">Pittsburgh Supercomputing Center</a>, which eliminate the bottlenecks caused by some of the internal buffers that control data flow in network connections through OpenSSH. This project is called <a href="http://www.psc.edu/networking/projects/hpn-ssh/">High Performance SSH/SCP</a> (aka <em>HPN-SSH</em>). Benchmarks show that even encrypted network connections using HPN-SSH perform extraordinarily better than the usual encrypted OpenSSH connections.</p>
<p>OK, this info exists here for completeness, as those HPN-SSH patches <em>have not been designed for home networks</em>! Possibly it might make no difference if you use the regular OpenSSH or HPN-SSH in your home LAN.</p>
<p><em>Note</em>: the HPN-SSH patches also contain code that adds the <em>none</em> cipher, similar to the <em>cipher-none patch</em>, so, if you intend to use HPN-SSH, it is not required to apply both on the OpenSSH source.</p>
<p>Finally, apart from all these, if you ever decide to use SSH for networking seriously consider using <a href="http://fuse.sourceforge.net/sshfs.html">SSHfs</a> (see also <a href="http://fuse.sourceforge.net/wiki/index.php/SshfsFaq">SSHfsFAQ</a>).</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/05/16/using-ssh-for-networking/">Using SSH for networking</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2011/09/27/mod_gnutls-rc4-cipher-beast/" rel="bookmark">How to configure mod_gnutls to use the RC4 cipher to mitigate the SSL/TLS vulnerability</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/05/assign-virtual-ips-to-your-nic/" rel="bookmark">Assign Virtual IPs to your NIC</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/ssh-with-keys/" rel="bookmark">Setup the SSH server to use keys for authentication</a></li>
<li><a href="http://www.g-loaded.eu/2005/11/10/encrypt-devices-using-dm-crypt-and-luks/" rel="bookmark">Encrypt devices using dm-crypt and LUKS</a></li>
<li><a href="http://www.g-loaded.eu/2006/11/05/truecrypt-on-2618-kernels/" rel="bookmark">TrueCrypt on 2.6.18 kernels</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/05/16/using-ssh-for-networking/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Fast-Static-Feed WordPress Plugin</title>
		<link>http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/</link>
		<comments>http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/#comments</comments>
		<pubDate>Sat, 10 May 2008 04:44:56 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[Syndication]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=493</guid>
		<description><![CDATA[Syndicated content has almost become the standard way of distributing web content nowadays. WordPress can deliver its content in various different feed formats -RSS 2.0, Atom 1.0, RDF, RSS 0.92- and can generate feeds for both the published posts -grouped by time, category, tag, author etc- and the comments that have been submitted by readers. [...]]]></description>
			<content:encoded><![CDATA[<p>Syndicated content has almost become the standard way of distributing web content nowadays. <a href="http://wordpress.org/">WordPress</a> can deliver its content in various different feed formats -<em>RSS 2.0</em>, <em>Atom 1.0</em>, <em>RDF</em>, <em>RSS 0.92</em>- and can generate feeds for both the <em>published posts</em> -grouped by <em>time</em>, <em>category</em>, <em>tag</em>, <em>author</em> etc- and the <em>comments</em> that have been submitted by readers. Moreover, some <em>RSS add-on modules</em> are being used in the generated feeds, so that modern feed readers can even retrieve the submitted comments for each of the feed entries. It is obvious that all these features greatly enhance the user experience, but, on the other hand, depending on the website&#8217;s traffic they might increase the server load and thus the content delivery times.</p>
<p>Taking these things into consideration, I decided to write <strong><a href="http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/">Fast-Static-Feed</a></strong>, a plugin that can <strong>cache</strong> the site&#8217;s entries feed, and deliver a static XML file instead of constantly generating the feed content on every client request. This, combined with the fact that the web server can <a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/">compress the web content on-the-fly</a>, has greatly reduced the waste of bandwidth and system resources.<br />
<span id="more-493"></span></p>
<h4>How it works</h4>
<p><strong>Fast-Static-Feed</strong> performs the following actions:</p>
<ul>
<li>Every time a post is <strong>published</strong> or an already published post is <strong>edited</strong>, the plugin dumps the <em>entries feed</em> (that is the feed of the blog posts) to a file. This way, the static XML file is always contains the most fresh content of your blog.</li>
<li>Every time a feed is requested, instead of re-generating the XML content over and over, this plugin delivers the static XML file. This is <strong>completely transparent</strong> to the client as there are no HTTP redirects involved. Your content is just being delivered faster!</li>
<li>If the plugin is enabled, but the static files have not been created yet, the plugin will try to generate them automatically. Upon failure to do so, a <code>404 Not Found</code> HTTP error code will be returned to the client.</li>
<li>It also checks if the client&#8217;s request includes the <a href="http://www.g-loaded.eu/2005/10/19/the-if-modified-since-http-header/">If-Modified-Since</a> HTTP header and, in such a case, it checks the static file&#8217;s <strong>modification time</strong>. If the client&#8217;s cache is current, it just returns a <code>304 Not Modified</code> status to further reduce bandwidth usage.</li>
</ul>
<p>The plugin caches all four types of feeds WordPress supports -<em>RSS 2.0</em>, <em>Atom 1.0</em>, <em>RDF</em>, <em>RSS 0.92</em>-.</p>
<p>Only the feeds that contain your blog posts are cached. The comments feed, each individual post&#8217;s comments feed, feeds for categories, tags, authors etc are <strong>still generated dynamically every time they are requested</strong>.</p>
<p>This plugin <strong>does not interefere in any way with the generation of <em>rewrite rules</em> and the generation of your site&#8217;s feed links</strong>.</p>
<h4>Configuration</h4>
<p>Generally, the plugin does not require any configuration in order to work.</p>
<p>One <strong>mandatory prerequisite</strong> is that the <code>wp-content/</code> directory is <strong>writable by the web server</strong>. If it is not, the plugin will not be able to create the static files and, consequently, the clients who request a feed will receive a <code>404 Not Found</code> HTTP code.</p>
<p>Furthermore, there are two options within the source code <code>fast-static-feed.php</code> that can be set.</p>
<pre class="codesnp">
// By default, the WordPress feeds contain elements of the 'wfw' namespace
// (CommentAPI), so a feed reader can fetch each feed entry's comments.
// By setting the following to 1, these elements will be stripped
// from the static feed.
// It is recommended to set this to 1 in order to save bandwidth.
// More info: http://wellformedweb.org/news/wfw_namespace_elements/
$FSF_STRIP_COMMENTS = 0;
// Set the following to 1 and various messages will be recorded in the logfile,
// which is located in the cache dir (wp-content/cache-xml/)
$FSF_DEBUG = 0;
</pre>
<p>It has already been mentioned, but it is important to note it again: The only <strong>mandatory prerequisite</strong> is that <code>wp-content/</code> is <strong>writable by the webserver</strong>.</p>
<h4>Installation</h4>
<p>Make any changes to the configuration options within <code>fast-static-feed.php</code> and upload the file to <code>wp-content/plugins/</code> directory. Then, <strong>activate</strong> the plugin through the WordPress administration panel.</p>
<h4>License</h4>
<p><em>Fast-Static-Feed</em> is an open-source project, released as Free Software under the terms of the <a href="http://www.codetrax.org/licenses/ApacheLicenseV2">Apache License version 2</a>.</p>
<h4>Downloads, Issue Tracking, Support</h4>
<p>For the <strong>latest releases</strong> of <em>Fast-Static-Feed</em> please visit the <a href="http://www.codetrax.org/projects/wp-fast-static-feed/files">downloads</a> section of the <a href="http://www.codetrax.org/projects/wp-fast-static-feed">Fast-Static-Feed Development Portal</a>.</p>
<p>The development website also hosts an <strong>issue tracking</strong> facility, where you can submit your feature requests or report bugs, and <strong>discussion boards</strong>, where you can get first class support from the <em>community of users</em>.</p>
<h4>Donate</h4>
<p>This plugin is released as <strong>free software</strong>. Nevertheless, its development requires time and effort. A small donation, as a sign of appreciation of the effort, is welcome. Please, use the following button to visit the <em>Donations</em> page. Thanks in advance for your support!</p>
<p><a href="http://www.g-loaded.eu/about/donate" title="Donate"><img src="/images/donations_button.png" alt="Donations Button" /></a></p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/">Fast-Static-Feed WordPress Plugin</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/05/08/more-feed-excerpt-wordpress-plugin/" rel="bookmark">More-Feed-Excerpt WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/04/bot-allow-content-wordpress-plugin/" rel="bookmark">Bot-Allow-Content WordPress plugin</a></li>
<li><a href="http://www.g-loaded.eu/2008/11/29/how-to-enable-wp-super-cache-in-wordpress/" rel="bookmark">How to enable WP-Super-Cache in WordPress</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/05/add-meta-tags-wordpress-plugin/" rel="bookmark">Add-Meta-Tags WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/05/my-tags-wordpress-plugin/" rel="bookmark">My-Tags WordPress Plugin</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Use mod_deflate to Compress Web Content delivered by Apache</title>
		<link>http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/</link>
		<comments>http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/#comments</comments>
		<pubDate>Sat, 10 May 2008 00:09:24 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Administration]]></category>
		<category><![CDATA[Apache]]></category>
		<category><![CDATA[Compression]]></category>
		<category><![CDATA[HOWTO]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Servers]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/?p=492</guid>
		<description><![CDATA[One of the most efficient methods to reduce the usage of bandwidth by the web server and, at the same time, increase the speed of the content delivery is to compress your web pages and, generally, all output that is returned to the clients. The compression of the web content can be done using several [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most efficient methods to reduce the usage of bandwidth by the web server and, at the same time, increase the speed of the content delivery is to <strong>compress</strong> your web pages and, generally, all output that is returned to the clients. The compression of the <strong>web content</strong> can be done using several methods. This article describes how to use the <em>mod_deflate</em> module to compress Apache&#8217;s output <em>on-the-fly</em>.<br />
<span id="more-492"></span></p>
<h4>Introducing mod_deflate</h4>
<p>Apache prepares the response that will be sent back to the client in several stages. One of those stages involves the modification or conversion of the data using <strong>output filters</strong>. <em>mod_deflate</em>, once loaded and activated, inserts such a filter, named <strong>DEFLATE</strong>, in Apache&#8217;s chain of <em>output filters</em>, which compresses all data that goes through it according to some rules the web server administator has defined. For instance, one can set the compression level, restrict the compression to particular MIME types or prevent some problematic web browsers or other HTTP clients from receiving compressed data from the server.</p>
<p><em>mod_deflate</em> also offers an input filter which can be used to decompress compressed HTTP requests, but this feature is outside of the scope of the current document.</p>
<p>Here follow some instructions on how to configure <em>mod_deflate</em>. Most of it can be found inside HTTPd&#8217;s official documentation, so you&#8217;d better read this resource as well.</p>
<p>Note that all of the following configuration directives can be inserted in Apache&#8217;s <em>main server context</em> or can be saved to a file that will be loaded from within the main server or any other <em>virtual host context</em>. If the configuration directives are inserted in the main server context, then <strong>they will be inherited by all virtual hosts</strong>.</p>
<h4>Load mod_deflate</h4>
<p><em>mod_deflate</em> can be loaded like any other Apache module:</p>
<pre class="codesnp">
LoadModule deflate_module modules/mod_deflate.so
</pre>
<p>Please note that <strong>this directive can only exist in the main server configuration</strong>.</p>
<h4>Enable Compression</h4>
<p>The compression of the data can be enabled <strong>for all data</strong> that goes through the <em>DEFLATE</em> filter or <em>selectively</em> depending on its <strong>MIME type</strong>.</p>
<p>To enable the compression <strong>for any type of content</strong>, insert the following directive:</p>
<pre class="codesnp">
 SetOutputFilter DEFLATE
</pre>
<p>Alternatively, to define which filetypes should pass through the <em>DEFLATE</em> output filter use the  <strong>AddOutputFilterByType</strong> directive. The following is an example:</p>
<pre class="codesnp">
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</pre>
<h4>Set the Compression Level</h4>
<p>Generally, the <a href="http://en.wikipedia.org/wiki/DEFLATE_(algorithm)">deflate compression algorithm</a> is fast enough, so setting the compression level to the maximum (9) will not cause any noticeable trouble, even to relatively old hardware.</p>
<pre class="codesnp">
DeflateCompressionLevel 9
</pre>
<h4>Custom Rules for problematic browsers</h4>
<p>The compression can be turned-off or be restricted to files of type <code>text/html</code> for known problematic web browsers. These are taken from the official documentation.</p>
<pre class="codesnp">
BrowserMatch ^Mozilla/4 gzip-only-text/html
BrowserMatch ^Mozilla/4\.0[678] no-gzip
BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
</pre>
<h4>Keep track of the compression</h4>
<p>Finally you can keep track of the compression in order to evaluate the effectiveness of the use of <em>mod_deflate</em> in your server.</p>
<p>The following directives define some variables, such as:</p>
<ul>
<li><strong>instream</strong> : the size in bytes of the data as received by the <em>DEFLATE</em> filter.</li>
<li><strong>outstream</strong> : the size in bytes of the compressed data as returned from the <em>DEFLATE</em> filter.</li>
<li><strong>ratio</strong> : the compression ratio, <code>(Output/Input)x100</code></li>
</ul>
<pre class="codesnp">
DeflateFilterNote Input instream
DeflateFilterNote Output outstream
DeflateFilterNote Ratio ratio
</pre>
<p>Finally, you can define a custom <em>logformat</em> so to be able to record the aforementioned values to a logfile:</p>
<pre class="codesnp">
LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
</pre>
<p>The deflate logformat can be used for the main server&#8217;s or for any vhost;s logfile.</p>
<h4>Effectiveness of Compression</h4>
<p>It is well known that not all document types can benefit the same from compression. Generally, the <em>deflate algorithm</em> can compress <strong>text</strong> surprisingly fast and with a very high efficiency ratio. On the other hand, it is almost useless when used to compress <strong>images</strong> which have been prepared for the web such as PNG, JPEG, GIF and generally all other image types in which the data has already been compressed. The same goes for compressed <strong>audio</strong> files, such as MP3, AAC, OGG, <strong>videos</strong>, <strong>PDF</strong> documents and all other already compressed files.</p>
<p>So, the benefits of using <em>mod_deflate</em> to reduce the bandwidth usage and speed up the content delivery are heavily dependent on the type of files your web server delivers.</p>
<h4>Browser Support</h4>
<p>A web server that sends compressed data to clients would be completely useless if the HTTP clients couldn&#8217;t decompress that data. All modern and popular web browsers support accepting content that has been compressed using the <em>gzip</em> or <em>deflate</em> algorithms, so there should be no problem at all.</p>
<h4>Appendix I</h4>
<p>Here is the complete <em>mod_deflate</em> configuration as described in this <span style="color:black;text-decoration:none;"><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/">article</a></span>. Save it in a file, named <strong>deflate.conf</strong> and import it in the main server&#8217;s configuration using the <strong>Include</strong> directive</p>
<p>(<code>Include /path/to/deflate.conf</code>):</p>
<pre class="codesnp">
#
# mod_deflate configuration
#
LoadModule deflate_module modules/mod_deflate.so
&lt;IfModule mod_deflate.c&gt;
        AddOutputFilterByType DEFLATE text/plain
        AddOutputFilterByType DEFLATE text/html
        AddOutputFilterByType DEFLATE text/xml
        AddOutputFilterByType DEFLATE text/css
        AddOutputFilterByType DEFLATE application/xml
        AddOutputFilterByType DEFLATE application/xhtml+xml
        AddOutputFilterByType DEFLATE application/rss+xml
        AddOutputFilterByType DEFLATE application/javascript
        AddOutputFilterByType DEFLATE application/x-javascript
        DeflateCompressionLevel 9
        BrowserMatch ^Mozilla/4 gzip-only-text/html
        BrowserMatch ^Mozilla/4\.0[678] no-gzip
        BrowserMatch \bMSIE !no-gzip !gzip-only-text/html
        DeflateFilterNote Input instream
        DeflateFilterNote Output outstream
        DeflateFilterNote Ratio ratio
        LogFormat '"%r" %{outstream}n/%{instream}n (%{ratio}n%%)' deflate
&lt;/IfModule&gt;
</pre>
<p>This configuration will be <strong>inherited by all virtual hosts</strong>.</p>
<p>To <strong>disable</strong> it just comment out the line that loads the mod_deflate module (<code>#LoadModule ...</code>).</p>
<p>To record <em>mod_deflate</em>&#8216;s specific variable (<em>instream</em>, <em>outstream</em>, <em>ratio</em>) values for a virtual host, just add a new log file of type <em>deflate</em>:</p>
<pre class="codesnp">
CustomLog /path/to/vhost/logs/deflate_log deflate
</pre>
<p>This will give you an idea of how efficient is the use of mod_deflate in that particular vhost.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/">Use mod_deflate to Compress Web Content delivered by Apache</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/" rel="bookmark">Optimize and Compress CSS Files</a></li>
<li><a href="http://www.g-loaded.eu/2007/08/10/ssl-enabled-name-based-apache-virtual-hosts-with-mod_gnutls/" rel="bookmark">SSL-enabled Name-based Apache Virtual Hosts with mod_gnutls</a></li>
<li><a href="http://www.g-loaded.eu/2010/03/28/script-apache-error-report/" rel="bookmark">Script for Apache Error Report</a></li>
<li><a href="http://www.g-loaded.eu/2011/11/28/speed-up-apache-by-including-htaccess-files-into-httpd-conf/" rel="bookmark">Speed up Apache by including htaccess files into httpd.conf</a></li>
<li><a href="http://www.g-loaded.eu/2006/10/06/check-server-http-headers-with-curl/" rel="bookmark">Check Server HTTP Headers with CURL</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>Optimize and Compress CSS Files</title>
		<link>http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/</link>
		<comments>http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/#comments</comments>
		<pubDate>Mon, 04 Dec 2006 21:39:02 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Optimization]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[Web]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/</guid>
		<description><![CDATA[Usually, when writing or modifying a CSS file, the author adds comments and excessive indentation to the code in order to preserve its readability and to simplify maintenance. Although this might be a good habit, all those extra bits stored into the CSS file increase its filesize, often resulting in unnecessary waste of bandwidth, especially if such a file is used in a production web site. Today, I decided to search for tools that can perform compression and optimization of a CSS file.]]></description>
			<content:encoded><![CDATA[<p>Usually, when writing or modifying a <abbr title="Cascading Style Sheets">CSS</abbr> file, the author adds comments and excessive indentation to the code in order to preserve its readability and to simplify maintenance. Although this might be a good habit, all those extra bits stored into the CSS file increase its filesize, often resulting in unnecessary waste of bandwidth, especially if such a file is used in a production web site. Today, I decided to search for tools that can perform <strong>compression</strong> and <strong>optimization</strong> of a CSS file.<br />
<span id="more-315"></span><br />
A command line utility, called <a href="http://csstidy.sourceforge.net/">CSSTidy</a>, seems to be one of the best out there. It&#8217;s <em>open-source</em> software, released under the GPL, and, judging by the optimization results on this web site&#8217;s CSS, I can say it does a good job. Although the source code is available for download, I used the pre-compiled Linux binary.</p>
<p>Before proceeding, make sure you have backed up your current non-optimized style-sheet. CSSTidy will not touch your original file, but taking some precautions is a good habit.</p>
<p>Launch csstidy without arguments for a rather short description of the command line switches:</p>
<pre class="console">csstidy</pre>
<p>Although it is possible to define each parameter individually, some pre-defined templates are what you will most probably use. These include: <code>low</code>|<code>high</code>|<code>highest</code>. The higher the optimization level, the smaller the CSS filesize. More on templates <a href="http://csstidy.sourceforge.net/templates.php">here</a>.</p>
<p>I tried the <code>high</code> and <code>highest</code> templates. The latter produces a style sheet that contains all code in a single line, but that file would not <a href="http://jigsaw.w3.org/css-validator/">validate</a>, so I used the <code>high</code> template:</p>
<pre class="console">csstidy style.css --template=high style.css.out</pre>
<p>The compression ratio for my file was <code>34.86%</code> which was quite satisfactory. Also, the final file validated properly.</p>
<p>CSSTidy does a good job either you want to optimize the stylesheet for readability or for filesize. On the other hand, the CLI interface does not provide enough information about each of the CLI switches. They are pretty self-explanatory, but I guess a little description for each one of them wouldn&#8217;t hurt anyone. Also, I could not make the &#8220;<code>--remove_last_;</code>&#8221; option to work.</p>
<p>The only difference I could notice in my stylesheets between the <code>high</code> and the <code>highest</code> templates was that the whole code was squeezed in a single line when <code>highest</code> was used. Probably, this template performs some more optimizations than just deleting the line-feed characters, but it seems that there was nothing else that could be optimized in my CSS file.</p>
<p>Apart from this command line utility, there are also a lot of online CSS optimizers. I didn&#8217;t have the time to try them all, but I think I can recommend the following:</p>
<ul>
<li><a href="http://www.cleancss.com/">Clean CSS</a> &#8211; this seems to be the PHP version of CSSTidy. Everything seems to work as expected and the results are the same as before.</li>
<li><a href="http://iceyboard.no-ip.org/projects/css_compressor">Icey CSS Compressor</a> &#8211; This is another web-based CSS optimizer which performs very well. By using the default settings you get a single line with highly optimized CSS code. The compression ratio is similar to CSSTidy&#8217;s. In order to separate each selector with a line-feed character, so that the final CSS validates, you can pass the optimized CSS through <code>sed</code>:
<pre class="console">sed -i 's/}/}\n/g' style.css.out</pre>
</li>
</ul>
<p>If anyone knows about any other utility I would be very glad to know about.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/">Optimize and Compress CSS Files</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/05/10/use-mod_deflate-to-compress-web-content-delivered-by-apache/" rel="bookmark">Use mod_deflate to Compress Web Content delivered by Apache</a></li>
<li><a href="http://www.g-loaded.eu/2007/12/01/veritar-verify-checksums-of-files-within-a-tar-archive/" rel="bookmark">VeriTAR &#8211; Verify checksums of files within a TAR archive</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/03/how-to-annotate-pdf-files-in-linux-using-xournal/" rel="bookmark">How to annotate PDF files in Linux using Xournal</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/14/creative-commons-configurator-wordpress-plugin/" rel="bookmark">Creative-Commons-Configurator WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2007/07/10/wordpress-221-bugs/" rel="bookmark">WordPress 2.2.1 bugs</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/12/04/optimize-and-compress-css-files/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
		<item>
		<title>WordPress Performance</title>
		<link>http://www.g-loaded.eu/2006/09/10/wordpress-performance/</link>
		<comments>http://www.g-loaded.eu/2006/09/10/wordpress-performance/#comments</comments>
		<pubDate>Sat, 09 Sep 2006 22:56:24 +0000</pubDate>
		<dc:creator>George Notaras</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Applications]]></category>
		<category><![CDATA[Performance]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Remote]]></category>
		<category><![CDATA[RRDtool]]></category>
		<category><![CDATA[Wordpress]]></category>
		<guid isPermaLink="false">http://www.g-loaded.eu/2006/09/10/wordpress-performance/</guid>
		<description><![CDATA[Some months ago, I had a talk on IRC with someone who had created a useful plugin for WordPress, which shows performance related information. The plugin is called Performance Probe. Its output is saved in text files. I had written a quick python script, for demonstration purposes only, that uses performance probe&#8217;s output and RRDTool [...]]]></description>
			<content:encoded><![CDATA[<p>Some months ago, I had a talk on IRC with someone who had created a useful plugin for WordPress, which shows performance related information. The plugin is called <a href="http://libertini.net/libertus/wordpress-plugins/performance-probe/">Performance Probe</a>. Its output is saved in text files. I had written a quick python script, for demonstration purposes only, that uses performance probe&#8217;s output and <a href="http://oss.oetiker.ch/rrdtool/">RRDTool</a> to create a performance graph with WP loading times. The created RRA keeps data of one hour. This script is located <a href="http://www.g-loaded.eu/packages/wpperf/">here</a>.</p>
<p>Information about its usage can be found inside the script. It is completely unsupported and it will not be further developed.</p>
<p><em>Special Note</em>: My script visits the blog 60 times/hour, so do not run it on a production blog, unless you have adjusted your web server statistics analysis software to ignore those visits.</p>
<div class="cc-block"><em><a href="http://www.g-loaded.eu/2006/09/10/wordpress-performance/">WordPress Performance</a></em>, unless otherwise expressly stated, is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/3.0/">Creative Commons Attribution-Noncommercial-Share Alike 3.0 Unported License</a>. Terms and conditions beyond the scope of this license may be available at <a href="http://www.g-loaded.eu/about/disclaimer-and-license/">www.g-loaded.eu</a>.</div>
<h4>Related Articles</h4>
<ul><li><a href="http://www.g-loaded.eu/2008/05/10/fast-static-feed-wordpress-plugin/" rel="bookmark">Fast-Static-Feed WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/14/creative-commons-configurator-wordpress-plugin/" rel="bookmark">Creative-Commons-Configurator WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2008/03/31/wordpress-25-plugin-compatibility/" rel="bookmark">WordPress 2.5 &#8211; Plugin Compatibility</a></li>
<li><a href="http://www.g-loaded.eu/2008/05/08/more-feed-excerpt-wordpress-plugin/" rel="bookmark">More-Feed-Excerpt WordPress Plugin</a></li>
<li><a href="http://www.g-loaded.eu/2006/01/04/bot-allow-content-wordpress-plugin/" rel="bookmark">Bot-Allow-Content WordPress plugin</a></li></ul>]]></content:encoded>
			<wfw:commentRss>http://www.g-loaded.eu/2006/09/10/wordpress-performance/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	<creativeCommons:license>http://creativecommons.org/licenses/by-nc-sa/3.0/</creativeCommons:license>
	</item>
	</channel>
</rss>

