Oskar Stolc's Howto Collection

Articles by Oskar Stolc

HAProxy - Performance Tuning

  • use 2 distinct NICs
  • ensure connection tracking is off !!!
  • add to haproxy.cfg
option http-server-close
  • add to /etc/sysctl.conf
net.ipv4.ip_local_port_range = 1024 65000
  • If still not good, try the following (or buy a HW load balancer)
net.ipv4.tcp_tw_reuse = 1
net.core.somaxconn = 10000
net.ipv4.tcp_max_syn_backlog = 10000 …

HAProxy on CentOS 6

In this blog we will learn how to do server load balancing with HAProxy.

Our example setup will use a two-node active-standby high availability HAProxy cluster configured with three VIPs. Each HAProxy node will have its own stats page for monitoring.

IP Assignments

  • haproxy01.example.com: 192.168.40.191 …

OpenVZ - How to detect OpenVZ

This howto shows how to detect OpenVZ support on the host and in the container.

#!/bin/bash

if [ -f /proc/user_beancounters ] ; then
        envID=$(cat /proc/1/status |grep envID |cut -f 2)
        if [ $envID -eq 0 ] ; then
                echo "OpenVZ Host"
        else
                echo "OpenVZ Guest"
        fi
else
        echo "Not OpenVZ"
fi …

KVM Hypervisor on CentOS 6

In this blog we will learn how to set up a KVM hypervisor.

The linux kernel itself is the hypervisor. All we need is to install some user space tools for managing VMs.

# yum install kvm libvirt python-virtinst qemu-kvm bridge-utils

Then we need to start the libvirt daemon

# chkconfig libvirtd …

OpenVZ - Create a Container on ploop

This howto shows how to create an OpenVZ container on ploop

If you want all newly created containers to use ploop add this to /etc/vz/vz.conf

VE_LAYOUT=ploop

If you want to create only one container on ploop add '--layour ploop' to 'vzctl create' command

vzctl create CTID …

OpenVZ - Create a Container with VENET Interface

This howto shows how to create an OpenVZ container with VENET interface.

Create the container

vzctl create 10221 --ostemplate centos-6-x86_64 --config vswap-1g

Configure the container

vzctl set 10221 --save --name server10221
vzctl set 10221 --save --onboot yes
vzctl set 10221 --save --hostname server10221.example.com
vzctl set 10221 --save --ipadd …