Advertisement IC Markets

The DNS lookup that adds a second

Optimize MetaTrader 4, MetaTrader 5, cTrader, and TradingView for speed. Discuss Level II Market Depth (DOM), custom hotkeys, and volume indicators.
Post Reply
Fairman
Posts: 6757
Joined: Tue Jul 21, 2026 7:11 am
Location: Abuja

The DNS lookup that adds a second

Post by Fairman »

The DNS lookup that adds a second

Every time a platform reconnects to a broker, it resolves a name into an address. That lookup normally takes a few milliseconds. Sometimes it takes seconds.

A slow or overloaded DNS server delays the reconnection after a drop. The user sees "connecting" for longer than expected, while a position sits unattended.

ISPs' default DNS servers vary in quality. Public alternatives are often faster and more reliable. Switching takes a minute in the network settings.

The effect shows most during disruptions. A brief connection loss followed by a slow DNS lookup extends the outage from two seconds to ten.

Another trick is using the broker's IP address directly in platforms that allow it, bypassing DNS altogether. The downside is that if the broker changes addresses, the connection fails until updated.

Caching also plays a role. Operating systems keep recent lookups for a while, and stale entries can point to a server that's no longer in use, causing failed connections.

It's a small piece of the chain, rarely blamed, and easy to fix.

After a brief drop, how long does the platform take to reconnect?
It’s Fairman :geek:
Recommended broker for automated trading & scalping IC Markets
Amanhasnoname
Posts: 1506
Joined: Fri Oct 30, 2026 9:45 am

Re: The DNS lookup that adds a second

Post by Amanhasnoname »

I noticed this on a VPS rather than at home. After a brief network blip, one terminal reconnected almost instantly while another on the same machine sat on connecting for close to fifteen seconds. It turned out the slow one had cached an old server address after the broker moved one of its access points.

Changing the VPS to a public DNS service and flushing the cache fixed it, and reconnects have been under three seconds since. I also restart the terminals once a week during the weekend, which clears any stale entries without me having to think about it.

I tried the direct IP approach for a while, but my broker changed addresses twice in six months and both times the terminal simply failed to connect until I noticed. For me the safer option has been leaving the names in place, using a reliable resolver, and having the EA send me a message if it has been disconnected for more than thirty seconds.
Post Reply