COLO - Coarse Grain Lock Stepping: Difference between revisions

From Xen
Jump to navigationJump to search
mNo edit summary
Line 1: Line 1:
COLO or Coarse Grain Lock Stepping is an High Availability solution that builds on top of [[Remus]]. It is one of the features that is tracked in the [http://lists.xenproject.org/archives/html/xen-devel/2014-06/msg02597.html Xen 4.5 Development Update].
COLO or Coarse Grain Lock Stepping is an High Availability solution that builds on top of [[Remus]]. It is one of the features that has been updated in [[:Category:Xen 4.5|4.5]].


= Background =
= Background =

Revision as of 12:33, 9 February 2015

COLO or Coarse Grain Lock Stepping is an High Availability solution that builds on top of Remus. It is one of the features that has been updated in 4.5.

Background

COLO FT/HA (COarse-grain LOck-stepping Virtual Machines for Non-stop Service) project is a high availability solution. Both primary VM (PVM) and secondary VM (SVM) run in parallel. They receive the same request from client, and generate response in parallel too. If the response packets from PVM and SVM are identical, they are released immediately. Otherwise, a VM checkpoint (on demand) is conducted. The idea is presented in Xen summit 2012, and 2013, and academia paper in SOCC 2013.

Components

  • COLO Manager:
    • COLO Controller - Modifications of save/restore flow (based on Remus).
    • COLO Disk Manager - When primary VM writes data into image, the colo disk manger captures this data
and send it to secondary VM’s which makes sure the context of secondary VM's image is consentient with
the ontext of primary VM 's image.
  • COLO Agent
We need an agent to compare the packets returned by Primary VM and Secondary VM
and decide whether to start a checkpoint according to some rules. It is a linux kernel module
for host.

Current Status

COLO (based on xm) has already been in development for over three years. A paper has come out at 2013. Since XEN has deprecated xm and turn to xl, we are implementing COLO on xl now. The overall status of COLO:

Requirements

Hardware requriements

There is at least one directly connected nic to forward the network requests from client to secondary vm. The directly connected nic must not be used by any other purpose. If your guest has more than one nic, you should have directly connected nic for each guest nic. If you don't have enouth directly connected nic, you can use vlan.

Dom0 requirements

  1. Kernel with dom0 support
  2. kernel module
    1. sch_ingress
    2. cls_basic
    3. cls_tcindex
    4. cls_u32
    5. act_mirred
    6. ifb
    7. blktap2
  3. libnl-tools >= 3.0. This package provides the command nl-qdisc-list, and colo need this command.
  4. If your host os has OEM-released xen tools, please uninstall it first.
  5. You can load the module which is not provided by OEM.
Note: Only SUSE may provide blktap2 module. If your kernel don't have it, you can build it:
a. Export the symbol zap_page_range() from kernel
b. Get the blktap2 source from [https://github.com/wencongyang/blktap]

Guest requirements

Only HVM guest(without pv extensions) is supported now. If you want to use OEM released guest os, please use SUSE. REDHAT and Ubuntu is not supported now because I don't find any way to disable pv extensions. If you want to use REDHAT or Ubuntu, you need to build the newest kernel which has the parameter xen_nopv.

Setup COLO environment

  1. Build and install xen
  2. Apply the patch for qemu xen, and rebuild xen tools:
    1. cd into tools/qemu-xen-dir
    2. use git am to apply the patch: <TODO>
    3. make tools && make install-tools
    4. Note: You must use qemu-xen. qemu-xen-traditional is not supported.
  3. Install the guest
    1. Add "xen_platform_pci=0" into the guest configfile
    2. If you use suse, please select physical machine
    3. copy the disk image to the other host
  4. Install COLO agent module:
    1. Download COLO agent, and compile it
    2. Install it: it is the kernel module, so copy the module to the directory /lib/modules/<version>/updates/, and run depmod.
  5. Update your guest config file for COLO:
    1. disk
      1. disk = [ 'format=raw,devtype=disk,access=w,vdev=hda,backendtype=tap,filter=colo,filter-params=192.168.3.1:9000,target=/root/images/hvm/hvm_nopv/hvm.img' ]
    2. nic
      1. vif = [ 'mac=00:16:4f:00:00:11, bridge=br0, model=e1000, forwarddev=eth0' ]
    3. NOTE:
      1. The ip/port in filter-params is the secondary host's IP. Don't use the directly connected nic's IP.
      2. forwarddev is the directly connected nic.
      3. If you have more than one disk, filter-params must be different
  6. Load the module ifb - We need to two ifb nics for each virtual nic, you can load ifb like this:
    1. modprobe ifb numifbs=100
  7. NOTE: Secondary host only need to do step 1-2.

Run COLO

xl remus -c -u <domname> <secondary host IP>

Note: The ip must not be the directly connected nic's IP.

Performance tunning

  • colo agent
    • The COLO agent module doesn't include codes which are experimental and improve the performance. The codes are in the branch experimental. If you use this branch, you need to load some kernel modules by hand after running COLO. The module sch_colo_ipv4 should be loaded before loading sch_colo_icmp, sch_colo_tcp and sch_colo_udp.
  • Guest
    • Disable the following tcp option: tcp_sack, tcp_dsack, tcp_timestamps. Add the following lines to /etc/sysctl.conf and then run `sysctl -p`:
net.ipv4.tcp_sack=0
net.ipv4.tcp_dsack=0
net.ipv4.tcp_timestamps=0
  • Host
    • The primary host and secondary host date should be the same
    • If you build dom's kernel, irqbalance service may not start. COLO uses more than one nic, and you should bind each nic's irq to one cpu.

Known problems

  1. Secondary vm may crash due to triple fault.
  2. The heartbeat is not reliable. If you want to test the performance, please disable the heartbeat(modify the xen codes). You can use the branch colo-v4-noheartbeat.
  3. Suspending the vm fails, and the error message is:
libxl: error: libxl_qmp.c:429:qmp_next: timeout
NOTE: Problem 1 and 3 don't happen every time. So you can run colo again to
avoid this problem.

Example

If you use SLES11.3, you can get the detailed steps from the wiki: Setup COLO on SLES11 SP3

Trouble shooting

If there's some error happend when staritng COLO, you can do:

  1. Make sure you have all necessary modules that DOM0 needed on both side.
  2. Make sure you have followed all the instructions in this README.
  3. Try to reboot both primary and secondary host.
  4. If you still have problems, collect the error logs and contact Wen Congyang(wency@cn.fujitsu.com) for help.

Links

For more information see: