Coder Social home page Coder Social logo

cuju-ft / cuju Goto Github PK

View Code? Open in Web Editor NEW
86.0 9.0 33.0 15.03 MB

Cuju: An Open Source Project for Virtualization-Based Fault Tolerance *Provide active-passive fault tolerance service*

Home Page: https://cuju-ft.github.io/cuju-web/home.html

License: Other

Makefile 0.23% C 93.85% C++ 1.14% Haxe 0.49% Objective-C 0.11% Assembly 0.48% Python 2.25% NSIS 0.02% Shell 1.11% Perl 0.32% GDB 0.01% GLSL 0.01% SmPL 0.01%
fault-tolerance virtual-machine kvm virtualization optimization hardware-failures synchronization backup qemu active-passive

cuju's Introduction

Cuju: An Open Source Project for Virtualization-Based Fault Tolerance

================================================================

Summary

Virtualization technology could provide a unique benefit to protect any legacy application systems from hardware failures. The reliability of virtual machines running on virtualized servers is not only threatened by hardware failures beneath the whole virtual infrastructure, but also nosy hypervisors that essentially support virtual machines cannot be trusted.

We develop the opensource tool, Cuju, which is a virtualization based fault tolerance technique with epoch-based synchronization. There are several performance optimization technologies are applied by Cuju, including a non-stop/pipelined, continuously migration, dirty tracking for guest virtual memory/virtual device status, and eliminate data transfer between QEMU and KVM.

Cuju shows that these optimizations have greatly saved the processor usage, synchronization bandwidth and have significantly improved VM network throughput and latency at the same time.

For more information see: https://cuju-ft.github.io/cuju-web/home.html

Cuju Install Guide

The environment prepare


All Node Install

  • Assume you have already builded Primary, Backup and NFS node.

A recommended topology below:

  • If you only have one or two machine, you can reference this setting.

Another recommended topology below:

 $ sudo apt-get update

ubuntu-16:
 $ sudo apt-get install ssh vim gcc make gdb fakeroot build-essential \
kernel-package libncurses5 libncurses5-dev zlib1g-dev \
libglib2.0-dev qemu xorg bridge-utils openvpn vncviewer \
libssl-dev libpixman-1-dev nfs-common git

ubuntu-18:
 $ sudo apt-get install ssh vim gcc make gdb fakeroot build-essential \
kernel-package libncurses5 libncurses5-dev zlib1g-dev \
libglib2.0-dev qemu xorg bridge-utils openvpn libelf-dev \
libssl-dev libpixman-1-dev nfs-common git tigervnc-viewer
  • Set up the bridge and network environment
    • You can follow our recommended topology to set up the network environment
    • The example of network interfaces set up below (edit your /etc/network/interfaces):
  • NFS node
auto lo
iface lo inet loopback

auto eth0
iface eth0 inet static
address 192.168.11.1
netmask 255.255.255.0
gateway 192.168.11.254
dns-nameservers 8.8.8.8 

eth0 is your physical NIC name, please modify it according to your actual NIC name

  • Primary node
auto lo
iface lo inet loopback

auto br0
iface br0 inet static
bridge_ports eth0
bridge_maxwait 0
address 192.168.11.2
netmask 255.255.255.0
gateway 192.168.11.254
dns-nameservers 8.8.8.8

auto eth0
iface eth0 inet static
address 0.0.0.0

auto eth1
iface eth1 inet static
address 192.168.111.1
netmask 255.255.255.0
  • Backup node
auto lo
iface lo inet loopback

auto br0
iface br0 inet static
bridge_ports eth0
bridge_maxwait 0
address 192.168.11.3
netmask 255.255.255.0
gateway 192.168.11.254
dns-nameservers 8.8.8.8

auto eth0
iface eth0 inet static
address 0.0.0.0

auto eth1
iface eth1 inet static
address 192.168.111.2
netmask 255.255.255.0 
  • Build the high-speed connections (ex. 10G NIC) with Primary and Backup nodes by the eth1

  • After editing these network interfaces, type /etc/init.d/networking restart or reboot

