Linux Server Benchmark Tool: UnixBench

UnixBench is the most popular unix-like system benchmarking application, multiple tests are used to test server’s performance. As a web administrator, we may don’t need to know the fundamental algorithms, but we should know some basic information about UnixBench which are outlined below.

  1. UnixBench tests several aspects of server’s performance, including CPU, memory, I/O, graphics and etc, so the result score is an overall score.
  2. These test results are compared to the scores from a baseline system to produce an index value, which is generally easier to handle than the raw scores. The entire set of index values is then combined to make an overall index for the system.
  3. The higher index scores are, the better servers perform.

Now, you may have a brief idea of what UnixBench is, let’s install and run the tests. I am running UnixBench on a CentOS VPS from Vultr for demo.

First, installing server environment.

yum -y install gcc gcc-c++ make libXext-devel perl perl-Time-HiRes X11-devel mesa-libGL-devel perl-Time-HiRes unzip

Second, downloading and running.

wget https://github.com/kdlucas/byte-unixbench/archive/master.zip
unzip master.zip
cd byte-unixbench-master/UnixBench
./Run

Finally, waiting for the result scores.

Here is a screenshot of UnixBench scores on a $5 Vultr instance, which including 1 CPU core, 1G of memory and 25GB of SSD storage.

How to Synchronize Files with Rsync

Rsync, short for remote sync, is a versatile file copying and synchronizing tool for unix based systems. Compared to ‘cp’ command, rsync is more powerful and flexible. First, rsync only copies the delta files between the source and the destination, it could save copious amounts of time and system resources. Second, rsync is able to compress files as they are being transferred.

In this tutorial I will show you how to use rsync to synchronize files locally and remotely, it’s basic use of rsync, but it will cover almost usages a web admin needs.

Rsync usually comes with system, if it is not installed, please run the following command, take CentOS for example.

yum -y install rsync

Now, it’s time to move on, here is the basic syntax of rsync:

rsync [option] source destination

Rsync has a lot of options, here is a short list of commonly used options. If you want to dig deeply into this tool, take a loot at this page.

-a, archive mode, copies files recursively and preserves users, groups, file permissions, and timestamps.

-h, output numbers in a human-readable format.

-v, increase verbosity, this is especially useful when synchronizing large amounts of data.

-z, compress file data during the transfer.

-delete, delete extraneous files from destination directory. Any files and directories at the destination will be deleted if they aren’t at source.

Examples

rsync -av /home/web1/ /home/backup/

This example will synchronize all the contents in /home/web1/ directory into /home/backup/ directory, but the web1 directory will not be created in /home/backup/ directory. If you want to create the web1 directory at the same time, please drop the slash at the end of source path.

rsync -av /home/web1 /home/backup/

Here is a screenshot shows the local synchronization process.

rsync synchronize files locally

The above example shows how to synchronize files locally, here is another example shows how to synchronize files to remote host. Please replace ‘user’ with your remote host’s user.

rsync -avz /home/web1 user@11.22.33.44:/home/backup/

You will be promoted for the remote user’s password. Besides, the remote users must also have write permissions for the target directory.

Here is a screenshot shows the remote synchronization process.

rsync synchronize files remotely

Traffic Monitor: vnStat

vnStat is a console-based network traffic monitor for Linux and BSD that keeps a log of network traffic for the selected interface(s). It uses the network interface statistics provided by the kernel as information source. This means that vnStat won’t actually be sniffing any traffic and also ensures light use of system resources.

Installation

It’s easy to install vnStat, just run the following command in your console (for CentOS), and that’s all you need to do.

yum -y install vnstat

Create vnStat database

Before create vnStat database, make sure which network interface you want to monitor, take eth0 for example.

vnstat -u -i eth0

It’s done, and vnStat is gathering traffic information for you, both received and transfered.

Command Manual

vnstat -h Show traffic statistics on a hourly basis for the last 24 hours.

vnstat -d Show traffic statistics on a daily basis for the last 30 days.

vnstat -m Show traffic statistics on a monthly basis for the last 12 months.

vnstat -l Display current transfer rate for the selected interface in real time until interrupted.

Statistics will be shown after interruption if the runtime was more than 10 seconds.

The commands above are commonly used, for detailed manual please take a look at official manual page.

Troubleshooting

If you were encountered a problem of “eth0: Not enough data available yet.”, please make sure vnStat is running. Here is the command of check the status:

/etc/init.d/vnstat status

If it wasn’t running, run the follwoing command and you will able to get traffic information in 5 minutes.

/etc/init.d/vnstat start

Virtualization Type Detector: Virt-What

Virt-What is a shell script which can be used to detect what type of virtualization your virtual machine is using. Virt-what supports a very large number of different hypervisor types, such as Xen, KVM, openVZ, VMware and much more.

It’s pretty easy to run by typing virt-what into the terminal, here is a screenshot of the output result on a Vultr instance.

If nothing is printed and the script exits with code 0 (no error), then it can mean either that the program is running on bare-metal or the program is running inside a type of virtual machine which we don’t know about or cannot detect.

Virt-what is already packaged in common Linux distributions, you can also compile if from source.

wget https://people.redhat.com/~rjones/virt-what/files/virt-what-1.15.tar.gz
tar -zxvf virt-what-1.15.tar.gz
cd virt-what-1.15
./configure
make&&makeinstall

Virt-what is a small but useful tool, it could help you detecting what type of virtualization is if it was not detailed.