The first parameter sets up the maximum lifetime for an already established connection (432000 sg can be long; 28800 could be enough). The second and third are the maximum lifetime for a waiting connection and for the remote endpoint closes the socket.

So as to list all variables based on the conntrack module, type the next order.

The previous data correspond to a Zabbix installation where the free memory is around 37 MB, but the cached memory is more than 2 GB. What is happening here?

The answer is straightforward: Linux always tries to use all available memory, and thereby, it caches all read data. If at any moment an application needs memory, Linux will free it from the cached memory. This way of acting is pretty good because you will have better performance having the more frecuent data into the memory.

Really you will have a serious problem when your free memory is low, further your cached memory too and on top of all that, your system begins to swap.

Also say that other excellent data from the above 'top' is the swap memory value: 0. A well configured Linux system never should utilize swap. The key parameter for this purpose is swappiness. I usually set it with a value of 20.

[root@zabbix ~]# cat /proc/sys/vm/swappiness
20

There is a quick manner to force to the operating system so as to free the cached memory: changing the value of the drop_caches variable.

In the first loop you can see that the cached memory was 101 MB and it spent 3.76 sg looping through all files. But in the second loop, the 'grep' command spent 0.5 sg because the files were already cached on memory (its size grew from 101 MB to 412 MB).

If we take a look at the size of the /var/log/httpd directory, we can appreciate that the cached memory increment practically matchs with the size of that directory.

Feb 13, 2011

Linux has got the ability to perform a monitoring of existing connections by means of the conntrack module, which is compiled but not installed in distributions such as RHEL or CentOS. In order to load it, you can run the next order.

[root@centos ~]# modprobe ip_conntrack

In other operating systems like Debian or Ubuntu Server, first of all you must install the conntrack package and load the nf_conntrack_ipv4 module (if you want to work with IPv6, you will have to load the nf_conntrack_ipv6 module).

The conntrack module allows the kernel to register in a table all network connections of the system (established, time_wait, close, etc.). It used by several applications such as iptstate (it shows information about the state of the system connections) or Shorewall (firewall).

Another example of use for this module it is for instance, when the server has to realize NAT tasks with iptables and it is necessary to keep a table of connections implicated.

The file where conntrack logs all connections is /proc/net/ip_conntrack.

The two first fields are the connection protocol (TCP, 6) and then is the connection state (TIME_WAIT). The rest of the fields represent the IP addresses and ports involved, as well as the number of packets and bytes exchanged between the two points of the connection.

You have also to take into account that Linux saves the connection state in memory, and each of them uses around 350 bytes.

If you want to know how many open connections has got the system, you can utilize the following sentences.

This value is quite important because if at any moment we appreciate that any of our services works slowly (for instance Apache) or many connections are rejected, it can be due to which the number of open connections exceeds the maximum number of connections allowed.

Feb 6, 2011

This is the continuation of the article Shrinking virtual disks with LVM. It turns out that once you have mirrored your virtual disk to another smaller, it is normal to have wasted some space in the process, that is to say, an area of the new virtual disk which has been unused.

For this reason, we are going to learn in this article how to recover it. At this moment, the available size of our new disk is 16 GB.

Subscribe to

Follow by Email

About the author...

Javier Andrés Alonso has got a Master's Degree in Telecommunication Engineering and a Bachelor's Degree in Telecommunication Technical Engineering (specialising in Telematics), from the Polytechnic School of the University of Alcalá de Henares.