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
asked 7 months ago44 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions