Archive for November, 2009

mod_vhs memcached support

Tuesday, November 17th, 2009

mod_vhs is an Apache 2.0/2.1/2.2 Web server module allowing mass virtual hosting without the need for file-based configuration. The virtual host paths are translated from any database supported by libhome at request time from MySQL, LDAP, PAM, or a system password file.

memcached is a high-performance, distributed memory object caching system, generic in nature, but originally intended for use in speeding up dynamic web applications by alleviating database load.

mod_vhs can put immense strain on your back-end storage engine, especially when under load, especially in our case with over 120 mysql connections per database server.

As a solution to this load problem, I have implemented memcached support into mod_vhs, wrapping the call to libhome with memcached. memcached will store both positive and negative libhome hits with user-configurable TTLs.

The addition to the request cycle follows the following path:

mod_vhs flow

Initial results have been promising and running it on 10 clusters has shown a 92% to 98% cache hit rate:

mod_vhs cache hit rate

The patch, (download: mod_vhs_memcached.patch) requires libmemcached and that mod_vhs is compiled with “-lmemcache”.

The patch to mod_vhs opens up the following apache options:

  • vhs_memcache_server (default:
  • vhs_memcache_port (default: 11211)
  • vhs_memcache_ttl (default: 300)
  • vhs_memcache_ttl_negative (default: 900)

Apologies that the code isn’t perfect, but it works :-)

RHEL 5.4 Network Scripts Bug

Tuesday, November 17th, 2009

There is a bug in the RHEL 5.4 networking scripts where by a network bond will not be created if a bond that includes the new bond name already exists. For example, you will not be able to create bond20 if bond200 exists.

Example, creating bond200 before bond20:

[root@localhost ~]# ifup bond200
[root@localhost ~]# ifup bond20
Error for wireless request "Set Encode" (8B2A) :
    SET failed on device bond20 ; Invalid argument.
SIOCGIFFLAGS: No such device

Creating bond20 before bond200:

[root@localhost ~]# ifup bond20
[root@localhost ~]# ifup bond200

This is caused by /etc/sysconfig/network-scripts/network-functions:217

215: is_available ()
216: {
217:    LC_ALL= LANG= ip -o link | grep -q $1
218:     [ "$?" = "1" ] || return 0

If bond200 exists, this will be matched by grep for bond20 and the bond will not be created.

A more accurate way of testing for the existance of the bond would be to:

if [ -d "/sys/class/net/$1" ]; 
    then return 0 ; 

Patch (link: rhel54networkingscripts.patch):

--- /etc/sysconfig/network-scripts/network-functions	2007-06-22 21:14:42.000000000 +0000
+++ ./network-functions	2009-11-17 14:37:26.000000000 +0000
@@ -214,8 +214,9 @@
 # Sets $alias to the device module if $? != 0
 is_available ()
-    LC_ALL= LANG= ip -o link | grep -q $1
-    [ "$?" = "1" ] || return 0
+    if [ -d "/sys/class/net/$1" ]; then 
+        return 0 ; 
+    fi
     alias=$(modprobe -c | awk \
 'BEGIN { alias = ""; }

RIP: Glass Bar at the Cellar Door

Sunday, November 8th, 2009

The awesome glass bar at the Cellar Door is no more:

Cellar Door Bar

As it rapidly deposited itself in many small pieces onto the floor:

Cellar Door Bar on Floor

Check for VT support

Thursday, November 5th, 2009

Since I keep forgetting the CPU flags, I may as well put them up here.

To see if your CPU(s) support VT extensions, run:

¬†grep -E ‘(vmx|svm)’ /proc/cpuinfo

cannot start microsoft outlook. cannot open the outlook window

Tuesday, November 3rd, 2009

Is easily fixed by running:

Outlook.exe /resetnavpane