How to log request processing times in Apache

If you have an apache (2) web server, you probably have an access.log file showing you all kinds of data using the “combined” log format. Let’s see how to include processing time into that log file.

By default a line in the combined log looks like this:

[codeblock lang="” line="1″] - - [03/Dec/2009:03:20:47 +0100] “GET /info-tech/ HTTP/1.1″ 200 46482 “” “Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv: Gecko/20091102 Firefox/3.5.5″[/codeblock]

Notice the 2 dashes - - just after the IP. The first one stands for “I could not identify the user using ident” and the second one for “no user authentication was performed".

Now, let’s face it: you will never identify anyone using ident. Your apache conf probably even doesn’t try. That field is a left over from ancient times. So let’s replace that first dash with something useful, i-e: the processing time of the request! Note that by doing this we keep the global structure of the file identical and any log processing tool you might be using should not be affected.

Read more »

How to install the APC PHP Cache on Debian (Lenny or Squeeze)

How to install the APC PHP Cache on Debian (Lenny or Squeeze)
The APC PHP Cache Control Panel

The APC cache can significantly improve your PHP script performance, just by installing it, which basically takes 5 minutes! (Plus, it’s actually supported by the core PHP developers and will probably be integrated into PHP6…)

Here’s what I did on my Debian Lenny box…

First you may want to have a reference benchmark to see if it actually improves:


ab -c5 -n100

Now install the APC package:


aptitude install php-apc

Now, restart apache:


/etc/init.d/apache2 restart

Now, you can run your benchmark again and see the difference! Tada! :)

Read more »

Make your mouse faster on Mac OS X

Make your mouse faster on Mac OS X

There’s 2 problems to mouse speed:

The maximum speed can be set through the System preferences panel, but even when the slider is all the way to the right, the speed may be too slow… especially if you line up 3 monitors side by side.

You can get faster speeds through the Applications > Utilities > Terminal. To see the current setting, type in this:

[codespan]defaults read -g[/codespan]

To make the mouse faster, set a different value, for example:

[codespan]defaults write -g 6[/codespan]

How to control fan speed & noise on the mac pro

How to control fan speed & noise on the mac pro

Did you know there were actually 5 different fans inside a Mac Pro (early 2009 version)? They are named Intake, Exhaust, BoostA, PCI and Power Supply! By default, all of them turn pretty slowly; in the 600 to 850 rpm range! Which makes the whole thing pretty silent… yet… anoying because of the complexity of the sound (yes, it’s 5 different spining motor sounds combined, not to mention the hard drive spinning!)

You can monitor that with iStat menus – which is very cool for monitoring a lot of things, except voltages & power consumption which do not seem to work, at least on the Mac pro 2009.

Now my problem is I’d like all these fans to run faster! Yes, faster! Not because I want some extra fan noise, but because I believe Uncle Steve pushed it too far when he asked his engineers to reduce the fan noise! I wouldn’t mind the noise to be a little bit higher pitched than it currently is.

I first tried FanControl from Lobotomo Software. BEWARE: it’s a pain to uninstall (unsinstall instrutions on their page). Because it’s designed for the macbook pro (yes, the laptop), it only controls 2 of the 5 fans and the minimum speed it allows is 1000 rpms. Up from 600 rpm, that is too much! I wish I could run every fan at 850 rpm!

Then I found smcFanControl from eidac. That one has the advantage of allowing settings for all 5 fans on the mac pro. However, again two of them cannot be set lower than 1000 rpm. Worse: it doesn’t actually do anything on the mac pro. It probably works on other apple computers but on the mac pro 2009 it has absolutely no effect on fan speed. :’(

From what I undrestand the fans are controlled by a chip called “SMC” as in “System Management Controller” and apple doesn’t give you much control over it, apart from a clunky procedure to reset it! Note: resetting the SMC allowed me to get back to original rpms for all fans after FanControl had messed them up. Resetting teh SMC also seems to have reduced the tempearture of the air mesured at the exhaust – at equivalent fan speeds and system load (that is: idle!). Strange…

If any of you knows a way to effectively control fan speed on the mac pro, please let me know.

I’d be up for some watercooling too :)

How do I sync my macs?

How do I sync my macs?

If you have multiple macs (and an iPhone), is a must have, of course, but it only syncs so much… basically:

  • Address book
  • Calendar
  • Mail (but I’m using IMAP anyways)
  • Safari bookmarks
  • System preferences does not auto-sync:

  • All kinds of documents
  • Application settings & preferences
  • iPhoto library
  • iTunes library
  • VMware virtual machines
  • Firefox bookmarks

For merging all kinds of bookmarks I use Foxmarks. However for the rest, I’m pretty much down to manual sync every time I leave for a trip where I have to move all mods over to the laptop and then back to the desktop when I get back. When synchronizing the entire home folder there are actually a lot of files that need to be left out or you’ll just break apps on the other computer (erase serial numbers, etc.). So it requires a lot of manual supervision.

It feels like an entire wasted day every time. (At least I’m doing some packing/unpacking during large file copies, but still…)

Most sync tools are too stupid to handle exceptions nicely. The only way synching home folders could actually work over time in my opinion would be for the sync toll to start by asking you for each subfolder what should be done: Ignore, Sync, Sync with curent contents, Sync with future contents. Then at each subsequent sync, any new found folder should trigger the question again, unless it was already included in a “Sync with future subfolders” parent.

Some folder would also require a “Sync as a whole” function, where contents from both sides should never end up mixed as a result of a merge (I am thinking about iPhoto here).

Still looking for something smart enough…

Beyond the software issue I think I need to buy a Firewire 800 cable in order to transfer files faster direcly from one mac to another. Believe it or not but file transfers over Gigabit Ethernet remain pathetically slow… like 14 MB/s which is roughly only 0.14 Gigabits/second.