My performance problem and how I solved it

I finally put another 512MB of RAM in my office Linux box today. It has had "just" 512MB forever, while I waited for the price to come down. I had all kinds of data that suggested the machine was short on RAM, and that adding more would dramatically improve its performance…

The scary part is that it worked. After I closed up the box, opened it up again and seated the memory module properly, undid some BIOS tweaks that were keeping the BIOS from seeing the new memory, closed up the box again and booted Linux, things that had been disk-bound and taken maybe ten or fifteen seconds suddenly began to take just one or two.

I'm not sure I'm happy about this. What on earth would my little desktop Linux box want more than 513MB of RAM for?

I'll try to gather some more information. Advice on the best way to do this is appreciated. Perhaps sometime soon, my box will use less than 512MB. In the meantime, for $50 and an hour of my time, I've solved my performance problem. Who knew? Friend of Bart

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Not programs; cache

I think the effect you've observed comes entirely from additional available cache. Linux should almost leave "free" memory around; any memory not actively used by a program should cache some useful piece of disk. Try running "htop", which makes it really easy to see how much of your memory gets used for cache and how much for programs. Also check out how much swap you have used.

In other words, adding that much memory would likely help even if your running programs took up very little memory. Just as all your programs have a "working set" of memory they need to keep resident to run quickly based on your particular load, you also have a "working set" of disk blocks that should get cached all the time for good performance. I think the effect you observed tells you that you have a disk working set bigger than (512MB - your running programs), but that mostly fits into (1GB - your running programs).

Now, if htop indicates that you have more than 512MB of memory used for *programs*, ignore the preceeding paragraph and its conclusion; you just needed more memory to avoid swapping. Also, your nightly updatedb run might have really screwed up your cache, whereas with enough memory Linux might have enough breathing room to keep your working set in cache through an updatedb run.

Yeah, I had a bigger than 512MB working set

This is what puzzled me. I was regularly seeing actual paging to disk, which is kind of sad. I know that my box periodically gets its working set clobbered by things like the nightly backup run. Still, I'm really surprised at the performance difference I was seeing.

A clue is that the difference seems to have decreased over the last few days. I suspect from looking at process lists that the KDE stuff plus maybe Firefox are leaking a lot of memory? I dunno—someday I'll have the kind of time it will take to sit down and figure it out.

Thanks much for the thoughts!

I'm KDE, but yeah

Yeah, KDE is also a fairly heavyweight system. But I've run pretty amazingly heavyweight systems in 64MB in the past. I think something else is going on here… Friend of Bart

Gone are the Days

When Linux was efficient on a variety of hardware. It's a shame.