choosing good ISP

ANL
ANL edited October 2023 in Python client
What is the parameter when choosing a good ISP? My main aim is to reduce latency.

Now I get Minimum = 18ms, Maximum = 18ms, and Average = 18ms for kite.zerodha.com.
for google - Minimum = 23ms, Maximum = 23ms, Average = 23ms

I want to reduce from 18 ms to below 5 ms or as much as possible. Could you please advise what parameters we need to look at when choosing an ISP?
  • ANL
    @MAG please comment
  • MAG
    The first thing is obviously the latency - the lesser the better. I am at Bangalore using ACT fibernet which if I am not mistaken rated second behind spectranet. I am getting 1 to 1.5 ms response times to any of the zerodha end points. The lower the better but anything below 5 ms should be good. Now if your ISP has higher latency there is no point talking to them. Their network setup is set up a certain way that causes the higher latency and they are not going to rejig their network for one customer.

    The other thing to consider is the reliability. Your router can show connected but the network may be unstable. This can be done by running ping for about an hour or two and checking the packet loss. Ideally packet loss should be zero. Anything above zero means the network is dropping packets in between and this can lead to api errors where you make a call and it does not reach the server. Now most broadband providers will have some brownout events during the day where you might suddenly find high packet loss. If I were to explain network brownouts in a electrical sense its like when you get low voltage say 80v instead of 240. If you use a tester, the light will glow because you are getting electricity but appliances will not run because the voltage is too low. Similarly your network connections will fail. You may send a api request and it gives a network exception/error.

    If you are using websocket, your connection will drop during these brownouts. Reconnecting and resubscribing to the instruments will take a few seconds and you will lose any ticks sent by the servers during this time. I used to have 3-4 reconnections during the day before I moved to AWS. Now if this brownout continues for some time, your websocket will try to connect and reconnect again and again till the max number of retries is reached or the server blocks your connection for frequent connection attempts.

    So to summarise - lower than 5 ms latency and as few network brownouts as possible. Brownouts are not really in your control - your network may run fine for 4 months and suddenly have brownouts for a few days. WRT to brownouts you can just keep your fingers crossed, change ISP or move to the cloud.
  • ANL
    ANL edited October 2023
    @MAG If I change to AWS, then the latency of the ISP will not be an issue, right? If you use native Windows RDP for login, the AWS is delayed. or will the ISP latency kill the user experience while using AWS?

    What is your experience on this matter?
  • MAG
    Cant comment on windows RDP or windows OS. I never use windows anywhere so I am sorry I cant help you here.

    I use AWS EC2 instances running either Debian or Ubuntu. And all access is via SSH shell. Code is primarily python3 running in terminal or cron scheduler.
  • kakush30
    kakush30 edited October 2023
    Which ISP you are using? Even from NCR, I am getting this. And the connection with websocket is quite stable without any connection drops for whole trading day.
  • ANL
    @kakush30 I am using a local ISP, not popular. I getting Minimum = 17ms, Maximum = 17ms, Average = 17ms for api.kite.trade. I know the latency is very high. sometimes the Websocket connection is not stable because of this latency issue.

    May I know your ISP ?
  • kakush30
    kakush30 edited October 2023
    @ANL Airtel Xstream fiber.... they are the best for such kind of work. Bandwidth doesnt matter much.

    But if possible, do ask for business leased line, if not, airtel do provide static IP for home connections, it provide much more stable connection.

    If you have a good machine at home with 24*7 power backup, I wont suggest AWS or GCP, the cost is exorbitant.
  • ANL
    ANL edited October 2023
    @kakush30 Thanks, what about Jio ?
    I think a business leased line is more expensive than a normal home connection.?
    Which is the best ISP connection to reduce latency below 5 ms? You have mentioned static IP for home, but is it possible? Usually, ISPs don't provide this facility for homes.
    Can you explain the advantages of using static IP?

    Your valuable insight will be beneficial to newcomers.
  • suprxd
    @ANL I think it's not worth to switch ISP over mere 20 milliseconds of latency. If you're having a unstable connection that's a totally valid reason. Kite APIs are not where trades are happening, they do validation checks, margin checks in the background which results in additional delay to Exchange anywhere from 50ms - 150ms.
  • kakush30
    kakush30 edited October 2023
    @ANL yes airtel do provide static IP for home connections, I think at rs 199+gst.

    The reason being, previous year I have noticed it, that sometimes during trading day, the public ip changes, and connection drops to websocket.

    For jio, I am talking with my experience, there backend teams are not that much experienced, and they see you with surpurise when you ask them for common things (when I had asked them for static ip in 2021, they were surpurised that what is this). Furthur, they have routing problems in there backend.
Sign In or Register to comment.