Drop_caches doesn't work on Solaris but works on RHEL6

Hello Experts,

I am performing performance tests on a few mysql select queries.
I use the following command to clear the memory disk caches.
sync && echo 3 | sudo tee /proc/sys/vm/drop_caches

I however see that the above command works on RHEL6 but doesn't work on Solaris 10.

I asked google but didn't get the solution.:confused:
Could you please help me in figuring out the command that would do the trick on Solaris as it did on RHEL?

Thanks for your valuable time.:slight_smile:

Regards,
Anirudh

Hi,

The "drop_caches" function is only available in later (after kernel 2.6.16 I think" linux, I think the equivalent command in Solaris are the "inter process cache" commandds.

You'll have to read up on the "ipcss" and the "ipcrm" command, from the man pages. However on Solaris, your DFS can make a huge difference as with ZFS you'll have caches in places you wouldn't think you'll have them.

Regards

Dave

You can drop a non ZFS based file system's cache with this command

lockfs -f /directory

with /directory being located in that file system.

If you use ZFS, one way is to export/import the pool.

You can also drop non-ZFS file system caches for a file system by unmounting that file system.

I haven't tested that for a ZFS file system, but I think there's a good chance that it will work.

Yes, but that's more intrusive than using lockfs.

That likely won't work. Unlike with traditional file systems, data can be shared between ZFS file systems belonging to the same pool so the cache is working at the pool level. Outside exporting importing the pool containing the file system which I already suggested but that is not achievable with the root pool, another way might be to dynamically reduce the ARC max size and perhaps allocate some RAM for the OS to release pages. This will affect all ZFS datasets though.