NFS Node Setup

  • Install the NFS service (Network FileSystem) in NFS node; then create a NFS folder placing the VM image
 $ sudo apt-get install nfs-kernel-server
  • Insert this line in /etc/exports to add your NFS folder:
 /home/[your username]/nfsfolder *(rw,no_root_squash,no_subtree_check) 
  • After editing /etc/exports, type /etc/init.d/nfs-kernel-server restart or reboot

  • Go to your nfs folder, then download Cuju and build a VM image file (or download our Ubuntu-16.04 VM image file, the account/password is root/root), they will be synced with Primary and Backup node.

Primary and Backup Node Setup

  • Mount the NFS folder
$ sudo mkdir /mnt/nfs
$ sudo mount -t nfs 192.168.11.1:/home/[your username]/nfsfolder /mnt/nfs

Build Cuju


  • Install the appropriate version of the kernel for Cuju (only on ubuntu-18)
$ sudo apt-get install linux-image-4.15.0-29-generic
$ sudo apt-get install linux-headers-4.15.0-29-generic
  • Set appropriate version of the kernel for Cuju and reboot (only on ubuntu-18)
$ sudo vim /etc/default/grub

#GRUB_DEFAULT=0
GRUB_DEFAULT="Advanced options for Ubuntu>Ubuntu, with Linux 4.15.0-29-generic"

$ sudo update-grub

Reboot after the above modification

  • Clone Cuju on your NFS folder from Github
$ cd /mnt/nfs
$ git clone https://github.com/Cuju-ft/Cuju.git
  • Configure & Compile Cuju-ft
$ cd Cuju
$ ./configure --enable-cuju --enable-kvm --disable-pie --disable-xen --target-list=x86_64-softmmu
$ make clean
$ make -j8
  • Configure, Compile & insmod Cuju-kvm module *1 *2
$ cd Cuju/kvm
$ ./configure
$ make clean
$ make -j8
$ ./reinsmodkvm.sh

P.S.

*1 If you meet error: incompatible type for argument 5 of '__get_user_pages_unlocked', you can use this patch:

$ cd Cuju
$ patch -p1 < ./patch/__get_user_pages_unlocked.patch

*2 If you meet error: implicit declaration of function 'use_eager_fpu' [-werror=implicit-function-declaration], you can use this patch:

$ cd Cuju
$ patch -p1 < ./patch/use_eager_fpu.patch

Execute Cuju

  • Before launching your VM, you should update kvm module in Primary and Backup nodes:
$ cd /mnt/nfs/Cuju/kvm
$ ./reinsmodkvm.sh
  • Boot VM (on Primary Host, /mnt/nfs/Cuju)
  • runvm.sh
sudo ./x86_64-softmmu/qemu-system-x86_64 \
-drive if=none,id=drive0,cache=none,format=raw,file=/mnt/nfs/Ubuntu20G-1604.img \
-device virtio-blk,drive=drive0 \
-m 1G -enable-kvm \
-net tap,ifname=tap0 -net nic,model=virtio,vlan=0,macaddr=ae:ae:00:00:00:25 \
-cpu host \
-vga std -chardev socket,id=mon,path=/home/[your username]/vm1.monitor,server,nowait -mon chardev=mon,id=monitor,mode=readline

You need to change the guest image path (file=/mnt/nfs/Ubuntu20G-1604.img) and monitor path (path=/home/[your username]/vm1.monitor) for your environment

  • Use VNC to see the console
$ vncviewer :5900 &

The default account/password is root/root if you use we provide guest image

  • Start Receiver (on Backup Host, /mnt/nfs/Cuju)
  • recv.sh
sudo x86_64-softmmu/qemu-system-x86_64 \
-drive if=none,id=drive0,cache=none,format=raw,file=/mnt/nfs/Ubuntu20G-1604.img \
-device virtio-blk,drive=drive0 \
-m 1G -enable-kvm \
-net tap,ifname=tap1 -net nic,model=virtio,vlan=0,macaddr=ae:ae:00:00:00:25 \
-vga std -chardev socket,id=mon,path=/home/[your username]/vm1r.monitor,server,nowait -mon chardev=mon,id=monitor,mode=readline \
-cpu host \
-incoming tcp:0:4441,ft_mode
  • You need to follow Boot VM script to change the related parameter or you can use following script to replace Receiver start script (if your VM start script is runvm.sh)
  • recv.sh
