Monitoring your Linux server load

You can easily monitor your Linux server load using built-in bash commands like

w

free

top

However, many folks prefer sysstat package (can be downloaded here, or from your Linux distribution site) package that provides even further performance monitoring utilities:

iostat

sar

vmstat

——

Login into your Linux server shell and execute the above commands. iostat, sar, vmstat can be run like

vmstat 1 10

where 1 is the time between monitoring load, 10 is the count  how many times the data need to be read.

Comments

Linux server management and tuning services

Many of our blog readers ask if we offer tuning services and support remote server management. At this time we do not offer server management services and we do not offer blog tuning either. However, from time to time we work with a nice company called LinuxAdmin guys and they do high-load and critical blog set-up,  configuration,  load balancing, management and of course full optimization. So if you are looking for a quality and very affordable remote server management or Wordpress blog hosting and management company - contact LinuxAdmin and I am sure you guys can work something out.

Comments (3)

Digg effect vs Yahoo front page listing

Many website owners are dreaming about hundreds of thousands of web visitors and thousands in ad profits, but will your web site handle the load and keep up the file serving? Probably not.

Digg frontpage listing usually sends 120.000  to 170.000 web visitors in two to three hours. It depends for how long you are listed on Digg’s frontpage and what is the topic.  In over 95% of cases this will probably be too much for simple dedicated server - if you are hosting Wordpress blog with some plugins activated (that require some extra load) and without tuning the server box.

You can activate some caching plugins (wp-cache, wp-super-cache, 1blogcacher), configure more efficient content distribution (for example, use lightweight web daemon to serve static files), use less includes and optimize plugin code for performance. This will probably handle the Digg frontpage load.

What if you land Yahoo! frontpage listing? This will be a real challenge for your systems and system administrator. Yahoo! is very popular and if your site gets listed in frontpage they can easily “send you” a few million of web visitors. Once again, depends for how long the listing will stay on the front page. Yahoo! traffic burst will definitely make your web server unreachable and I am saying this with 99.9999% confidence. You need multiple servers to handle  the load and do load balancing, and of course have upstream bandwidth available to serve the content. You need to employ perfect caching architecture, preferable keeping the page 100% static and load it in the server memory for super fast serving to web visitors. If you read it from the hard drive - your servers will experience very high IO and load, thus slowing down web responses.

Last time when one of our client’s got listed on Yahoo! frontpage the site (actually a blog) got around ~900.000 unique visitor landings, over 200.000 visitors browsed site further reading other articles and comments.  The traffic burst from two web front-end servers serving the content was close to 195Mbps (2 x 100Mbps links were fully maxed out) and I am talking about serving HTML/PHP content, not the images from these servers.

This is why you need to plan architecture to be scalable (horizontally) and easily affordable. One server box will not make it even if you get top-notch mega box for 20k USD, period.

Comments (1)

Wordpress caching plugin - 1 Blog Cacher

Ok folks, I have some great news for you - we just spot a promising wordpress caching plugin named 1 Blog Cacher.  From the list of features it looks very awesome including the file and directory structure emulation, thus you can easily remove cached directories or file cache that you require. This is a nice feature if you are using  scripts  (e.g. you want to wipe out all cache files for /2006/ directory).

Expire header option is also a very nice feature - you have full control when to expire the cache.

I am sure we will use this plugin for some in-house tests and then use it on some high load blogs we manage for our clientele. We will keep you posted!

Comments

Free live migration hypervisor based on XEN

In a previous post server virtualization vs dedicated server we discussed about increasing availability using virtual servers - hypervisors that offer Live migration in case of one virtual server failure.

Citrix has released free XenServer product that includes Live Migration feature free of charge. Very good news for low budget and small sites that require high-availability at no cost. You just need two hypervisor servers and configure Live Migration feature and you have high-availability. Check it out it’s free and you can download it straight away for in-house testing.

Comments

Server virtualization vs dedicated server

I would still love to see virtualized server in a high bandwidth environment hosting a large site with thousands of concurrent connections. I guess there is not much use for very large sites to use virtualization unless it provides advanced features like:

  • live migration
  • fail-over
  • snapshots
  • load balancing

