W3 Total Cache vs. WP Super Cache

Two of the most popular Word Press performance plugins are W3 Total Cache (W3TC) and WP Super Cache (WPSC). W3TC provides a collection of different features including page caching, minification, database object caching and transparent CDN integration, whereas WPSC focuses specifically at caching generated HTML. W3TC has integration with CloudFlare, provided by DreamHost, but DreamHost’s default install of WordPress includes WPSC instead, reportedly because W3TC consumes more memory, at a premium in a shared hosting environment.

To see what worked best for my current site I started by running LoadImpact against my unoptimized site:

Image(5)

Image(6)

Time to generate the HTML text is awful.

Next I enabled W3TC and applied what I thought were reasonable settings. The result of a second load test was not what I expected:

Image(7)

Image(8)

Although overall average load times were reduced slightly they were also more erratic, some page loads occurring faster, and others much slower.  At least time to generate HTML is improved.

Next I disabled W3TC and tried WPSC with the recommended defaults:

Image(9)

Image(10)

Although there are hints of a performance drop with more users the page load performance is consistently better.  The impact on HTML generation is dramatic.  For now I think I’m going to stick with WPSC and look for other ways to optimize my CSS load times.

Installing PostgreSQL on Lion

Lion comes with a _postgres system account and PostgreSQL 9.0.4 client tools already installed. Lion Server includes PostgreSQL server, which replaces the MySQL server distributed with earlier versions of OS X. If you want to add PostgreSQL server to a regular Lion installation the easiest way to do this is probably using the EnterpriseDB installer. However, I was inspired by a couple of posts at devoh.com to compile and install it manually:

curl -O http://ftp.postgresql.org/pub/source/v9.0.4/postgresql-9.0.4.tar.bz2
tar xzvf postgresql-9.0.4.tar.bz2
cd postgresql-9.0.4
./configure --enable-thread-safety --with-bonjour
make
sudo make install

To create a database:

sudo mkdir /usr/local/pgsql/data
sudo chown _postgres:_postgres /usr/local/pgsql/data
cd /usr/local/pgsql/bin
sudo -u _postgres ./initdb -D /usr/local/pgsql/data -U postgres -W -A md5 -E UNICODE

To manage PostgreSQL server with OS X launchctl create /Library/LaunchDaemons/org.postgresql.postmaster.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
  <dict>
    <key>Label</key>
    <string>org.postgresql.postmaster</string>

    <key>RunAtLoad</key>
    <true />

    <key>UserName</key>
    <string>_postgres</string>

    <key>GroupName</key>
    <string>_postgres</string>

    <key>EnvironmentVariables</key>
    <dict>
      <key>PGDATA</key>
      <string>/usr/local/pgsql/data</string>
    </dict>

    <key>ProgramArguments</key>
    <array>
      <string>/usr/local/pgsql/bin/postmaster</string>
    </array>

    <key>StandardOutPath</key>
    <string>/usr/local/pgsql/logfile</string>

    <key>StandardErrorPath</key>
    <string>/usr/local/pgsql/logfile</string>
  </dict>
</plist>


chmod 644 /Library/LaunchDaemons/org.postgresql.postmaster.plist

To load the new launch agent and start up the server for the first time:

sudo launchctl load /Library/LaunchDaemons/org.postgresql.postmaster.plist

If you need to restart the daemon, use the following commands:

sudo launchctl stop org.postgresql.postmaster
sudo launchctl start org.postgresql.postmaster

BoxGrinder Chef

BoxGrinder is a JBoss Community project to build appliances based on Fedora, Red Hat and/or CentOS. It appears to build on an earlier project called ThinCrust.  It takes a simple BoxGrinder appliance configuration (‘.appl’) file and uses it to generate a Red Hat kickstart file, which it then uses to build a KVM VM. Additional plugins can then convert the VM to other formats like Amazon EC2 AMI.  BoxGrinder itself is supported on Fedora only, though it can create CentOS 5 appliances.  As of writing a critical bug stops BoxGrinder from building CentOS 6.x images.

The best way to build appliances for Amazon EC2 is to use the provided BoxGrinder meta-appliance AMI to create an EC2 instance:  BoxGrinder meta works best with at least 2G RAM to build i386 appliances.

I created a basic appliance with the Chef client preinstalled by using an appliance definition file as follows:

name: CentOS-chef
summary: "CentOS RBEL Chef"
version: 1
release: 1
hardware:
  partitions:
    "/":
      size: 4
os:
  name: centos
  version: 5
packages:
  - ruby-devel
  - rubygem-chef
repos:
  - name: "rbel5"
    baseurl: "http://rbel.frameos.org/stable/el5/#BASE_ARCH#/"
    ephemeral: true
  - name: "epel"
    baseurl: "http://download.fedoraproject.org/pub/epel/#OS_VERSION#/#BASE_ARCH#/"

Having gems pre-converted to RPMs is better than trying to use gem install during build post-processing.

Configuring the EC2 plugin is done in ~/.boxgrinder/config after which the appliance can be built with

export LIBGUESTFS_MEMSIZE=2048
boxgrinder-build CentOS-chef.appl -p ec2 -d ebs -b --debug

Chef 0.10 on CentOS 5.x

My experience with Chef on CentOS 5 recently confirmed this is still a beta product. The bootstrap instructions are incomplete, leaving you hanging half-way down the page at "CentOS 5.x users will need to have version 4.2 or better of gcc in order for this to function. This may be a newer version of gcc than that which is installed via yum."  To finish the installation detour to this page that provides links to the FrameOS RBEL repository and installation instructions for the Chef server that worked for me. After completing the server install return to Bootstrap instructions and resume from ‘Verify All Components are Running’.

