Active-Active Servers and Connection Synchronisation for LVS



Similar documents
Linux Virtual Server Tutorial

Active-Active Servers and Connection Synchronisation for LVS

Creating Web Farms with Linux (Linux High Availability and Scalability)

Netfilter Failover. Connection Tracking State Replication. Krisztián Kovács

Availability Digest. Redundant Load Balancing for High Availability July 2013

Introduction to Linux Virtual Server and High Availability

Scalable Linux Clusters with LVS

Lab 5 Explicit Proxy Performance, Load Balancing & Redundancy

Introduction To Computer Networking

OpenFlow Based Load Balancing

ICS 351: Today's plan. IP addresses Network Address Translation Dynamic Host Configuration Protocol Small Office / Home Office configuration

Multiple Public IPs (virtual service IPs) are supported either to cover multiple network segments or to increase network performance.

TCP Session Load-balancing in Active-Active HA Cluster

How To Load Balance On A Cisco Cisco Cs3.X With A Csono Css 3.X And Csonos 3.5.X (Cisco Css) On A Powerline With A Powerpack (C

RESILIENT NETWORK DESIGN

Load Balancing Web Proxies Load Balancing Web Filters Load Balancing Web Gateways. Deployment Guide

Firewalls. Chien-Chung Shen

Exam 1 Review Questions

Detection of Promiscuous Nodes Using ARP Packets

Smoothwall Web Filter Deployment Guide

Transport and Network Layer

Load Balancing McAfee Web Gateway. Deployment Guide

FortiOS Handbook - Load Balancing VERSION 5.2.2

Network Security TCP/IP Refresher

Intro to Linux Kernel Firewall

Protecting and controlling Virtual LANs by Linux router-firewall

50. DFN Betriebstagung

Configuring Switch Ports and VLAN Interfaces for the Cisco ASA 5505 Adaptive Security Appliance

Configuring Oracle SDN Virtual Network Services on Netra Modular System ORACLE WHITE PAPER SEPTEMBER 2015

Binding IP Addresses To Physical Hardware Addresses

Appliance Quick Start Guide v6.21

ΕΠΛ 674: Εργαστήριο 5 Firewalls

ClusterLoad ESX Virtual Appliance quick start guide v6.3

Dynamic Host Configuration Protocol (DHCP) 02 NAT and DHCP Tópicos Avançados de Redes

hp ProLiant network adapter teaming

Subnetting,Supernetting, VLSM & CIDR

Improving DNS performance using Stateless TCP in FreeBSD 9

A Research Study on Packet Sniffing Tool TCPDUMP

IP Addressing Introductory material.

How To Run A Web Farm On Linux (Ahem) On A Single Computer (For Free) On Your Computer (With A Freebie) On An Ipv4 (For Cheap) Or Ipv2 (For A Free) (For

Computer Networks/DV2 Lab

Load Balancing Barracuda Web Filter. Deployment Guide

What is VLAN Routing?

Bridgewalling - Using Netfilter in Bridge Mode

UPPER LAYER SWITCHING

An Implementation Model and Solutions for Stepwise Introduction of SDN -A proposal of AP-GW model-

Red Hat Enterprise Linux 7 Load Balancer Administration

Introduction to IPv6 and Benefits of IPv6

Internet Protocols Fall Outline

CCNA R&S: Introduction to Networks. Chapter 5: Ethernet

Network packet capture in Linux kernelspace

Technical Support Information Belkin internal use only

Introduction. Linux Virtual Server for Scalable Network Services. Linux Virtual Server. 3-tier architecture of LVS. Virtual Server via NAT

ΕΠΛ 475: Εργαστήριο 9 Firewalls Τοίχοι πυρασφάλειας. University of Cyprus Department of Computer Science

SDN/OpenFlow. Dean Pemberton Andy Linton

Multicast-based Distributed LVS (MD-LVS) for improving. scalability and availability

Linux Virtual Server Tutorial

This How To Note describes one possible basic VRRP configuration.

Load Balancing Sophos Web Gateway. Deployment Guide

DATA CENTER. Best Practices for High Availability Deployment for the Brocade ADX Switch

Virtual PortChannels: Building Networks without Spanning Tree Protocol

Linux Virtual Server Administration. RHEL5: Linux Virtual Server (LVS)

DNS ROUND ROBIN HIGH-AVAILABILITY LOAD SHARING

An Introduction to Open vswitch

Precision Time Protocol on Linux ~ Introduction to linuxptp

Load Balancing Bloxx Web Filter. Deployment Guide

Load Balancing und Load Sharing

Appliance Quick Start Guide v6.21

Linux High Availability

OSBRiDGE 5XLi. Configuration Manual. Firmware 3.10R

short introduction to linux high availability description of problem and solution possibilities linux tools

Computer Networks. Definition of LAN. Connection of Network. Key Points of LAN. Lecture 06 Connecting Networks

Highly Available Service Environments Introduction

Load Balancing Trend Micro InterScan Web Gateway

Astaro Deployment Guide High Availability Options Clustering and Hot Standby

vsphere Networking vsphere 6.0 ESXi 6.0 vcenter Server 6.0 EN

High-Performance IP Service Node with Layer 4 to 7 Packet Processing Features

Networking Test 4 Study Guide

What communication protocols are used to discover Tesira servers on a network?

Open Source in Network Administration: the ntop Project

Appliance Administration Manual. v6.21

MLAG on Linux - Lessons Learned. Scott Emery, Wilson Kok Cumulus Networks Inc.

Load Balancing Smoothwall Secure Web Gateway

VXLAN: Scaling Data Center Capacity. White Paper

High Performance Cluster Support for NLB on Window

Network Layer IPv4. Dr. Sanjay P. Ahuja, Ph.D. Fidelity National Financial Distinguished Professor of CIS. School of Computing, UNF

OpenFlow with Intel Voravit Tanyingyong, Markus Hidell, Peter Sjödin

Load Balancing. FortiOS Handbook v3 for FortiOS 4.0 MR3

High Availability Low Dollar Load Balancing

Tempesta FW. Alexander Krizhanovsky NatSys Lab.

finger, ftp, host, hostname, mesg, rcp, rlogin, rsh, scp, sftp, slogin, ssh, talk, telnet, users, w, walla, who, write,...

Linux Distributed Security Module 1

Based on Computer Networking, 4 th Edition by Kurose and Ross

Loadbalancer.org. Loadbalancer.org appliance quick setup guide. v6.6

Computer Networks. Introduc)on to Naming, Addressing, and Rou)ng. Week 09. College of Information Science and Engineering Ritsumeikan University

