第4周作业 网络应用(下)
@[.ComputerNetwork]
最小分发时间图标如下:

客户-服务器模型
di=2Mbps
F=15Gb
us=30Mbps
tmin=max(usN∗F,diF)
N=10时,tmin=max(30Mbps10∗15Gb,2Mbps15Gb)=max(5000,7500)=7500s
N=100时,tmin=max(30Mbps100∗15Gb,2Mbps15Gb)=max(50000,7500)=50000s
N=1000时,tmin=max(30Mbps1000∗15Gb,2Mbps15Gb)=max(500000,7500)=500000s
p2p分发模型
di=2Mbps
F=15Gb
us=30Mbps
dP2P=max(usF,min(di)F,us+∑uiNF)
当u=500kbps时
N=10时,dP2P=max(30Mbps15Gb,2Mbps15Gb,500Kbps∗10+30Mbps10∗15Gb)=max(500,7500,4286)=7500s
N=100时,dP2P=max(30Mbps15Gb,2Mbps15Gb,500Kbps∗100+30Mbps100∗15Gb)=max(500,7500,18750)=18750s
N=1000时,dP2P=max(30Mbps15Gb,2Mbps15Gb,500Kbps∗1000+30Mbps1000∗15Gb)=max(500,7500,28301)=28301s
当u=1Mbps时
N=10时,dP2P=max(30Mbps15Gb,2Mbps15Gb,1Mbps∗10+30Mbps10∗15Gb)=max(500,7500,3750s)=7500s
N=100时,dP2P=max(30Mbps15Gb,2Mbps15Gb,1Mbps∗100+30Mbps100∗15Gb)=max(500,7500,11538)=11538s
N=1000时,dP2P=max(30Mbps15Gb,2Mbps15Gb,1Mbps∗1000+30Mbps1000∗15Gb)=max(500,7500,14563)=14563s
当u=2Mbps时
N=10时,dP2P=max(30Mbps15Gb,2Mbps15Gb,2Mbps∗10+30Mbps10∗15Gb)=max(500,7500,3000s)=7500s
N=100时,dP2P=max(30Mbps15Gb,2Mbps15Gb,2Mbps∗100+30Mbps100∗15Gb)=max(500,7500,6522)=7500s
N=1000时,dP2P=max(30Mbps15Gb,2Mbps15Gb,2Mbps∗1000+30Mbps1000∗15Gb)=max(500,7500,7389)=7500s
画图脚本
import matplotlib.pyplot as plt
import numpy as np
N = np.linspace(10, 1000, 990)
y = (N*15*1000/30)
y1=(N*15000)/(0.5*N+30)
y2 =(N*15000)/(1*N+30)
y3 =(N*15000)/(2*N+30)
np.putmask(y1, y1 <= 7500, 7500)
np.putmask(y2, y2 <= 7500, 7500)
np.putmask(y3, y3 <= 7500, 7500)
np.putmask(y, y <= 7500, 7500)
l, = plt.plot(N, y, color='black', linewidth=1.0, label='CS')
l1, = plt.plot(N, y1, color='red',label='u=500kps', linewidth=1.0)
l2, = plt.plot(N, y2, color='green', linewidth=1.0, label='u=1Mps')
l3, = plt.plot(N, y3, color='blue', linewidth=1.0,label='u=2Mps')
plt.xlabel('N')
plt.ylabel('T')
plt.legend(loc='best')
plt.show()