2009/12/11 Kevin Foote <[email protected]>: > Hi all > > I have a RHEL5 question / issue that I cant seem to figure out. I'm trying > to eliminate a process (mysql) from swapping out to the swap space. This is > a dedicated > mysql server so nothing else of importance should be using memory or other > but I'm still seeing swap being used and my si / so columns are pretty > active. > > > Here is some server info. > > OS: RHEL5 x86_64 > Mem: 8GB > Swap: 4G on VolGroup00/LogVol01 > > > MySQL info: > I have assigned mysql (through the my.cnf file) to use 4G of memory for its > innodb engine (this is all I'm using) > > > What I have tried thus far.. > > Step 1: > placed in rc.local > echo 0 > /proc/sys/vm/swappiness
You went extreme here. > > Step 2: > added to /etc/security/limits.conf > mysql soft memlock 4194304 > mysql hard memlock 4194304 > > Step 3: > added to sysctl.conf > vm.nr_hugepages = 2048 > > Step 4: > upped the nice to -15 for mysql > > > Here is what I see during run time. > > #vmstat 5 <cut> The numbers reported indicate very low swap activity. > > Ultimatly I'd like to see the entire 4G get locked and that be where mysql > stays but I think the kernel is migrating stuff to swap. Am I making too > much of these numbers or is there something I forgot in sysctl (or other) to > force mysql to stay in RAM as opposed to going to swap? > > Any help appreciated. > I think there's little swapping going on at the moment in your system. The moment being defined as the 5s shown by vmstat. >From what /proc/meminfo shows you have 1024 huge pages, of which 1024 are free. I think MySQL is doing its best to avoid using them. And succeeds. Here goes 4G poof? You may take a peek at http://linux-mm.org/Low_On_Memory. If kernel swapped things out and vmstat reports low values of si (as it does in your case), then it means, that the swapped out pages aren't needed right now. Swapping them out increases performance of your server, because now that physical RAM can be used for other purposes. If you want to continue your battle against swap you may disable it completely, but then the pages currently swapped in will be kept in-core, so you may actually pay a performance price for this. A less extreme means of getting rid of swapping could be poking around VM settings. Take a look at dirty_background_ratio, dirty_ratio, vfs_cache_pressure et al. If you have no other useful activity at the server you may want to increase pressure on dirty pages reclaiming -- if configured properly the database should do its own caching and there's no point in spending extra resources on filesystem access caching. You may go extreme on /proc/sys/vm/pagecache. You have about 1.5 MB of dirty pages, and about 4GB of page cache. Either your workload is read-intensive or your system is doing little to nothing, the latter hypothesis supported by CPU idle time at 90+%. And pray, say, why are you such a swap-hater? ;) Regards, Paweł _______________________________________________ rhelv5-list mailing list [email protected] https://www.redhat.com/mailman/listinfo/rhelv5-list