Internet Working 5 th lecture. Chair of Communication Systems Department of Applied Sciences University of Freiburg 2004

CCNP SWITCH: Implementing High Availability and Redundancy in a Campus Network

2. What is the maximum value of each octet in an IP address? A. 28 B. 255 C. 256 D. None of the above

Transcription:

Active-Active Servers and Connection Synchronisation for LVS Simon Horman (Horms) horms@valinux.co.jp VA Linux Systems Japan K.K. www.valinux.co.jp with assistance from NTT Commware Coporation www.nttcom.co.jp 16th January 2004 http://www.ultramonkey.org/ 1

Introduction Layer 4 Switching The Linux Virtual Server Project (LVS) Allows networked services to scale beyond a single machine Prevailing technology for building large web sites from commodity servers. 2

Single Point of Failure A single Linux Director is a Single point of failure for the load-balanced service. Active/Stand-By This is often resolved by having two Linux Directors in an active/stand-by configuration. 3

Active/Stand-By Problems When failover occurs active connections are broken. Part 1 of this paper will address this problem by synchronising connection information between Linux Directors. One of the Linux-Directors is idle most of the time. Real Servers can scale horozontally, however the load-balancing capacity is limited to that of a single Linux-Director for a given virtual service. Part 2 of this paper will address these problems by allowing linux directors to work in an Active-Active configuration. 4

LVS Connection Synchronisation Overview I When LVS receives a new connection it selects a real server for the connection. This is done by allocating an ip vs conn structure for the connection. For each subsequent packet of a connection this structure is looked up and the packet is forwarded accordingly. The ip vs conn is also used to effect NAT when LVS-NAT is being used. Persistance is implemented by creating ip vs conn structures that act as a template for subsequent connections. 5

LVS Connection Synchronisation Overview II When fail-over occurs, the new active linux director does not have the ip vs conn structures for the active connections. Thus the connections break. By synchronising the ip vs conn structures connections can continue. Synchronisation is done using kernel daemons that send and receive synchronisation information using multicast. 6

