September 22, 2010

In continuation to my testing of squid for optimization [refer Optimizing SQUID - (Part 1) ] , I then used Squid's configuration directive cache_swap_low and cache_swap_high. Thus performance of squid does improves but probably it won't be noticeable. But, it definately reduces the chances of squid's slow down or performance degradation.

The cache_swap_low and cache_swap_high directives controls the replacement of cache objects stored on disk. The values are in percentage (%) of the cache size (i.e.sum of all the cache_dir sizes).

I have set the following configurationg for the directives in squid.conf

cache_swap_low 60

cache_swap_high 65

So, until and unless disk usage is below the 60 %, replacement does not take place and, it begins only when it is above the low water mark. Replacement is more aggressive when disk utilization is close to the high water mark.

August 14, 2010

(I have been working on an issue related to squid slowing down gradually thus slowing down internet access by network users. As it made me more enthusiastic what could be the reason or could be there an alternative way to resolve this. Thus, I can across the so called RAMDISK and tried to use it with squid.

I tried my way to use RAMDISK with SQUID. I found squid was doing good....so here I blogged......to get the better view of my result.

INTRODUCTION:

RAM disk is a section of the RAM (memory) which is configured as a disk drive. Data stored in RAM disk can be accessed faster than the data stored in a hard disk drive.

Usually, Squid is configured to cache its information of visited websites in the hard disk. Using a RAM Disk for storing this information will enable the squid to access the cache more faster than the one stored in cache. Though, data stored in the RAM DISK are TEMPORARY (i.e. data will be stored only until the system is up and running), I recommend to have multiple cache directories storage: one in RAMDISK and another as well as in Hard-disk.

3) To increase the size of the ramdisk for eg. 16MBA command has to be passed to the kernel during booting. This can be done in the grub.conf by passing an entry in ramdisk_size=[enter the size in 1024-byte blocks]

root@lino90:~# vi /etc/grub.conf

# grub.conf generated by anaconda## Note that you do not have to rerun grub after making changes to this file# NOTICE: You do not have a /boot partition. This means that# all kernel and initrd paths are relative to /, eg.# root (hd0,0)# kernel /boot/vmlinuz-version ro root=/dev/sda1# initrd /boot/initrd-version.img# boot=/dev/sdadefault=0timeout=5splashimage=(hd0,0)/boot/grub/splash.xpm.gzhiddenmenutitle Red Hat Enterprise Linux Server (2.6.18-8.el5)root (hd0,0)kernel /boot/vmlinuz-2.6.18-8.el5 ro root=LABEL=/1 rhgb quiet ramdisk_size=16000initrd /boot/initrd-2.6.18-8.el5.img

Save the file and reboot. After the reboot, confirm with the below command to check the new size of the ramdisk

The setting of "cache_dir aufs /var/spool/squid_mem 45 100 100" is ideally for a 50 MB of ramdisk. In this case we have configured 45MB out of 50MB randisk for cache store, leaving 5MB unused. The number of irst level sub-directories created will be 100 and number of second level sub-directories created will be 100

Here, you need to check if squid can create the defined number of 1st level and 2nd level of cache directoies in the RAMDISK by running the below command