Installation

How to install nPerf Server (version 2.1.x and newer)

Summary

nPerf recommends using Debian, Ubuntu or CentOS for a quick start. However, the nPerf binary is compatible with all Linux 64-bits distributions.

Prerequisites

The requirements for nPerf server hosting are the following :

  • CPU 2-core 1,6 GHz+ (2,4 GHz+ for 10G connections)
  • RAM 4 GB
  • HDD 10GB
  • Network 1 Gbps symmetric or more
  • This can be a VM (VMWare, Xen, KVM...)

It's highly recommended to use a dedicated server (or VM) because nPerf server needs to listen on standard ports (like 80 & 443). Installation on a dedicated machine is easier.

Configure your firewall to allow the following INCOMING connections from ANYWHERE :

  • INCOMING TCP on port 80
  • INCOMING TCP on port 443
  • INCOMING TCP on port 8080 (or 8081)
  • INCOMING TCP on port 8443

Configure your firewall to allow the following OUTGOING connections to ANYWHERE :

  • OUTGOING UDP on port 53 (for DNS queries)
  • OUTGOING TCP on port 80 (for HTTP queries)
  • OUTGOING TCP on port 443 (for HTTPS queries)

Before starting

nPerf uses HTTP for serving binary files. This implies that if you are using a HTTP server like Apache or Nginx, you'll have to care about this.

You have 2 ways :

  • Use nPerfServer for serving HTTP files : Recommended if your server is dedicated to nPerf. Consumes less memory (no RAM disk needed). Moreover, using nPerfServer for serving HTTP files is the optimal way. Note: You cannot go this way if you are hosting other services on HTTP.
  • Keep your actual HTTP server for serving HTTP files : Recommended if you are hosting other services on HTTP. nPerfServer will only serve TCP & WebSockets connections. RAM disk of 1.2 GB is required for optimal performances. To achieve this way, you'll have to follow the optional step

Debian/Ubuntu

Supported systems for deb packages are :

  • Debian 8 "Jessie" 64 bits !!! End of Life !!!
  • Debian 9 "Stretch" 64 bits
  • Debian 10 "Buster" 64 bits ← recommended
  • Ubuntu 16.04 LTS "Xenial" 64 bits
  • Ubuntu 18.04 LTS "Bionic Beaver" 64 bits ← recommended

Debian 8/9/10 & Ubuntu 16.04/18.04 LTS are fully supported for nPerfServer installation, you can get it working in one minute by using nPerf repository :

Please log in as root before running the following commands. You can login as root with sudo -i

Installation

apt-get -y install lsb-release gnupg &&\
wget -O - https://repo.nperf.com/apt/conf/nperf-server.gpg.key | apt-key add - &&\
echo "deb [arch=amd64] http://repo.nperf.com/apt $(lsb_release -sc) main non-free" >> /etc/apt/sources.list.d/nperf.list &&\
apt-get update &&\
apt-get -y install nperf-server

Config file

Edit the config file if needed : /etc/nperf/nperf-server.conf (If you wanna use your legacy HTTP server, set REDIRECT_PORT_80 to 0)

Start server

Then start nPerfServer : /etc/init.d/nperf-server start

To start automatically nPerfServer with the system, please run: systemctl enable nperf-server

Validate

Check your server is running: https://server-check.nperf.com/

Auto-Updates

You want the system to auto-update itself and always stay up-to-date?
Follow our guide : Debian/Ubuntu Auto Update How-To

Please contact us and tell us you have installed your server!
If you have not already opened a ticket on your helpdesk, please use this form: https://www.nperf.com/contact/

CentOS/RedHat

Supported systems for rpm packages are :

  • Red Hat Enterprise Linux 6 64 bits (nPerfServer 2.2.x versions and above are not compatible)
  • Red Hat Enterprise Linux 7 64 bits
  • Red Hat Enterprise Linux 8 64 bits ← recommended
  • CentOS 6 64 bits (nPerfServer 2.2.x versions and above are not compatible)
  • CentOS 7 64 bits

