The moment I'd replaced one of my two
512MB RAM cards with a 2GB one, I was elated because this was the
first thing I'd bought with my stipend
. It's kind of a different
feeling when you buy it out of your own pocket isn't it? Anyways, I
was even more delighted when I booted my SXCE build 98 and had the
system monitor tell me that I had 2.4 Gigs of RAM. Alright! Time for
some OHAC action! There I was in the server room, downloading the
tools necessary to build OHAC on my laptop, and checking my mails in
the process, when my old nemesis, Murphy, decided not to let me rejoice because some 20 minutes into my session,
in spite of having only a Firefox window with some tabs open, I was
shocked to see that my RAM utilisation was not 40%, not 50%, but a
whopping 96% !!!
I'd installed Windows XP that night so that I could get back to Dota/Warcraft III and it seemed to be working fine. It was detecting my RAM properly and it wasn't overusing it either. And my Debian, strangely enough, still told me that I had only 1GB of RAM. Something was not right. I actually thought for a moment that it was a problem with the RAM card, or because of the fact that both my cards were of a different make. But even on booting my system with just the 2GB card, the results were the same.
So I figured, it had something to do with the OS. I'm still trying to get the bottom of the misread by my Debian box, but I believe I've figured out the problem with my SXCE. Thing is, it's not a problem, that's how it's designed to be! And where's all that RAM going? If you've guessed it right, then you've won yourself a free opportunity to read the rest of this blog entry. If not, you get to hear the right answer :P.
The culprit is none other than ZFS
itself. 
The concept used over here is rather
simple. Unused memory is wasted memory. Is it not? So ZFS uses a thing called ARC which is basically where the file system caches data from all the currently active storage pools. It keeps consuming memory because of the above mentioned reason and it may also reach a point where there is hardly any free memory left. Before you say, “But Lalith, if that's the
case, how am I going to get enough RAM to play World of Warcraft, run my virtual machines and at the same time build OHAC?”... let me tell you that ZFS is not
stealing RAM from any application. When the ARC has grown to the point where external applications don't have enough RAM for themselves, the ARC releases memory and the application can run normally.
To see for yourself, enter the following in your console:
# echo "::memstat" | mdb -k
# echo "::kmastat ! grep Total" |mdb -k
Here's the output on my system:

I hate formatting stuff that's copy pasted from the terminal, so I've hence taken the liberty to put up a screenshot
. Notice the green graph in the system monitor on my panel. That's how much memory is being used at that instant (1.7 out of 2.4 GB).
But you may come across a situation where an application to be started needs a huge amount of RAM to start, and hence, it will cause you problems if ARC takes up all your RAM. To prevent this from happening, you can try limiting the arc size by adding the following entry into your /etc/system file.
zfs:zfs_arc_max = <Number of bytes>
Here's an interesting link, if you're a tuning freak and you want to pimp your ZFS :P
Do correct me if I've made any mistakes here. Cheers!
You should play WoW via WINE inside OpenSolaris, no need for running XP in a virtual machine.
Posted by Abraham Tehrani on October 09, 2008 at 10:56 PM IST #