andreimatei.com

Icon

A collection of general dweebery & inexcusable nerdiness.

eAccelerator Installation on Debian

Today’s post covers the joys and benefits of opcode caching.  If you have a very active site, this caching method can provide a great deal of relief to your servers by significantly reducing load averages and CPU utilization.

How does it work?
It’s quite simple, actually.  Without caching configured, each time a PHP-based page is requested by a user, the server gathers all of the needed files and “compiles” them into a result which it can understand and deliver.  This result is known as “opcode”.

The technique of opcode caching preserves this generated code into a cache so compilation only needs to happen once and then can be used over and over again for numerous requests by numerous users.

Why eAccelerator?
Several PHP caching choices exist including APC, Zend, and XCache.  I’ve chosen eAccelerator based on numerous reports such as this one which show its distinct performance advantage and also in large part due to the personal recommendation of seasoned server architects such as RackerHacker.

Read more »

VirtualBox on a Headless Debian Server

I’ve got too many computers.  It’s become increasingly difficult to convince people “I’m not *that* nerdy” when I have servers and wires laying around everywhere.  A consolidation project is in order.

For this exercise, our goal is to combine a Linux file server and a Windows workstation elegantly into one machine.  “Windows?!?!” you gasp in horror?  No need to be alarmed; I use Linux/BSD exclusively on servers and Mac OS X on my desktops.  I have only one very specific need for a standalone Windows machine, so let’s leave it at that for now.

The Linux file server is headless and of course doesn’t run X-Windows or any other GUI.  I need to have a full Windows environment available which I can RDP into at any time.  I first experimented with Xen which is a solid enterprise solution but overkill for this project.  Next, I spent a significant amount of time with KVM which is easy to set up but has a bit of quirky management in my opinion.  Finally, I settled upon Oracle VirtualBox; it’s free, fast, and can be elegantly controlled at the command line.

Read more »

Debian Kernels and Tigon TG3 Firmware

If you are updating the kernel on your Debian 5.0 (Lenny) or Debian 6.0 (Squeeze) installation and have a Tigon Gigabit ethernet controller, such as the one on the Dell Poweredge T110, you may receive the following warning messages:

W: Possible missing firmware /lib/firmware/tigon/tg3_tso5.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3_tso.bin for module tg3
W: Possible missing firmware /lib/firmware/tigon/tg3.bin for module tg3

While harmless, these messages may be a bit disconcerting.  Luckily, an easy, however not widely-documented fix, is present to solve this.  Simply follow the two steps below:

1.) Add the “non-free” repository to the sources.lst file. (Here we are using Debian Squeeze. Replace “squeeze” with “lenny” if you are using Debian 5.0 Stable.)

nano -w /etc/apt/sources.list
deb http://ftp.us.debian.org/debian/ squeeze main contrib non-free
deb-src http://ftp.us.debian.org/debian/ squeeze main contrib non-free

2.) Update apt-get and install the “firmware-linux-nonfree” package.

apt-get update
apt-get install firmware-linux-nonfree

Now, you should be all set and you can attempt the kernel installation once more.  According to this Debian bug report, the Tigon TG3 firmware is not listed in the package description even though it is present in the package itself and perhaps why some confusion arose.

Font Anti-Aliasing and Mac OS X 10.6

Mac users may have noticed the options for adjusting font anti-aliasing / smoothing in Mac OS X 10.6 (Snow Leopard) have mysteriously disappeared from the “Appearance” section of System Preferences.  With Mac OS X 10.5 (Leopard) and before, users could control the level of font smoothing with classifications such as: Automatic, Standard, Light, Medium, and Strong.

Luckily, this now hidden preference, can still be accessed via the Terminal. Run the following command as the local user:

defaults -currentHost write -globalDomain AppleFontSmoothing -int 1

and replace the number at the end for the selection you wish:

1 – Light
2 – Medium
3 – Strong

Finally, log out and log back in to see the changes applied to the Finder and all applications.  A special “thank you” goes to Mac OS X Hints for supplying the information for this post.

Enabling sar Stats on Debian

Many CentOS and RHEL Linux administrators have come to rely on the sar tool as an easy way to see historical load, io, and memory statistics.  On Debian, sar functionality isn’t available by default but is easy to install.

apt-get install sysstat
dpkg-reconfigure sysstat

(select yes to activate sysstat’s cronjob)

After several minutes, you’ll have access to:

  • Check historical load averages: sar -q
  • Check historical memory utilization: sar -r
  • Check historical disk utilization: sar -u

As a side note, the sysstat package we installed also includes additional helpful utilities such as: iostat, mpstat, and pidstat.

HAProxy & Heartbeat on Cloud Servers

High availability load balancing can be easily configured on virtualized computing instances in the Cloud.  This post explores deploying HAProxy and Heartbeat on Rackspace Cloud Servers running Debian 5.0 Lenny.

The desired result of this project is to have a redundant load balancer pair in active/passive configuration, distributing requests across two Apache web servers where any one load balancer and any one web server can fail with the environment still operational.

Example Server List

Server Public IP Private IP
lb1 175.200.90.50 10.180.75.200
lb2 175.200.90.51 10.180.75.201
web-a 175.200.90.52 10.180.75.202
web-b 175.200.90.53 10.180.75.203

Virtual IP: 175.200.90.100

Step 1: Obtaining a Virtual IP

A Virtual IP is a static, public failover IP which can move between load balancers as needed.  This is the IP you will use for your ‘A’ records when configuring DNS for your domain(s).  You can easily request the failover IP via the Rackspace Cloud ticketing system (http://manage.rackspacecloud.com), but make sure to be very deliberate in the wording of your ticket or you may just get an additional IP provisioned which won’t share properly. Here is some sample ticket verbiage which may help: “Please provision a failover IP for lb1 and ensure that it is also shared with lb2.  I understand and agree to the $2/mo additional charge for the IP.”

Read more »

Upgrading to Ubuntu 10.04 on VirtualBox

Now that the production release of Ubuntu 10.04 Lucid Lynx is out, users should consider upgrading.  Luckily, Ubuntu/Debian (unlike some other distros) makes it really easy to perform an upgrade without breaking things or retaining extra clutter from the pervious version.

I am running Ubuntu 9.04 Karmic Koala in a VirtualBox instance on my Macbook Pro.  The first set of commands can be used universally for all users running Ubuntu on any platform and the second are specifically for upgrading the VBox tools to work with the new kernel.

Upgrading Ubuntu (steps for all users):

apt-get clean
apt-get autoremove
nano -w /etc/apt/sources.lst

(change all references of “karmic” to “lucid”)

apt-get update
apt-get dist-upgrade
reboot
apt-get autoremove

Upgrading VBox Tools (for VirtualBox users only):

cd /cdrom
./autorun.sh
reboot

Once you log back in, verify that window resizing and mouse traversal in and out of the VM work correctly. If so, you should be all set and your upgrade is now complete. If you run into any issues, feel free to email me and I’ll do my best to give you a hand.

Slow Shell Prompt in Terminal.app

Have you recently noticed your shell prompt taking longer and longer to show up after you open Terminal.app in Mac OS X Leopard or Snow Leopard?  In some cases, I’ve seen the delay to be as long as 7-10 seconds.  Well, here is a quick tip to alleviate the issue.

cd /var/log/asl
sudo rm -rf *

The above commands clear the Apple System Log and the problem is instantly resolved.

Archives

Categories

andreimatei.com Stats

  Total Page Hits: 9300
  Total Visitors: 2086
  { Since June 1st, 2010 }