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

How to Add Firewall Service to Vultr Instance

Vultr announced firewall service and it’s time to stop system built-in firewall. I will walk you through how to add firewall service to your vultr instances step by step in this tutorial.

Before the details, I am showing you the steps. First, add a firewall group. Second, add firewall rules to the firewall group. Third, link instances to this firewall group.

Add a firewall group

Navigate to Servers–>Firewall, click Add Firewall Group, then fill in the blank by entering a firewall description.

Add vultr firewall group

Add firewall description

Add rules

Vultr firewall service supports ICMP, TCP, UDP and GRE protocols. ICMP protocol is used for ping service, if you allow others to ping your vultr instances, please add a rule to accept ICMP packets. TCP and UDP protocols are two commonly used protocols. Here is a list of protocols and ports that you may want to accept packets from:

  • HTTP: TCP 80
  • HTTPS: TCP 443
  • SSH: TCP 22
  • FTP: TCP 21 20
  • MySQL: TCP 3306

You can filter the packets by source, 0.0.0.0/0 accetps packets from anywhere. If you want to allow SSH connection from a specific IP and reject other sources, you choose Custom and fill in the blank next to source by entering an IP address and sub-net mask. For example, if you accept SSH access from 11.22.33.44, then fill the blank with 11.22.33.44/32.

There is a cross sign and trash bin on the right. Adding a rule by clicking cross sign, while removing a rule by clicking trash bin sign.

Add firewall rules

Link to instances

Congrats, you are almost done, only one step left. Choose the instance you want to link and click the cross sign on the right. Wait for less than 120 seconds, and the firewall has been actived for the instance.

If you want to unlink instances, by click the unlink sign on the right of each linked instances. It also takes less than 120 seconds to take effect.

unlink vultr instances

Performance Benchmark of Vultr $2.5 plan

Vultr announced $2.5 per month plan about a week ago, and I was wondering how the performance is for such a low price. Here is a basic performance test of this VPS hosting plan, including hardware basic information, I/O test, network speed test and unixbench test.

The performance test was run on the following environment:

  • CPU: 1 core
  • Memory: 512MB
  • Storage: 20GB of SSD
  • OS: CentOS 6.8
  • Data center: Silicon Valley

Before showing test results, I would like to declare that the results may variable in different data center regions or on different server node. Even in the same server node, it may affected by other users, especially bad-neighbors and the test results variable from time to time.

Basic test

I was using a shell script from bench.sh, this test will show you the basic information of the VPS environment, I/O results and network speed results. From the screenshot below, I found the network connection  is a 1Gbps port at least, which was not disclosed on pricing page.

basic information about the VPS

CPU and Memory information

From the above test, we only see a brief information about CPU and memory, we can use linux command to get the detailed information about CPU and memory.

Here is a screenshot of running the command cat /proc/cpuinfo.

cpu information

Here is a screenshot of running the command of cat /proc/meminfo.

memory information

Unixbench

Unixbench is a popular server benchmarking tool. The results will depend not only on hardware, but on operating system, libraries, and even compiler. We don’t need to understand the complex algorithm inside the program, we just need to know whether the index scores is more than 1000. If it is, the performance is not bad. Vultr’s final index scores is 1337, and the performance is not bad.

unixbench benchmark vultr

Conclusion

According to the above test results, Vultr’s $2.5 plan is worth buying. The test results is better than I expected. Several hours later, I deployed another $5 plan instance, and the benchmark results are more or less the same even though the price is doubled.

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

Vultr add Firewall to Feature List

I am very glad that Vultr added Firewall service to the feature list, this is the most wanted feature second to backup service, which has been announced. Compared to system built-in firewall, there are some advantages:

  1. Reduce resource usage of instance, because package filtering takes place at a higher level on the network.
  2. Vultr firewall is managed through the Vultr control panel, it’s much more straightforward than Linux built-in firewall service which is configured in command line interface.
  3. Vultr firewall group can be applied to multiple instances, really a time-saver.

Vultr firewall is flexible and easy to use. First, create a firewall group. Second, add desired rules to firewall group. Third, apply a firewall group to a server.

Before you apply firewall to instances, you should know the differences between Vultr Firewall and Vultr DDOS protection service. Vultr Firewall is designed to enhance the security while DDOS protection is designed to block large volumes of traffic based on proprietary detection algorithms. Vultr Firewall may a little helpful in certain circumstances, because it can be used to block certain IP protocols or source IPs by rules.

It’s time to stop system built-in firewall and enjoy the convenience of Vultr web-based firewall service.

Vultr Upgraded All Plans and Announced $2.5 Instance

Vultr just upgraded all plans and announced a $2.5 per month plan, which comes with 1 CPU core, 512MB of memory, 20GB of SSD storage and 500GB of data transfer. Will you agree with me that Vultr is fighting back Linode which upgraded their plans two weeks ago.

This is a price list of upgraded plans:

How to upgrade for existing customers?

Please navigate to settings–>change plan and select the right plan, please note that downgrade is not supported. Here is a screenshot of how to upgrade plan.

Enjoy Vultr.