[sheepdog] [PATCH 4/4] farm: use slice_{read, write} to read/write object

Liu Yuan namei.unix at gmail.com
Tue Jul 16 11:30:21 CEST 2013


For a test with 200M cluster with 2 copies (so roughly 100M data to backup),
I got the following resualt:

                   size  time
w/ slice (64K)  :  51M   2.037s
w/ slice (128K) :  53M   1.223s
w/ slice (256K) :  57M   1.216s
w/ slice (512K) :  61M   1.205s
w/o slice (4M)  :  97M   1.174s

This is why I choose 128K as slice size.

Signed-off-by: Liu Yuan <namei.unix at gmail.com>
---
 collie/farm/farm.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/collie/farm/farm.c b/collie/farm/farm.c
index 385397f..d4aff48 100644
--- a/collie/farm/farm.c
+++ b/collie/farm/farm.c
@@ -243,7 +243,7 @@ static void do_save_object(struct work *work)
 	if (sd_read_object(sw->entry.oid, buf, size, 0, true) < 0)
 		goto error;
 
-	if (sha1_file_write(buf, size, sw->entry.sha1) < 0)
+	if (slice_write(buf, size, sw->entry.sha1) < 0)
 		goto error;
 
 	free(buf);
@@ -337,7 +337,7 @@ static void do_load_object(struct work *work)
 
 	sw = container_of(work, struct snapshot_work, work);
 
-	buffer = sha1_file_read(sw->entry.sha1, &size);
+	buffer = slice_read(sw->entry.sha1, &size);
 
 	if (!buffer)
 		goto error;
-- 
1.7.9.5




More information about the sheepdog mailing list