An irony of web serving

One of the small paradoxes of the web is that it is often theconnections with the least bandwidth that put the largest load on yourweb server.

This is because each connection consumes a certain amount of serverresources, ranging from kernel data structures for socket buffers up toan entire thread or process on a dynamic website. The slower someone'sconnection, the longer they tie up up this stuff on your end as youslowly feed them data. Conversely, people on fast connections get in,get their data,


How DWiki uses partial function evaluation

As part of a longer entry, Muharem Hrnjadovic asks :

I would love to see examples or code snippets that are made possibleand/or improved greatly by leveraging functools.partial() .

I'm not sure that my example qualifies, but I'll take a shot at it.

DWiki has a WSGI-like processing pipeline to handlerequests; they get passed from function to function, possibly gettingmutated on the way down and possibly having the results mutated on theway back up.

The pipeline functions look


What I want out of a Linux partitioning program

Programs like fdisk , sfdisk , and even parted are really irritatingto deal with most of the time because they ask you too many nitpickingquestions. What I want is a partitioning program with a command oriented'shell' interface, with the core command being:

make N SIZE [TYPE]

This makes partition N be SIZE big (with the default units beingmegabytes), optionally making its type be TYPE (which can be in hex orin English). If N is 1 to 4, it is a primary


Why I don't expect result-oriented work hours to work out

A recent Slashdot story pointed to this article onone company's more flexible approach to work hours. It hasthe line:

The goal at Best Buy is to judge performance on outputinstead of hours.

My immediate cynical reaction is that this is a marvelous theorybut doomed in most practices. The root problem is the sameseductive thought in management that leads to excessive overtime : 'if my employee is getting all this done in Nhours now, think how much more work she could do in N+Y hours


Another obnoxious discovery about Ubuntu's /var/run stuff

Today, I had the distinct pleasure of discovering that /var/run mustexist on the root filesystem , even if you have a separate /var filesystem . If your root filesystem does not have such a hidden /var/run , you experience mysterious failures of various boot stuff,including an inability to bring up the network; for bonus points,nothing gives you any meaningful error messages.

(For bonus points, the default Ubuntu server startup sequence wipes out the console scroll buffer, so you can't scroll


How not to set up your DNS (part 13)

In the traditional illustrated format:

; sdig ns aescorts.net.
ns1.bnmq.com.
ns2.bnmq.com.
; dig mx aescorts.net. @ns1.bnmq.com.

[...]
;; flags: qr aa rd; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0
[...]
;; AUTHORITY SECTION:
. 1 IN SOA . abuse.opticaljungle.com. ...

That's an interestingly grandiose


Setting up switches to avoid unwanted VLAN leakage

We made a small mistake around here a while back: we used VLAN ID 1 fora real VLAN. In fact, we used it for our 'management network' VLAN.

This is a mistake because many switches insist that all ports beuntagged members of some VLAN, and they pick VLAN 1 to be the defaultVLAN for this. The net effect is that unconfigured ports on many of ourVLAN-aware switches are by default on our management network.

(Not all of our switches are VLAN aware; edge


A small annoyance with Unix wildcards

Here's a small irritation with Unix wildcards: there's no generallyrecognized wildcard (or small set of wildcards) that matches all of thefiles in a directory, including dotfiles but excluding . and .. ,so that you could easily match all of a directory's real contents.

A plain * doesn't match dotfiles; * .* matches dotfiles, butincludes . and .. too. About the best you can do is

* .??* .[^.]

However this


How SSH achieves forward secrecy

A while back a co-worker asked me why SSH (sometimes) uses a secondtemporary host key in addition to the main host key. I had to thinkabout it for a bit: it's to keep the session private even if theserver's host key is later compromised.

(The clever person will notice I could have found this out just byreading the description of the KeyRegenerationInterval sshd parameter.I observe that one rarely pauses to grovel through manpages whendiscussing half-remembered things with co-


More fun with Python's indentation rules

Python's indentation rules apply only to logicallines (as the documentation is careful to spell out), although theindentation level only comes from the first physical line. This opens upvarious sorts of peculiarity and evil, some of which I mentioned lasttime .

There are two ways for multiple physical lines to be joinedinto one logical lines: being explicitly continued witha \ at the end of the line ( explicit line joining ), orbeing inside a ( , { , or [ ( implicit line joining )