Created
May 29, 2019 16:22
-
-
Save toddlipcon/a92e41ad9e2d57c8c2f523d7137ce26a to your computer and use it in GitHub Desktop.
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
#!/usr/bin/env python | |
import random | |
from collections import Counter | |
num_tservers = 30 | |
num_hash_buckets = 16 | |
repl_factor = 3 | |
ts_buckets = [random.randrange(0, num_hash_buckets) for i in xrange(num_tservers)] | |
ts_load = Counter() | |
for i in range(10000): | |
tablet_locs = random.sample(range(num_tservers), repl_factor) | |
chosen_ts = max(tablet_locs, key=lambda idx:ts_buckets[idx]) | |
ts_load[chosen_ts] += 1 | |
print ts_load | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment