The patch is to reduce the count of IO in get_obj_list() when the cluster is recovering, by adding<div>a object list cache which implemented by hash table, so it can read the object list from the cache,</div><div>instead of reading the disk to get the object list, which makes it much faster, and I modified the </div>
<div>get_objlist() hook function of farm and simple_store to make them return the current full object list in</div><div>the disk no matter which epoch the object belongs to, we always keep the full object list in the cache, when</div>
<div>create_and_write_obj() creates a new object ,we write the new oid to the cache to make it up to date.</div><div><br></div><div>In my testing environment,there's 2G data in the cluster, without the patch, it takes 69344.645 us for</div>
<div>get_obj_list() to execute which is measured by "collie debug trace" , with the patch it takes at most</div><div>15.655 us.</div><div><br>On Thursday, March 1, 2012, Li Wenpeng  wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I wrote a bash script to test the performance of object list cache:<br>
<br>
#!/bin/sh<br>
<br>
pkill -9 sheep<br>
rm /root/sheepdog/store/* -rf<br>
for i in 0 1 2 3 4 5 6 7 8; do<br>
    echo "initializing sheep on port 700$i"<br>
    sheep/sheep -d /root/sheepdog/store/$i -z $i -p 700$i;<br>
    sleep 1;<br>
done<br>
collie/collie cluster format -c 3 -b "farm"<br>
qemu-img create -f raw sheepdog:debian 2G<br>
qemu-io -c "write -P 0x1 0 10M" sheepdog:debian<br>
<br>
ps aux | grep "sheep.*1$" | awk '{print $2}' | xargs kill -9<br>
sleep 2<br>
<br>
qemu-io -c "write -P 0x1 0 1000M" sheepdog:debian<br>
qemu-io -c "write -P 0x1 1000M 1000M" sheepdog:debian<br>
<br>
collie/collie debug trace -e<br>
<br>
ps aux | grep "sheep.*5$" | awk '{print $2}' | xargs kill -9<br>
<br>
sheep/sheep -d /root/sheepdog/store/14/ -z 14 -p 7014;<br>
<br>
sleep 600<br>
<br>
collie/collie debug trace -t<br>
collie/collie debug trace -C > trace.txt<br>
<br>
<br>
Before the patch is applied, it takes tens of thousands of microseconds<br>
to execute the function get_obj_list() in store.c, while with the patch<br>
it only takes dozens of microseconds.<br>
<br>
The object list cache avoids too much IO in get_obj_list(), so it runs<br>
much faster and saves resource.<br>
<br>
</blockquote></div><br><br>-- <br><font color="#999999">levin</font><div><a href="http://basiccoder.com" style="background-color:rgb(255,255,255)" target="_blank"><font color="#999999">basiccoder.com</font></a></div><br>