Created
August 8, 2020 15:44
-
-
Save nvartolomei/7d072d4c7bdb3e2f7bfb181c5c4cc128 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
import math | |
import matplotlib.pyplot as plt | |
#%% | |
# each tuple contains a mix of read workload and read workload | |
xs = [(18, 12), (18, 24), (10, 50), (50, 10)] | |
#%% | |
def model(s_w, s_r, c, rf, f): | |
return math.ceil(s_w * rf / c + s_r * rf / (rf - f) / c) | |
#%% | |
from matplotlib.ticker import MaxNLocator | |
fig, ax = plt.subplots() # Create a figure containing a single axes. | |
fig.set_size_inches(8, 5) | |
ax.set_xlabel('RF') | |
ax.set_ylabel('N') | |
ax.xaxis.set_major_locator(MaxNLocator(integer=True)) | |
ax.yaxis.set_major_locator(MaxNLocator(integer=True)) | |
for s_w, s_r in xs: | |
px = [] | |
py = [] | |
for rf in range(1, 10): | |
px.append(rf) | |
py.append(model(s_w, s_r, 11, rf, 0)) | |
ax.plot(px, py, '-o', label="$\Sigma_w = {} \quad \Sigma_r = {}$)".format(s_w, s_r)) | |
ax.legend() | |
plt.savefig("sharding_vs_replication_no_f.svg") | |
#%% | |
from matplotlib.ticker import MaxNLocator | |
fig, ax = plt.subplots() # Create a figure containing a single axes. | |
fig.set_size_inches(8, 5) | |
ax.set_xlabel('RF') | |
ax.set_ylabel('N') | |
ax.xaxis.set_major_locator(MaxNLocator(integer=True)) | |
ax.yaxis.set_major_locator(MaxNLocator(integer=True)) | |
f = 1 | |
for s_w, s_r in xs: | |
px = [] | |
py = [] | |
for rf in range(f + 1, 10): | |
px.append(rf) | |
py.append(model(s_w, s_r, 11, rf, f)) | |
ax.plot(px, py, '-o', label="$\Sigma_w = {} \quad \Sigma_r = {} \quad F = {}$)".format(s_w, s_r, f)) | |
ax.legend() | |
plt.savefig("sharding_vs_replication_f_1.svg") | |
#%% | |
from matplotlib.ticker import MaxNLocator | |
fig, ax = plt.subplots() # Create a figure containing a single axes. | |
fig.set_size_inches(8, 5) | |
ax.set_xlabel('RF') | |
ax.set_ylabel('N') | |
ax.xaxis.set_major_locator(MaxNLocator(integer=True)) | |
ax.yaxis.set_major_locator(MaxNLocator(integer=True)) | |
f = 3 | |
for s_w, s_r in xs: | |
px = [] | |
py = [] | |
for rf in range(f + 1, 10): | |
px.append(rf) | |
py.append(model(s_w, s_r, 11, rf, f)) | |
ax.plot(px, py, '-o', label="$\Sigma_w = {} \quad \Sigma_r = {} \quad F = {}$)".format(s_w, s_r, f)) | |
ax.legend() | |
plt.savefig("sharding_vs_replication_f_3.svg") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment