Thoughts that are my own.

Finding Swap Users

I recently ran across this post when I was trying to find out what was using swap on my server. Credit goes to Erik Ljungstrom here.

Create a file on your Linux box and place the following code in it. We’ll call it

# Get current swap usage for all running processes
# Erik Ljungstrom 27/05/2011
for DIR in `find /proc/ -maxdepth 1 -type d | egrep "^/proc/[0-9]"` ; do
PID=`echo $DIR | cut -d / -f 3`
PROGNAME=`ps -p $PID -o comm --no-headers`
for SWAP in `grep Swap $DIR/smaps 2>/dev/null| awk '{ print $2 }'`
echo "PID=$PID - Swap used: $SUM - ($PROGNAME )"

echo "Overall swap used: $OVERALL"

Make it executable.

chmod +x

Find the processes with the most swap usage:

./ | sort -n -k 5 

Don’t show processes that are not using any swap.

./ | egrep -v "Swap used: 0" |sort -n -k 5

Of course, this all needs to be run as root.

Good luck.

Converting From Wordpress to Octopress

A couple of thoughts on converting from Wordpress to Octopress

I have been toying for awhile with the idea of moving my family’s blog from Wordpress over to Octopress. I wasn’t looking forward to re-entering all those blog entries. However, I finally was ready to make the move for two reasons.

First, Wordpress is slow. To be fair, it’s probably not entirely the fault of Wordpress. I am sure there are things I can do in my configuration to speed things up. I have already replaced apache with nginx and enabled caching. In the end it’s still too slow for me.

The second reason that I wanted to move it is because I am a technology junkie and I like playing with new things. Octopress is that new thing for me. The blog you are reading now was created with Octopress and I like the ease of embedding images and videos, among other things that make markdown nice. I host all my images and videos on Rackspace Cloud Files and it’s just as simple as using the “%img” tag with a link to the CDN enabled file to place a picture in a post.

I won’t turn this into a how-to on making the change, but I will point out a couple of things. I used a Wordpress plugin called WordPress to Jekyll Exporter to convert all my posts to Markdown that can be used by Jekyll. Octopress is a front end for Jekyll. The plugin worked well with the text portion of the conversion but left me with some work to do, which I expected. Since my images were all stored on the Wordpress server, I am having to upload them to the CDN and then change the location of the images in each post. It’s still worth it to me to convert.

The other thing that threw me was that I kept running into PHP memory limit errors when trying to run the exporter. I’ve been a linux sys admin for a number of years and I know exactly how to fix that problem. But the fix didn’t work! I am running php_cgi with nginx and I thought that there was an issue with the configuration of php_cgi. I searched high and low and frustratingly didn’t find anything wrong with my php_cgi OR nginx configurations. What it turned out to be was this nicely hidden configuration option in Wordpress:

define( 'WP_MAX_MEMORY_LIMIT', '256M' );

This is located in {wordpress root}/wp-includes/default-constants.php. After changing that value to 512M and making sure that /etc/php.ini had the same or higher memory limit set, I was able to export my Wordpress blog entries into a nice .zip file and then get to work putting them into Octopress.

Video Post Test Using CDN and HTML5

Using HTML5 and CDN to Show Videos

I am testing the ability to show videos via CDN and HTML5 using the Rackspace Cloud CDN.



And while we’re at it… Mr. Rogers.


Bob Ross

That is all.