sed -e 's/mode=readline/mode=readline -incoming tcp\:0\:4441,ft_mode/g' -e 's/vm1.monitor/vm1r.monitor/g' -e 's/tap0/tap1/g' ./runvm.sh > tmp.sh
chmod +x ./tmp.sh
./tmp.sh
  • After VM boot and Receiver ready, you can execute following script to enter FT mode
  • ftmode.sh
ubuntu-16:
sudo echo "migrate -c tcp:192.168.111.2:4441" | sudo nc -U /home/[your username]/vm1.monitor

ubuntu-18:
sudo echo "migrate -c tcp:192.168.111.2:4441" | sudo nc -w 1 -U /home/[your username]/vm1.monitor

You need to change the ip address and port (tcp:192.168.111.2:4441) for your environment, this is Backup Host's IP And change the monitor path (/home/[your username]/vm1.monitor) for your environment

  • If you successfully start Cuju, you will see the following message show on Primary side:

  • If you want to test failover You can kill or ctrl-c VM on the Primary Host

  • You will need new session with vncviewer:

    • If you have Primary Host and Backup Host, execute on Backup Host:
      $ vncviewer :5900 &
    • If you only have Primary Host with two VM:
      $ vncviewer :5901 &

cuju's People

Contributors

bradymomo avatar coldfunction avatar cuju-ft avatar flsky avatar haruzheng avatar howard-chang avatar icshen avatar jack468701 avatar jinbaohong avatar kester-lin avatar leospikeyu avatar lwcm avatar meatybobby avatar mooseclown avatar pjtpjt avatar sklin avatar supermark1995 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cuju's Issues

suggestions in README

  1. add sudo in command if working on /mnt/ directory
  2. remind user to create a directory /home/[username]/nfsfolder before exit /etc/exports in NFS Node Setup
  3. mark all path names as "Code" to increase readability.
    Thanks!

Test the installation

I would like to ask what configuration scenarios I need to build for Centos7 operating system at compile time.Could you please provide the document for reference? Thank you.

Fine-grained dirty region tracking optimization issue

In fine-grained dirty region tracking optimization
Some diff page size is 0, it means three possibilities:

  1. Page content is from A to B and change back to A
  2. Page content is not dirty but we mark it dirty
  3. Backup too late

If in case 1 or 2, we can ignore it.
In case 3, we will transfer all page, otherwise it will missing logging some dirty page.

But the correct solution is find what dirty page we backup too late
This issue is correspond to 60623ee

Reboot on FT mode

