Linux Ask!

Linux Ask! is a Q & A web site specific for Linux related questions. Questions are collected, answered and audited by experienced Linux users.

Jan 262010
 

What are the pdflush processes?

Answer:

When you use the top command, you might notice 2 or more pdflush processes are running actively and wondering what do they actually do.

In fact, when the Linux system want to write data to disk, e.g. write to a file, a special in-memory copies will hold the data blocks belonging to that files which is called the "page cache". For performance reasons, data is usually not always written out (sync) to disk and is temporarily stored in page cache (called "dirty pages").

The jobs of pdflush threads are used to write data out from dirty page caches to disk.

Reference: http://lwn.net/Articles/326552/

Jan 172010
 

Reduce the chance of using swap if you have enough memory

Answer:

If you have enough memory but the Linux is still using swap at sometimes, you can adjust the swappiness parameter

1. See the current setting

# cat /proc/sys/vm/swappiness
60

The range is from 0 to 100 (lower value means you system will try to avoid swap as much as possible)

2. To set a lower value at runtime

# echo "30" >  /proc/sys/vm/swappiness

3. To set it permanently

# /sbin/sysctl -w vm.swappiness=30

Reboot after the changes.

Jan 112010
 

Increase the maximum number of open files / file descriptors

Answer:

If you are root, execute the command below

ulimit -SHn 65535

If you want to set it permanently, especially for a particular user, change the file /etc/security/limits.conf to have the following lines (assume user = www-data)

E.g.

www-data hard nofile 65535
www-data soft nofile 65535

And make sure uncomment pam_limits.so from the different files under /etc/pam.d, e.g. sudo, login, sshd, ...

Finally restart your system.