random walk through fields of musings

Wednesday, March 24, 2010

it's old-fashioned to swap to disk...

or not only is swapping to disk harmful, it's downright silly on webservers (conditions apply and exceptions are many).

Back when the OS on your webserver was 32-bit and 512MB was a lot, arguments like this might have been germane, but I'll just claim to have been a decade ahead of my time when I wanted my FreeBSD 2.1 webservers (behind a load-balancer with shared nothing) configured without swap so that they would just panic and reboot if they ran out of memory rather than suffer the slow death of context switches and disk IO (we'd end up rebooting them anyway).

Now with 64-bit OSes and less-than-expensive multi Gigabyte RAM, plus effective ways to cap memory usage of JVM and VMs, there is little use for disk swap on clusters of machines which are identical and data-less. Even on large DB servers with 30+ GB of RAM it is silly to consider swapping to be okay unless it's for long-running queries that can tolerate large latency. OLTP type DBs should just have the DB process restarted if it gets too big.

I'm sure there are lots of cases where you don't want to lose data and can tolerate the latency, but it certainly seems for all the low-latency "social web" sorts of applications, a load-balancer that sends new sessions to real servers based on least-response-time plus a quick reboot are going to be better remedies than the slow-death of disk swapping.

So unless you can come up with a compelling argument other than "it's always been done that way", I'm going to practice not recommending or building "clustered", web servers for interactive applications with disk swap until experience or overwhelming evidence suggests otherwise. So there.

1 comment:

Anonymous said...

Presented only to confirmed bettors, you'll nonetheless have to e-mail the betting web site respectable id documents to authenticate your betting account even after finishing the registration course of. The few which will grant you a bonus before account verification will forbid 메리트카지노 you from withdrawing funds till you do so. A signing bonus is a suggestion the place have the ability to|you probably can} obtain free cash a lot as} a particular amount by picking a bookmaker and opening an account with them.