Closed zhangtony239 closed 3 months ago
由于改进后使得我vps响应“过于准时”,一秒的测速等待已然触发了我链路上的QoS,我这次测试的结果是改为了3秒一次测得的。
Because the improvement made my vps respond "too punctually", the one-second speed test wait had already triggered the QoS on my link. The result of my test this time was changed to a measurement every 3 seconds.
import time,requests
import seaborn as sns
import matplotlib.pyplot as plt
url='http://cp.cloudflare.com/' #10mb测试:'http://cachefly.cachefly.net/10mb.test'
port='2080' #HTTP代理端口
print('当前目标地址:'+url)
delays=[]
loss=0
headers = {
'Cache-Control': 'no-cache',
'http': 'http://127.0.0.1:'+port,
'https': 'http://127.0.0.1:2080'+port,
}
def delaytest(url):
start = time.time()
try:
requests.get(url,headers=headers,timeout=3)
except:
print('连接超时(>3000ms)')
loss += 1
end = time.time()
delays.append((end - start)*1000)
print(str((end - start)*1000)+'ms')
for i in range(10):
try:
delaytest(url)
time.sleep(3)
except:
continue
plt.rcParams['font.sans-serif'] = ['SimHei'] # 指定默认字体
plt.rcParams['axes.unicode_minus'] = False # 解决保存图像是负号'-'显示为方块的问题
sns.boxplot(delays)
plt.title(url)
plt.xlabel('中位数:'+str(sorted(delays)[len(delays)//2])+'ms'+',丢包率:'+str(loss*10)+'%')
plt.ylabel('延迟时间(毫秒)')
plt.show()
完善了IO优先级和CPU优先级,并添加了内存优先级和防杀死。
Improved IO priority and CPU priority, and added memory priority and anti-kill.
……或许太过激了
经过和gpt的对峙,我发现把CPU调度模式改成fifo,添加IO最高优先级,可以进一步压榨vps。
FIFO:先进先出,比RR轮询的实时模式更激进,这意味着hysteria会一次性完成响应再释放CPU,而不是和其他实时调度共享CPU资源。实际测试中,这个让我的浏览器加载Google首页快了半圈。
IO最高优先级:嗯...至少我的1panel把网络负载算进了IO,应该起了作用。
After a confrontation with gpt, I found that changing the CPU scheduling mode to fifo and increasing the highest IO priority can further squeeze vps.
FIFO: First in, first out, more aggressive than the real-time mode of RR polling, which means that hysteria will release the CPU only after running the response once, instead of sharing CPU resources with other real-time schedulers. In actual tests, this made my browser load the Google homepage half a circle faster.
IO highest priority: Well... at least my 1panel counts the network load into IO, which should have played a role.