CentOS 7 & RedHat 7/8 are now fully supported for nPerfServer installation, you can get it working in one minute by using nPerf repository :

Please log in as root before running the following commands. You can login as root with sudo -i

Installation

yum -y install yum-utils wget &&\
rpm --import https://repo.nperf.com/conf/nperf-server.gpg.key &&\
wget https://repo.nperf.com/rhel/nperf-server.repo -O /tmp/nperf-server.repo &&\
yum-config-manager --add-repo /tmp/nperf-server.repo &&\
yum check-update

yum -y install nperf-server

Config file

Edit the config file if needed : /etc/nperf/nperf-server.conf (If you wanna use your legacy HTTP server, set REDIRECT_PORT_80 to 0)

Start server

Then start nPerfServer: /etc/init.d/nperf-server start

To start automatically nPerfServer with the system, please run: systemctl enable nperf-server

Special note for RHEL 8

On RHEL8, firewalld is activated by default. You have to setup rules to allow incoming traffic

firewall-cmd --zone=public --add-port=80/tcp --permanent
firewall-cmd --zone=public --add-port=8080/tcp --permanent
firewall-cmd --zone=public --add-port=443/tcp --permanent
firewall-cmd --zone=public --add-port=8443/tcp --permanent

Validate

Check your server is running: https://server-check.nperf.com/

Please contact us and tell us you have installed your server!
If you have not already opened a ticket on your helpdesk, please use this form: https://www.nperf.com/contact/

Optional: Using an external HTTP Server

If you are hosting other services over HTTP or HTTPS on the same machine, you'll have to keep your working HTTP server installation.
However, nPerf services need to access some files over HTTP too, so you have to setup your server to serve them.
Please note this is an additionnal step, you have to follow the previous step and install nPerfServer first.

REMINDER: If your server is fully dedicated to nPerf, you don't have to follow this step !!!

Make a ramdisk

In order to get efficient speed, we need to read files directly from RAM, this avoid to be limited by the HDD/SSD throughput and generating CPU iowait on the system.
RAM disk size is 1.2 GB. This means it will use 1.2 GB of RAM. Use free -h to see available RAM.

We assume your HTTP DocumentRoot is in /var/www/html. Of course, you can adapt it to your needs.

mkdir -p /var/www/html/nperf
echo "tmpfs   /var/www/html/nperf   tmpfs   defaults,size=1200M   0 0" >> /etc/fstab
mount /var/www/html/nperf

Create a nperf user

addgroup nperf
adduser nperf --home /home/nperf --shell /bin/bash --disabled-password --gecos nperf --ingroup nperf

Create HTTP Files

su - nperf
mkdir http-files
echo "OK" > http-files/latency.txt
wget https://repo.nperf.com/conf/upload.php.src -O http-files/upload.php

Generate binary files (this can take few seconds)

dd if=/dev/urandom bs=1048576 count=10 of=http-files/10MiB.dat
dd if=/dev/urandom bs=1048576 count=100 of=http-files/100MiB.dat
dd if=/dev/urandom bs=1048576 count=1024 of=http-files/1GiB.dat

Return as root

exit

Copy files to ram disk

cp -pu /home/nperf/http-files/* /var/www/html/nperf/

Make it persistent on reboot using cron:

echo "@reboot root cp -pu /home/nperf/http-files/* /var/www/html/nperf/" >> /etc/cron.d/nperf-ramdisk

Virtual Hosts

If you are using a VirtualHost for serving nPerf HTTP files (nperf.example.com in our example), you have to add an alias for *.nperf.net.

For Apache

<VirtualHost *:80>
  ServerName nperf.example.com
  ServerAlias *.nperf.net
  
  # ...
</VirtualHost>

For Nginx

server {
    listen       80;
    server_name  nperf.example.com  *.nperf.net;
    ...
}