[Sheepdog] [PATCH v6] add object cache for sheep

Liu Yuan namei.unix at gmail.com
Mon Mar 26 15:48:21 CEST 2012


NOTE:
  You also need to patch following QEMU patch to issue flush requests and not all kernel will
issue flush reqeust properly with upstream QEMU. For e.g, Debian squeeze will *not* issuse
flush reqeust via qemu to sheepdog[Linux kernel has different implementation of flush req 
and we works with new one]. 

Ubuntu server and RHEL 6 works as expected.

TODOs:
 cache object quota and reclaim

v5 -> v6:
 address Kazum's comments, Thanks!
  - remove flock
  - always read the cached object if any (solve qemu-img non-flush problem, collie vdi list. etc.)
  - return err code to bdrv_co_flush_to_disk
  - use valloc instead of malloc
  - qemu patch v2
    1 add cache flag for read_write_object()
    2 adjust cache_enabled location in sd_open()

v4 -> v5:
 - add control to disable cache

v3 -> v4:
 - fix collie vdi list. Don't operate on cache for it.
 - make flush operation from IO to LOCAL

v2 -> v3:
 - refactored the object cache code, cache_object_fd is removed
 - fix oc->dirty_rb race
 - donot propagate error to guests for flush operation
 - implement vdi delete operation

v1 -> v2:
 - free entry when add_to_dirty_rb_and_list() fails.
 - use mutex instead of spin lock.


    Object cache caches data and vdi objects on the local node. It is at
higher level than backend store. This extra cache layer translate gateway
requests into local requests, largely reducing the network traffic and highly
improving the IO performance.
    
    Dirty objects will be flushed to cluster storage by 'sync' request from
guest OS.

    The initial version concentrate on the simplicity. Its design is straightforward
just add one layer in front of the backend store. So the gateway requests (from Guest)

old path: IO req -> sheep cluster
   |
   v
new path: IO req -> object cache on local node -> sheep cluster

    Later we might consider other features, for e.g., cache quota for different VDIs.

How To Use It:

The cache mode is controlled by the QEMU tool's DRIVE option,

To enable cache: qemu --enable-kvm -drive file=sheepdog:your_vm,cache=writeback
To disable cache:
1 qemu --enable-kvm -drive file=sheepdog:your_vm,cache=none
or
2 qemu --enable-kvm -drive file=sheepdog:your_vm



More information about the sheepdog mailing list