By using AWS re:Post, you agree to the Terms of Use

Questions tagged with Networking & Content Delivery

Sort by most recent

Browse through the questions and answers listed below or filter and sort to narrow down your results.

Latency in GET requests

Hello. I wrote a code in Python that extracts data from the FTX exchange using their API. I am running the code in an AWS instance (free plan, t2.micro), located very closeby to the servers of the exchange. The code is essentially an infinite loop. At each step, it sends 3 'GET' requests, elaborates the response, and then goes to the next step. For the first few hundred iterations, the latency (defined below at the end of the post) for each block of three requests is of the order of 0.3seconds. After some time, it starts to grow up, reaching values from 2 to 5 seconds. In my local computer, located in the US, the latency is pretty constant at 1 second. There are no ratelimits in the FTX API for `GET` requests, so I should not expect any limit from the server. Is AWS limiting the rate of `GET` requests that I can make? I am trying to understand the origin of this extra-latency. To do so, I have monitored the https data traffic with `tcpdump` and I have modified the python script so that it stops as soon as it experiences a latency > 2 seconds. In this way, I can isolate the last packets in the tcpdump output and try to understand the origin of the delay. However, I really don't know how to read the output (I uploaded it here Can anyone help me to understand the origin of the latency? is the IP of FTX server is the IP of the machine where my code runs **Definition of latency used here**: I post the relevant part of the code where I compute the latency ``` latency=0 for pair in pairList: # pairList = ['BTC/USD','ETH/BTC','ETH/USD'] api=requests.get(f'{pair}/orderbook?depth={20}') latency+=api.elapsed.total_seconds() return latency ``` So, it is the total sum of the latency returned by the requests.get for each request.
asked 13 days ago