Adventures with Linux

Network performance of a Linux Server

Check whether the network is at Full Duplex and at the rated capacity
Its not un-common for Gigabit network cards to be running at 100baseT/Half duplex or 100baseT/Full instead of 1000baseT/Full due to minor auto-negotiation failures.
ethtool is your friend to determine the current network speed possible on a network interface card(NIC).

Kernel Version

Is it greater than 2.6.17. In that case the kernel would auto-tune itself and you don't need to mess around with the various options available.

Here is an excellent explanation of what needs to be tuned for good network performance.

Drupal 6 installation on CentOS 5.x in 10 easy steps

From my NRCFOSS workshop drupal demo on a CentOS 5.2 host.

0. Logon to the Linux CentOS host from putty or any ssh client . You need to have root permissions on the box you are logging into. If you have root permissions granted to you by sudo then
sudo su - should do the trick. Or else su - and use root's password to change over to root user. Typically distributions might not allow root user to login remotely from ssh.

1. Get a DNS/hosts entry for hostname resolution pointing to the server where you want to create your site. Test it.
If you are only testing the drupal installation on your own machine or on a Virtual Machine on your machine then you only need to make entries into the respective hosts files of the both the Drupal-Host and the Desktop on which you are working. On a Linux machine add

to /etc/hosts
and on windows add it to notepad \system32\drivers\etc\hosts

Note: Windows Vista prevents you from directly editing your system files as an ordinary user so use the
runas Windows-Hostname\"" "notepad \system32\drivers\etc\hosts" instead.

2. a) Check if httpd,php,mysql and php-mysql packages are installed on your machine.
rpm -q httpd
rpm -q php
rpm -q mysql
rpm -q php-mysql
If any of the packages are not installed then install them using the yum command

yum install php mysql httpd php-mysql

Create a virtualhost(the sample VirtualHost config is already there in httpd.conf file normally found in /etc/httpd/conf folder on a RHEL/CentOS box) use a simple index.html file.
a) Sample Virtual Host Config

ServerAdmin
DocumentRoot /home//www
ServerName www.
ServerAlias
ErrorLog /home/aviral/logs/-error_log
CustomLog /home/aviral/logs/-access_log common

b) Locate the following in httpd.conf

Options FollowSymLinks
AllowOverride None

and change it to

Options FollowSymLinks
AllowOverride All

This is required for enabling .htaccess file that contains the configuration for clean urls in Drupal. Make sure apache/httpd user is able to access your VirtualHost's Document Root

3. Create a database and grant it permissions.
a) Logon to mysql as root using the following command
mysql -uroot -h -p
b) Create database
mysql>create database
c) Grant permissions to a mysql user which would be used by Drupal.
mysql> grant all on to @'%' identified by 'drupalpassword';
4. a) Download latest version of Drupal
wget http://ftp.drupal.org/files/projects/drupal-6.6.tar.gz
b) extract it
tar -zxvf drupal-6.6.tar.gz
c) Create a folder for your drupal installation
mkdir -p /home//www
d) copy over your drupal files
cp -r drupal-6.6/* /home//www/
and
.htaccess file
cp -r drupal-6.6/.htaccess /home//www/
d) Grant permissions for apache user to be able to access it
chmod 755 /home/
chown -R apache.apache /home//www/

5. Make sure the httpd and mysql services are started/restarted
/etc/init.d/httpd restart
/etc/init.d/mysql restart
and to check the status
/etc/init.d/httpd status
/etc/init.d/mysql status
If the status shows up as not running then check the errors for httpd in /var/log/httpd/error.log using
tail -f /var/log/httpd/error.log on another terminal.
MySQL errors are logged to an error file in /var/log/mysql.log again see any errors during a restart/start using
tail -f /var/log/mysqld.log

6. Add the services to the runlevels for restarting the next time
chkconfig --levels 2345 httpd on
chkconfig --levels 2345 mysqld on

7. Installation
a) Create a settings file required by installer
cp /home//www/sites/default/default.settings.php /home//www/sites/default/settings.php
chown apache.apache /home//www/sites/default/settings.php
chmod 777 /home//www/sites/default/settings.php
b) Run through drupal installation from your browser by pointing to the hostname of your site at http://

8. Install any missing dependencies as pointed out by the drupal web based installer.

9. Post installation
a) Enable cron job on Drupal host.
crontab -e to add the following line to your crontab file
5 * * * * /usr/bin/wget http:///cron
b) Enable blog and other optional modules under admin pages at
http:///admin/build/modules if you enabled clean urls during installation or clickthrough to
Administer->Site Building->Modules

10. Voila, make you can make your first blog post from
Create Content->Blog Entry
Remember to assign a friendly URL to your blog post.

Speaking at NRCFOSS Linux and FOSS workshop

FOSS Workshop at Seth Jai Parkash Mukand Lal Institute of Engineering and Technology (JMIT)
7th (Fri) & 8th (Sat) Nov 2008
A FOSS introductory workshop is being organized to be held at JMIT, Raudaur, for Lecturers/Professors of computer / electronic streams at JMIT and neighboring colleges. Proposed strength is 40 participants, which will also include some student members.

Improving linux IO performance

1. Mount options: use noatime

Most Linux server machines can do without last access time modified for every file and each directory which is being read. So I'll just go ahead and re-quote for the nth time what Linux Kernel developer Ingor Molar has to say to emphasize the point.
<Quote>
i cannot over-emphasise how much of a deal it is in practice. Atime
updates are by far the biggest IO performance deficiency that Linux has
today. Getting rid of atime updates would give us more everyday Linux
performance than all the pagecache speedups of the past 10 years,
_combined_.
<Quote/>

You can simply remount your filesystems without rebooting your machine using.
As an example:-
/bin/mount -t ext3 -o noatime ext3 /dev/sda5 /

And don't forget to modify corresponding lines in your /etc/fstab
/dev/sda5 / ext3 noatime 1 1

2. Use tmpfs
Speedup heavy read-write IO for temporary data stores by by using memory instead of disk.

3. On systems not constrained for memory reduce swappiness of the Linux machine
/bin/echo "10" > /proc/sys/vm/swappiness

4. Set blockdev readahead to a reasonable value to improve read performance
/sbin/blockdev --setra 131072 /dev/sda

The default readahead value is too small.

Syndicate content Syndicate content