-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
git-svn-id: http://sands.sce.ntu.edu.sg/svn/lluis/trunk@10 6fa9df1f-5871-4ed8-8e73-65a2acd6172f
- Loading branch information
lluis
committed
Jan 11, 2012
1 parent
c99abb7
commit 1ddaaf1
Showing
1 changed file
with
28 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import random | ||
import gevent | ||
from clusterdfs.networking import Client, NetworkHeader | ||
|
||
def repair_block(repairing_node, repairing_from, block_size): | ||
c = Client(*repairing_node) | ||
header = {'nodes':repairing_from, 'length':block_size} | ||
c.send(header) | ||
print c.recv() | ||
|
||
num_nodes = 51 | ||
node_names = ['thinclient-%02d'%i for i in xrange(num_nodes)] | ||
data_nodes = [(n,8888) for n in node_names] | ||
bulk_nodes = [(n,9999) for n in node_names] | ||
#storage_per_node = 1*1000*1000*1000*1000 #(1TB) | ||
storage_per_node = 1*1000*1000*1000 #(1GB) | ||
block_size = 100*1000*1000 #(100MB) | ||
n = 8 # using a (8,3) RS code | ||
k = 3 | ||
redundancy = float(n)/k | ||
blocks_per_node = storage_per_node/block_size | ||
num_blocks = blocks_per_node*num_nodes | ||
|
||
for block_id in xrange(blocks_per_node): | ||
repairing_node = random.choice(bulk_nodes) | ||
repairing_from = random.sample(data_nodes, k) | ||
print repairing_node, repairing_from | ||
#gevent.spawn(repair_block, repairing_node, repairing_from, block_size) |