However, virtualization software with the above features usually cost thousands of dollars and it’s out of reach for many folks that need to make some bucks from own sites and still survive occasional Digg or Yahoo frontpage landings. Dedicated servers offer 100% performance and doesn’t have any overhead… unless of course you run many servers and want to consolidate hardware.

If you have a small site or site that doesn’t generate normal income don’t worry about virtualization and high-availability ;) You can still do high-availability without virtualization. For much less, err…. almost for free - you just need to pay for the hardware and someone to set-up and run the server farm for you.

Comments

Generate static content for performance

Running a very popular and high-bandwidth website or blog? The load is killing the server? The website content is generated in real-time using PHP, .NET or CGI scripts?

You can easily increase your website performance by generating static files and serving such files much faster rather than generating files in real-time. Static files can be kept on the hard drive or in memory for blazing fast access, for example, using memcached.

Generating PHP static content
You can generate PHP output in multiple ways - from PHP code directly writing output to files or by fetching specific PHP output via HTTP protocol, or using PERL code. If you are using specific web server based values and features - you will have to fetch file via HTTP and write output to local file. This is very easy to do and doesn’t require much programming skill.

Fetching file via HTTP using WGET

wget http://www.your-domain-is-here.com/page1.php -O /var/www/page1.html

Where /var/www/page1.html is the output file.

Fetching file using CURL

curl -o /var/www/page1.html http://www.your-domain-is-here.com/page1.php

fetch -o /var/www/page1.html http://www.your-domain-is-here.com/page1.php

lynx -source http://www.your-domain-is-here.com/page1.php > /var/www/page1.html

Generating php output using a PHP script:

<?php
$files = file(”filelist.txt”);
for($i = 0; $i < count($files); $i++) {
ob_start();
include($files[$i]);
$page = ob_get_contents();
ob_end_clean();
if(strpos($files[$i], “.php”) > -1) {
$file = fopen(substr($files[$i], -4) . “.html”);
fputs($file, $page);
fclose($file);
}
}
?>

where filelist.txt is the list of the files with every file listed in new line you want it to be generated.

Perl code for fetching a remote website page. Please save the following code into the filename fetch.pl:

#!/usr/bin/perl

use LWP::Simple;
getprint “
http://www.your-domain-is-here.com/page1.php“;
$content = get( $url );
print $content;

And then run it with the following Linux command line:

perl fetch.pl > outputfile.html

In the next article we will review a solution where website content is saved to memcached and content served from fast memory-based cache without generating content on the fly.

Comments (1)

Forget LAMP use LNMP

Welcome folks. We have quite a few posts and praisings for LAMP architecture, but from now on there is a clear and better alternative - LNMP.

LNMP stands for Linux, Nginx, MySQL and PHP.

This is clearly the winner because of it’s performance and reliability you can count on.  Bundle the front-end Nginx web server with Memcached and you can serve millions of daily hits with easy on a simple commodity software. Stay tunned for more news!

Ps. for folks that still use LAMP - don’t panic, we suggest using LAMP as well, but for best performance just swap Apache with Nginx and voila !

Comments (2)

Tuning tcp keepalive intervals for high performance

We are fine tuning sysctl network stack on Linux OS and  change keepalive intervals for much better “response” times and load. These settings are lowered on our all managed performance servers that do host large sites - Drupal, Wordpress and custom LAMP services.

Enter the following lines in /etc/sysctl.conf

net.ipv4.tcp_keepalive_probes = 2
net.ipv4.tcp_keepalive_intvl = 30

And execute “sysctl -p” to set these settings in real-time.

By default it’s for Linux (Fedora, Redhat, Centos):

net.ipv4.tcp_keepalive_probes=9
net.ipv4.tcp_keepalive_intvl = 75

Enjoy!

Comments (1)

Nginx performance settings

We are running Wordpress on our multi-platform cluster and this is what we use for performance settings in nginx.conf

worker_processes 20;

events {
worker_connections 20000;
use epoll;
}

worker_rlimit_nofile 25000;

Nginx is a front-end and for backend we use Apache, however we will soon try different set-up using different architectures. I will keep you posted!

The client servers are 5400 Series Intel XEONs with 8GB RAM running Linux and SATA hard drives.

Comments