How to Limit CPU Usage of a Process in Linux with CPULimit

Cpulimit is used to restrict the CPU usage of a process and offers more usage options compared to other tools. One important difference is that cpulimit doesn’t manage system load unlike cputool.

Install CPULimit to Limit CPU Usage Of a Process in Linux

CPULimit is available to install from default software repositories of Debian/Ubuntu and its derivatives using a package management tool.

$ sudo apt install cpulimit

In RHEL/CentOS and Fedora, you need to first enable EPEL repository and then install cpulimit as shown.

RHEL/CentOS 7 64 Bit

## RHEL/CentOS 7 64-Bit ##
# wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
# rpm -ivh epel-release-7-9.noarch.rpm

RHEL/CentOS 6 32-64 Bit

## RHEL/CentOS 6 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm
## RHEL/CentOS 6 64-Bit ##
# wget http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# rpm -ivh epel-release-6-8.noarch.rpm

RHEL/CentOS 5 32-64 Bit

## RHEL/CentOS 5 32-Bit ##
# wget http://download.fedoraproject.org/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh epel-release-5-4.noarch.rpm
## RHEL/CentOS 5 64-Bit ##
# wget															

Read More


Useful FirewallD Examples

Firewalld replaced old Fedora’s firewall (Fedora 18 onwards) mechanism, RHEL/CentOS 7 and other latest distributions rely on this new mechanism. One of the biggest motive of introducing new firewall system is that the old firewall needs a restart after making each change, thus breaking all active connections. As said above, that the latest firewalld supports dynamic zones which is useful in configuring different set of zones and rules for your office or home network via a command line or using a GUI method.

Initially, firewalld concept looks very difficult to configure, but services and zones makes it easier by keeping both together as covered in this article.

Before implementing firewalld rules, make sure to first check whether firewalld service enabled and running.

# systemctl status firewalld

The above picture shows that firewalld is active

Read More


5 Must have Tools for monitoring network on your Linux server

1. Nload

Nload is a commandline tool that allows users to monitor the incoming and outgoing traffic separately. It also draws out a graph to indicate the same, the scale of which can be adjusted. Easy and simple to use, and does not support many options.

So if you just need to take a quick look at the total bandwidth usage without details of individual processes, then nload will be handy.

$ nload

Installing Nload – Fedora and Ubuntu have got it in the default repos. CentOS users need to get nload from Epel repositories.

# fedora or centos
$ yum install nload -y

# ubuntu/debian
$ sudo apt-get install nload

2. iftop

Iftop measures the data flowing through individual socket connections, and it works in a manner that is

Read More


Measure disk performance with fio and IOPing and why DD is bad

Introduction

Whether it’s a server or a PC, usually the main bottleneck or what limits performances is disk speed. Even if using SSDs, their speed is not yet comparable to that of RAM and CPU.
There are different tools disks speed, some of them however are wrong. The main of which is to use dd, for example:

dd if=/dev/zero of=test_file bs=64k count=16k conv=fdatasync

DD is the worst software for benchmarking I/O performance.

In fact:

  • it is a single-threaded, sequential-write test. Of course, if running a web server, services do not do long-running sequential writes, and use more than one thread
  • it writes a small amount of data, so the result can be influenced by caching or by RAID’s controller
  • it executes for just a few seconds, and everyone knows that in this way it’s not possible to

    Read More


Setup a Ghost Blog on Ubuntu 16.04

Introduction

Ghost blog is a very popular, fast and open source blogging and publishing platform,  written in JavaScript, using the Node.js framework. As stated on the their website, “the inventors of JavaScript, Android and StackOverflow all use Ghost for their blogs”.

So let’s install and configure Ghost on an Ubuntu 16.04

Getting started – Install Node.js

It is possible to install Node.js using NodeSource binary distributions repository. To accomplish this task, execute the following commands:

$ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
$ sudo apt-get install -y nodejs

Install build tools, required for building and installing npm, with apt:

# apt-get -y install build-essential

Install Ghost

If it doesn’t already exist, create the directory /var/www/:

# mkdir -p /var/www/

There, download Ghost, grabbing the latest

Read More