How to Eliminate DNS Lookups for Faster Mobile App HTTP Requests
This article explains why DNS resolution slows down mobile app traffic, compares the traditional PC‑era HTTP flow with wireless app challenges, and presents a DNS‑free optimization that uses a locally cached IP list to improve latency, load balancing, and resilience.
Background
In the wireless era, network stability is poor and app traffic is sensitive; each HTTP request between the app and server requires DNS resolution, which can be a bottleneck.
1. HTTP request flow in the PC era
1. Browser or PC client queries DNS server to obtain the IP (usually an Nginx IP).
2. The client uses the IP to access Nginx.
3. Nginx forwards the request to the actual web server that handles the HTTP request.
2. Characteristics of the wireless app era
(1) DNS resolution time cannot be ignored.
(2) If DNS is hijacked, the entire app fails.
3. DNS‑free HTTP request optimization scheme
(1) On the first access, the client fetches a list of server IPs and stores it locally; subsequent accesses follow the normal HTTP flow.
(2) On later accesses, the client directly uses the stored IP list, eliminating DNS queries.
(3) If DNS is hijacked, the client can still try the IPs from the list.
4. Potential issues and solutions
(1) Load balancing without DNS: the app randomly selects an IP from the list.
(2) Horizontal scaling without Nginx: simply add new IPs to the list.
(3) Reducing traffic from repeatedly fetching the IP list: add a version number; the client only re‑downloads the list when the version changes.
(4) Supporting heterogeneous servers: include a weight with each IP (e.g., 192.168.1.1,10; 192.168.1.2,10; 192.168.1.3,20) so the app can balance load according to server capacity.
5. Summary of benefits
• No DNS lookup per request, saving time.
• No Nginx forwarding per request, saving time.
• No repeated IP‑list download, saving bandwidth.
• Resilience to DNS hijacking by using local IPs.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
21CTO
21CTO (21CTO.com) offers developers community, training, and services, making it your go‑to learning and service platform.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