qemu-system-x86_64: migration/migration.c:2906: migrate_timer: Assertion `!kvm_shm_clear_dirty_bitmap(s->cur_off)' failed.

I think it need to make it re-sync

Does Cuju guarantee consistency between checkpoints and shared persistent storage?

Hi,

I'm new to VM fault tolerance. I'm not sure if Cuju guarantees the shared storage state or not. Some fault-tolerance solutions use either storage snapshot, or a private storage for the secondary VM, to preserve the storage state while checkpointing. How does Cuju handle this issue? Alternatively, is there any best practice for using shared storage? Thanks.

Destroy related dirty bitmaps

In KVM module, the related dirty bitmaps should be released include epoch_dirty_bitmaps. Although in the commit b48e0b7 temporarily fix the issue of the kernel panic due to the destruction of related epoch_dirty_bitmaps, just ignore and doesn't really release them.

virtio_blk_get_request_from_head load request fail

When failover , If we call virtio_blk_get_request_from_head to load record_list request, it will load wrong request and cause the assert(type & VIRTIO_BLK_T_OUT) check fail.

Now we find some fix to solve this problem:

  1. Change the method of virtqueue_pop get request address (no use undo_map)
  2. Add get req->sector_num function on virtio_blk_get_request_from_head()
  3. Defer virtio_blk_free_request() from virtio_blk_rw_complete() to virtio_blk_complete_head()

And we still find virtio_blk_get_request_from_head sometimes load a wrong request (type !=1)
now maybe the problem is some dirty page produce from qemu and not be tracked (cpu_physical_memory_map)
the defer_write_map mechanism maybe is wrong

We can not enter qemu monitor on FTmode

When start FT mode, if we use

sudo nc -U /mnt/vm1.monitor

to enter qemu monitor
It will cause sg

Backtrace:

#0  _int_malloc (av=av@entry=0x7ffff6ab7b20 <main_arena>, bytes=bytes@entry=65) at malloc.c:3516
#1  0x00007ffff67762b0 in _int_realloc (av=av@entry=0x7ffff6ab7b20 <main_arena>, oldp=oldp@entry=0x1637e60, oldsize=oldsize@entry=48, nb=nb@entry=80)
    at malloc.c:4304
#2  0x00007ffff6777839 in __GI___libc_realloc (oldmem=0x1637e70, bytes=63) at malloc.c:3045
#3  0x00007ffff74507d8 in g_realloc () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#4  0x0000000000742a43 in capacity_increase (qstring=qstring@entry=0x1626320, len=len@entry=1) at qobject/qstring.c:75
#5  0x0000000000742bc5 in qstring_append_chr (qstring=0x1626320, c=112) at qobject/qstring.c:104
#6  0x000000000044c406 in monitor_puts (mon=mon@entry=0x1667580, str=0x7fff040ef28f "' for more information\n", 
    str@entry=0x7fff040ef270 "QEMU 2.8.0 monitor - type 'help' for more information\n") at /mnt/nfs/Cuju/monitor.c:339
#7  0x000000000044cfa2 in monitor_vprintf (mon=0x1667580, fmt=<optimized out>, ap=<optimized out>) at /mnt/nfs/Cuju/monitor.c:359
#8  0x000000000044d057 in monitor_vprintf (ap=0x7fffffffdd30, fmt=0x76c678 "QEMU %s monitor - type 'help' for more information\n", mon=<optimized out>)
    at /mnt/nfs/Cuju/monitor.c:354
#9  monitor_printf (mon=<optimized out>, fmt=fmt@entry=0x76c678 "QEMU %s monitor - type 'help' for more information\n") at /mnt/nfs/Cuju/monitor.c:367
#10 0x000000000044ee56 in monitor_event (opaque=0x1667580, event=<optimized out>) at /mnt/nfs/Cuju/monitor.c:3905
#11 0x00000000005311c3 in tcp_chr_new_client (chr=chr@entry=0x1617870, sioc=sioc@entry=0x7fff040ef020) at qemu-char.c:3373
#12 0x0000000000531290 in tcp_chr_accept (channel=<optimized out>, cond=<optimized out>, opaque=0x1617870) at qemu-char.c:3409
#13 0x00007ffff744b04a in g_main_context_dispatch () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#14 0x00000000006b42d5 in glib_pollfds_poll () at main-loop.c:220
#15 os_host_main_loop_wait (timeout=<optimized out>) at main-loop.c:265
#16 main_loop_wait (nonblocking=<optimized out>) at main-loop.c:513
#17 0x0000000000410fbc in main_loop () at vl.c:1984
#18 main (argc=<optimized out>, argv=<optimized out>, envp=<optimized out>) at vl.c:4725

Libvirt manages VMS

Hello, I would like to ask whether these codes are still being updated? Virtual machine memory synchronization is a good topic, can you use libvirt to manage virtual machine management?

Guest memory can not set over 3500 MB

memslot = gfn_to_memslot(kvm, gfn);
if (unlikely(!memslot)) {
printk(KERN_ERR"%s can't find memslot for %lx\n", func, gfn);
memslots_dump(kvm);
return -ENOENT;
}

Can not use gfn find memslot if gfn > DAC00

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.