Tune Up Paging with vmtouch

A nice tool I came across recently ‘vmtouch’ which is used to help you manage what data is in memory.  Its great when failing over from one machine to another where there is no active memory profile already.

To get started download vmtouch from here

Then compile with the following
gcc -Wall -O3 -o vmtouch vmtouch.c

To find out how much of your /bin directory is in the file system cache run

./vmtouch /bin

You will see something similar to this

       Files: 91
     Directories: 1
  Resident Pages: 512/2115  2M/8M  24.2%
         Elapsed: 0.002669 seconds

If I want to check how much of mysqld is in the cache

./vmtouch  /usr/libexec/mysqld
           Files: 1
     Directories: 0
  Resident Pages: 671/1886  2M/7M  35.6%
         Elapsed: 0.00029 seconds

Say you want to check how much of your mysql indexes are in cache this is two examples

./vmtouch  /var/lib/mysql/xcart/xcart_products.MYI
           Files: 1
     Directories: 0
  Resident Pages: 5309/5309  20M/20M  100%
         Elapsed: 0.001485 seconds

./vmtouch  /var/lib/mysql/xcart/xcart_zone_element.MYI
           Files: 1
     Directories: 0
  Resident Pages: 0/1  0/4K  0%
         Elapsed: 8.5e-05 seconds

Now something nice you can do is you can daemonize and lock pages from a file in cache, an example of this might be an index for a database which you feel may benefit from been loaded in the page cache full-time.

To do this you use the –dl option (daemonize and lock)

So

./vmtouch  -dl /var/lib/mysql/xcart/xcart_products.MYI


Comments

Popular posts from this blog

Basic Send Message to MQ with Java and IBM MQ JMS

Creating a simple Alert / Success Message with ASP.NET/VB using Bootstrap

Comodo SSL - Firefox Warning when go from http to https