Investigation into Unusual Server Timing and Performance Metrics on VPS

0

Hello!

I hope this email finds you well. I have some concerns regarding the performance and timing metrics of my Virtual Private Server (VPS) hosted on AWS (Lightsail, Windows Server 2019 Windows_Server_2019-1 2 GB RAM, 2 vCPUs, 60 GB SSD).

I have been running various time-sensitive applications, specifically interacting with the Binance websocket API, and have noticed some irregularities (Timing Discrepancies).

So, I've performed round-trip time (RTT) to Binance websocket API and server delay tests to measure the latency. The values were fluctuating widely, and occasionally the server delay was even negative!! The server it in Tokyo.

For example:

RTT: 0 ms, Server Delay: -6 ms

RTT: 16 ms, Server Delay: -8 ms

RTT: 0 ms, Server Delay: -14 ms

RTT: 46 ms, Server Delay: -13 ms

RTT: 0 ms, Server Delay: -13 ms

Steps Taken I have synchronized the server clock using NTP. I have checked the server status and found it to be running normally. Despite these measures, the issue persists.

I suspect that this could be related to the hypervisor or some other aspect of the virtualization infrastructure.

What do you think?

Thank you in advance!

Nick

ps: here is the python script I used:

import asyncio
import websockets
import json
import time
async def monitor_binance_rtt():
    url = "wss://stream.binance.com:9443/ws/btcusdt@trade"
    
    async with websockets.connect(url) as ws:
        while True:
            start_time = int(round(time.time() * 1000))  # Current time in milliseconds
            
            response = await ws.recv()
            end_time = int(round(time.time() * 1000))  # Current time in milliseconds
            
            data = json.loads(response)
            if 'T' in data:
                server_time = data['T']  # Trade time from server
                
                rtt = end_time - start_time  # Round Trip Time in milliseconds
                server_delay = end_time - server_time  # Server Delay in milliseconds
                
                print(f"RTT: {rtt} ms, Server Delay: {server_delay} ms")

if __name__ == "__main__":
    loop = asyncio.get_event_loop()
    loop.run_until_complete(monitor_binance_rtt())
ntsili
已提问 8 个月前51 查看次数
没有答案

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则