October2009

Brute force restarting of services on a machine under heavy load in response to the slashdot effect

So, for a single core single processor machine a load average of 1 means that on average there’s a process in the running or runnable state at all times. This means the CPU average is at 100% too. If another process wants to run, it has to wait in the queue before being executed. For a multi-core or multi-processor system, you’re not CPU bound until the load average equals the total number of cores. You can calculate a system’s CPU utilization by dividing the load average by the number of processors you see in /proc/cpuinfo

Measure bandwidth between two computers with iperf

If you want to get an estimate of bandwidth speeds between two machines, but you don’t want to factor in storage read/write speeds, iperf is the perfect tool.

Load balancing network bonding device from multiple physical interfaces

My new mobo has two gigE ports, so I figure why not trunk them together to work as one network device? This will work great for a Linux based network storage device (NAS). This will create a virtual interface named bond0 with the external ip address of 192.168.1.100. Anything else on my network will see this computer with this address. It doesn’t matter which interface is actually plugged in, one, the other, or both. As long as one is plugged in it will continue to function.

Load virtual tape drives directly

Lets start by assuming you’ve already installed mhvtl, you have a few virtual tape drives, a media changer, and a bunch of virtual tapes. You can control the media changer or library device at /dev/changer. Using MTX utilities, you can ask the changer to load tapes into drives and list map, etc. But i’ve found it’s actually easier for testing to control the drives directly. You can load and unload tapes directly into and out of a drive by barcode label and tape drive queue.

How to restore a postgresql database from dumpall backup

If your dump was performed with the “–clean” option, you can skip the reinitializing of your databases to avoid duplicating data. This option, used with the “pg_dumpall” command will cause the restore to clean out all the objects in the database before performing the restore. If you didn’t include this option, then just delete the data directory and reinitialize the database as shown below.

Disable oplocks in a heterogeneous Samba / NFS environment

Opportunistic locking is part of the Windows client file caching mechanism. Samba implements opportunistic locking as a server-side component of the client caching mechanism. Samba/CIFS doesn’t play nice with NFS, so if you’re in a mixed environment where some windows machines access and modify the same files that Linux or Solaris touch through NFS, then disable the oplocks. This is important for things like database files to avoid corruption!

How to debug wxPython errors when your applications crash

After your done building your wx objects and you’re ready to show it and call MainLoop(), wrap your main loop where you actually instantiate your gui objects in try/accept statements so that you can really catch any errors by calling the “show_errors()” function to launch a new message window where the errors will get displayed. This lets you catch errors before your whole program dies (causing errors to get lost).