mirror of
https://github.com/logos-storage/logos-storage-research.git
synced 2026-01-10 09:23:09 +00:00
50 lines
1.3 KiB
Python
50 lines
1.3 KiB
Python
|
|
import numpy as np
|
||
|
|
import matplotlib.pyplot as plt
|
||
|
|
|
||
|
|
# Parameters
|
||
|
|
N_values = [1e4, 1e5]
|
||
|
|
|
||
|
|
# P buckets (members)
|
||
|
|
P_buckets = {
|
||
|
|
"small (P=10)": 10,
|
||
|
|
"mid (P=250)": 250,
|
||
|
|
"large (P=1000)": 1000
|
||
|
|
}
|
||
|
|
|
||
|
|
# Query: (bytes per query)
|
||
|
|
def query_payload_bytes(N, P):
|
||
|
|
return 14460.0 * np.log2(N) + 16.0 * (33.0 + 305.0 * P)
|
||
|
|
|
||
|
|
# Query rate Q = (P / (7*86400)) * (0.05 + 0.20 / C)
|
||
|
|
def Q_per_content(C, P):
|
||
|
|
W = 7 * 86400.0
|
||
|
|
return (P / W) * (0.05 + 0.20 / C)
|
||
|
|
|
||
|
|
# Query bandwidth BW_query(C) = C * Q(C) * query_payload_bytes
|
||
|
|
def BW_query_bytes_per_sec(C, P, N):
|
||
|
|
Q = Q_per_content(C, P)
|
||
|
|
return C * Q * query_payload_bytes(N, P)
|
||
|
|
|
||
|
|
# Community age (H_weeks) and content counts (C)
|
||
|
|
H_weeks = np.arange(1, 513)
|
||
|
|
C_vals = H_weeks + 1
|
||
|
|
|
||
|
|
# Plotting 1x2 grid
|
||
|
|
fig, axs = plt.subplots(1, 2, figsize=(14, 5), sharex=True, sharey=True)
|
||
|
|
axs = axs.flatten()
|
||
|
|
|
||
|
|
for i, N in enumerate(N_values):
|
||
|
|
ax = axs[i]
|
||
|
|
for label, P in P_buckets.items():
|
||
|
|
y = BW_query_bytes_per_sec(C_vals, P, N)
|
||
|
|
ax.plot(H_weeks, y, label=label, linewidth=2)
|
||
|
|
ax.set_xscale("log", base=2)
|
||
|
|
ax.set_yscale("log", base=2)
|
||
|
|
ax.set_xlabel("Community age H (weeks)")
|
||
|
|
ax.set_ylabel("Query Bandwidth (bytes/sec)")
|
||
|
|
ax.set_title(f"N={int(N):,}")
|
||
|
|
ax.grid(True, linestyle="--", alpha=0.5)
|
||
|
|
ax.legend()
|
||
|
|
|
||
|
|
plt.tight_layout()
|
||
|
|
plt.show()
|