OpenSolaris is Dead

Looks like concerns about Oracle’s Sun acquisition are being fulfilled.  After suing Google using a loophole in the Java license and losing James Gosling Oracle has now cut back significantly on the openness of Solaris development.  Whether or not this was a good business decision this is surely damaging to Oracle’s reputation amongst supporters of FOSS, and great news for Microsoft.  Like MySQL and MariaDB there is already now a community effort sponsored by Nexenta to fork OpenSolaris outside Oracle.

Resizing an LVM swap partition

I tested this on a lightly loaded Ubuntu 8.04 server.

free
swapoff /dev/vg01/lv_swap
lvextend -L+500M /dev/vg01/lv_swap
grep swap /etc/fstab # find the UUID for the existing swap space
# remake the larger swap using the same UUID as before
mkswap -U fc7f369e-c655-4a35-a227-a7c725a2b9bc  /dev/vg01/lv_swap
swapon /dev/vg01/lv_swap
free

linux-iscsi with NetApp

SLES includes an iSCSI initiator, linux-iscsi.  The initiator is configured using a daemon that is managed just like any other service, with a script in /etc/init.d/ and configuration files in /etc. After installing linux-iscsi using YaST I edited /etc/iscsi.conf to set the DiscoveryAddress and ran ‘/etc/init.d/iscsi start’ to start the service (‘chkconfig iscsi on’ ensures it is restarted after a reboot also). Logging onto my NetApp filer I could see the SLES initiator also logged in (‘igroup show’), and was able to create and map a LUN to the host. Back on the host ‘iscsi-ls’ yielded nothing useful, so I downloaded and installed the linux host utilities from NetApp’s support site.  ‘sanlun show all’ now shows the lun-pathname and local SCSI devicename (eg. /dev/sdx) to which it is mapped. Oracle’s Orion benchmark  indicates a random I/O throughput dramatically better for the iSCSI LUN compared to using a VMware virtual disk.

Building a Tomcat 6 Appliance

TurnKey have done a great job of putting together a collection of open source software appliances using Ubuntu JeOS 8.04.  Unfortunately TurnKey’s Tomcat appliance uses only Tomcat 5.5, instead of Tomcat 6 featuring Servlet 2.5 and JSP 2.1 support, which was released in March 2007.  On the plus side, however, Turnkey have also published their appliance core, which you can use as the basis of your own appliances.  The core includes Webmin at port 12321 and SSH.  Turnkey appliances are distributed with no password for root so make sure to set it as as possible.  The hostname for Turnkey Core is ‘core’, but that can be changed by editing /etc/hostname.

Tomcat 6 has been backported to Ubuntu 8.04, so it is easy to add, just edit /etc/apt/sources.list.d/sources.list and uncomment hardy-backports universe, then:

apt-get update
apt-get install tomcat6 # ~70MB

Note Tomcat6 is run with CATALINA_HOME set to /usr/share/tomcat6 and CATALINA_BASE set to /var/lib/tomcat6. If you read the Tomcat RUNNING.txt doc (available at /usr/share/doc/tomcat6-common/RUNNING.txt.gz) you’ll see that Tomcat6 is looking for libraries in CATALINA_HOME/lib and not CATALINA_BASE/lib. Since it is ignored, the presence of a CATALINA_BASE/lib directory is, at best, confusing.

Tomcat defaults to port 8080 and 8443.  As Tomcat is being run on the appliance as root we can change the ports to 80 and 443 by editing /etc/tomcat6/server.xml.

The tomcat service is managed using /etc/init.d/tomcat6 [start|stop], not bin/shutdown.sh.  Remember to turn off tomcat security or configure it for each application.  Turning off security is done by editing  /etc/init.d/tomcat6 and changing TOMCAT6_SECURITY=no.

There is a tomcat6-admin package also, but I do not use, and have not tested it.  To deploy a war file I simply copy it into /var/lib/tomcat6/webapps, eg.

apt-get install wget
cd /var/lib/tomcat6/webapps
wget http://.../...jar

Installing Oracle XE on Ubuntu

Oracle XE is available for 32-bit architecture (i386) Linux only, although it may be possible to force installation on a 64-bit host. It will run in 512KB RAM but requires a 1GB swap space. Add:

deb http://oss.oracle.com/debian unstable main non-free

to /etc/apt/sources.list and then as root:

wget http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | sudo apt-key add - apt-get update apt-get install oracle-xe

‘libaio’ and ‘bc’ are in the repository, so dependencies will pull them in if the user doesn’t have them.

Subversion on Ubuntu – Multiple Repositories

Eighteen months have passed since I setup Subversion on Ubuntu and I’ve found multiple repositories are valuable for providing finer grained access control and easier storage management. Here is a revised incantation:

su -
adduser --system --home /srv/svnrepos --gecos "System account to run svnserve" svn
apt-get install subversion xinetd
cat >> /etc/xinetd.d/svn << "EOF"
service svn
{
        port                    = 3690
        socket_type             = stream
        protocol                = tcp
        wait                    = no
        user                    = svn
        server                  = /usr/bin/svnserve
        server_args             = -i -r /srv/svnrepos
}
EOF
/etc/init.d/xinetd restart

# for each repository, eg. myrepo1
$repo=myrepo1
svnadmin create /srv/svnrepos/$repo
chown -R svn:nogroup /srv/svnrepos

# uncomment line to use default password file
vi ~svn/$repo/conf/svnserve.conf

cat >> ~svn/$repo/conf/passwd << "EOF"
[users]
fred = *****
...

Posts navigation

1 2 3
Scroll to top