Master/Slave Problem The existing LVS connection code relies on a sync-master/sync-slave setup The sync-master sends information about active connections, but does not recieve information. The sync-receive receives information about active connections, but does not send information. 7

Master/Slave Problem: Example There are two linux directors, director-a and director-b. Director-A is the LVS syncmaster and the active linux director. Director-B is an LVS sync-slave and the stand-by linux director. Step 1. An end user opens connection-1. Director-A receives this connection, forwards it to a real server and synchronises it to the sync-slave, director-b. 8

Master/Slave Problem: Example (continued) Step 2. A fail-over occurs and director-b becomes the active linux director. Connection-1 is able to continue because of the connection synchronisation that took place in step 1. 9

Master/Slave Problem: Example (continued) Step 3. An end user opens connection-2. Director-B receives this connection, and forwards it to a real server. Connection synchronisation does not take place because director-b is a sync-slave. 10

Master/Slave Problem: Example (continued) 4. Another fail-over takes place and director-a is once again the active linux director. Connection-2 is unable to continue because it was not synchronised. 11

Master/Slave Problem: Fix Patches are available for LVS which allow a linux director to run as a sync-master and sync-slave simultaneously. Merged into LVS in the 2.6 kernel Patches for LVS in the 2.4 kernel can be found on linuxvirtualserver.org As an alternate approage, a peer to peer synchronisation system has been developed in user-space. 12

User-Space Synchronisation Daemon Implements peer to peer connection synchronisation for LVS Synchronisation code is in userspace to allow more complex synchronisation daemons to be developed more easily. Addresses serveral deficiencies in the existing LVS synchronisation protocol. Modifies the existing synchronisation code to allow arbitary synchronisation mechanisms to be registered in the kernel. 13

Protocol Deficiencies Current protocol is very simple 4 byte header Up to 50 24 or 48 byte connection entries Synchroniation packets are up to 1248 bytes long Connections are synchronised once they pass a threshold of 3 packets. This is configurable at run-time /proc/sys/net/vs/sync threshold Connections are synchronised with a frequency of every 50 packets 14

Protocol Improvements The following improvments have been made without impacting on the simplicity of the design Addition of a checksum Addition of a version number Allow the maximum packet size to be configured at run-time /proc/sys/net/vs/sync msg max size Allow frequency to be configured at run-time /proc/sys/net/vs/sync frequency 15

User-Space Synchronisation: Implementation I 16

User-Space Synchronisation: Implementation II A User-Space Daemon communicates with LVS in the kernel using a netlink socket. Synchronisation information is sent and recieved using this socket Synchronisation information is sent to other linux directors using multicast Allows more sophisticated daemons to be developed more easily The main disadvantage is a possible performance impact. Synchronisation data is passed to user space only to have it sent over multicast which goes via the kernel However, testing showed that the netlink socket is very fast 17

Netlink Socket Performance Netlink Performance on a Pentium III 800MHz 18

LVS Core: Synchronisation Hooks I The following hooks were implemented in the LVS Core to allow arbiatry synchronisaion mechanisms to be implemented. send mesg open send close send recv loop open recv close recv Used by ipvs syncmaster to send a packet Used by ipvs syncmaster to open the socket used to send packets Used by ipvs syncmaster to close the socket used to send packets Event loop used by ipvs syncslave to receive packets Used by ipvs syncslave to open the socket that is used to receive packets Used by ipvs syncslave to close the socket that is used to receive packets 19

LVS Core: Synchronisation Hooks II The following functions are provided to register functions for these hooks ip vs sync table register ip vs sync table register default Register the hooks. If NULL is supplied for any of the hooks, then the hook will have no effect Register the default hooks The default hooks implement the existing sync master/sync slave behaviour These are registered when LVS is initialised It is envisaged that the hook functions would be implemented in a separate kernel module When the module initialises itself ip vs sync table register should be called When the module is unregistering itself, ip vs sync table register default should be called 20

ip vs user space Uses the LVS Synchronisation Hooks to pass synchronisation information to and from user-space When inserted into the kernel it registers itself Subsequent synchronisation packets recieved from the LVS Core are sent to user-space via a netlink socket Synchronisation packets recieved from the netlink socket are passed to the LVS Core Thus the functionality of both the sync master and sync slave are implemented Peer to Peer connection synchronisation may be established in place of the old master/slave relationship 21

libip vs user sync Convieneicne library for user-space programes to use a netlink socket to communicate with the ip vs user space kernel code Provides calls analogous to send(), and recv() Also provides a simple packet structure which is used for kernel/user-space communication. 22

ip vs user sync simple Bare-Bones synchronisation daemon Illustrates how libip vs user sync and ip vs user space can be used to create a user-space synchronisation daemon. Suitable for use in both active/stand-by with two linux directors and active-active configurations with any number of linux directors Sends synchronisation information information recieved via the netlink socket to other linux directors using multicast and vice versa 23

Active-Active The proposed method of providing Active-Active is to have all linux directors configured with the same Ethernet Hardware (MAC) Address and IP Address. Designed for use with linux directors Applicable for any type of host 24

MAC Addresses 48bit integer values Used by Ethernet hardware to address each other ARP is used to resolve the MAC address for an IP address ARP results are typically cached for a few minutes ARP Request/Response MAC addresses are preassigned to ethernet equipment by their manufacturer Thus the MAC addresses for NICs present on a network should be unique Non-broadcast or multicast ethernet frames sent to a given MAC address are received by a single NIC. 25

A Common MAC and IP Addresses Most ethernet hardware allows the MAC address to be changed It is possible to configure the NICs of multiple hosts to have the same MAC address If multiple hosts have the same MAC and IP then an ARP request for the common IP address will result in multiple ARP responses all with the common MAC address Subsequent packets sent to the common IP and thus the common MAC will be recieved by all of the hosts all with the common MAC address 26

Switch Port Problem Switches send packets to for a given MAC address only to the port that MAC address is attached to In this case multiple ports have the same MAC address attached But the switch may still want so send the packets down only one of these ports This means that only one Linux Director will received packets for the common IP and MAC address 27

Switch Port Solution Switches know which MAC address is connected to which port by observing packets which are received from the port If the Switch doesn t know which port a MAC address belongs to it will sent packets for that MAC address to all ports If Packets are never sent with the common MAC address then the switch is not able to associate the MAC address with a port Thus packets for the common MAC address will be sent to all ports 28

Switch Port Solution: Implementation The MAC address of the NIC is used to receive packets This is the normal behaviour Patch the Kernel so an alternate MAC address can be used to send packets Alternate MAC is set using /proc/sys/net/ipv4/conf/*/outgoing mac Simple change to ethernet.c to check this proc value and use it if set Otherwise the address of the NIC is used 29

Filtering All the Linux Directors receive all packets for the common IP address Filtering ensures that only one Linux Director load balances each connection This can be done using netfilter/ipchains Static filters are easy to establish But do not adapt as Linux Directors are added and removed 30

Dynamic Filtering Netfilter module that can have its rules changed on the fly User-Space daemon that updates the module s filter rules 31

Dynamic Filtering Block Diagram 32

Dynamic Filtering: User Space-Daemon Monitors the other Linux Directors in the cluster Master is elected to simplify resource allocations Master allocates blocks of the available connection-space to the available Linux Directors Blocks are reallocated by the master as Linux Directors join and leave the cluster If the master leaves the cluster a new one is elected 33

Blocks I It is important that the decision about which Linux Director should load balance which connection is made in advance Making this decision as connections arrive would be too slow This is done by dividing the available connections into blocks 34

Blocks II Currently this can be done by dividing the source or destination ports or IP addresses into into 512 blocks Ports are divided up using port/512, thus there are 2 16 /512 = 32 contiguous ports per block. 35

Blocks III IP addreses are divided up using (addr mod 2 16 )/512, thus there are 2 16 sub-blocks of 2 32 16 /512 = 32 contiguous addresses per block. 36

Blocks IV When a connection is recieved its block is looked up If this block has been allocated to the node by saru then the packet is accepted Otherwise it is dropped another node will accept it 37

Active-Active Applications Designed to run on Linux Directors running LVS But the design is generic - may handle any type of network packets Thus, may be used on any type of server 38

Conclusion LVS is a fast and reliable way to load balance internet services Connection tracking prevents active/stand-by linux directors from dropping connections when a failover occurs Active-Active allows linux directors to scale horozontally in the same way that LVS allow real servers to scale 39