Mobile Development 10 min read

Network Optimization Strategies for the YoukeYing Mobile SDK

This article outlines the background, guiding principles, measurement methods, and concrete optimization techniques—including protocol selection, data reduction, request aggregation, DNS and HTTP/2 improvements, priority handling, and backend tweaks—that together reduced SDK network latency by about 40% and accelerated asset delivery to over 90% within three seconds.

IEG Growth Platform Technology Team
IEG Growth Platform Technology Team
IEG Growth Platform Technology Team
Network Optimization Strategies for the YoukeYing Mobile SDK

Network performance is a core metric for the YoukeYing SDK; when multiple ad SDKs request ads concurrently, network operations such as ad fetching and material downloading directly affect ad exposure opportunities. Since the second half of 2021, the SDK team has focused on reducing SSP request latency and material download latency.

Guiding Principles : First monitor network data online, then analyze stage‑wise request latency, and finally apply targeted optimizations. The overall principles include protocol‑level choices, reducing data transmission volume, and minimizing request count.

Protocol‑Level Optimization : Choose between HTTP, TCP, or UDP; reduce DNS resolution time and three‑way handshake latency where possible.

Reduce Data Transmission : Prefer protobuf over JSON, JSON over XML; compress data; eliminate redundant fields; use TCP instead of HTTP when feasible; serve smaller images (e.g., WebP instead of PNG).

Reduce Request Count : Use caching, on‑demand loading, aggregated interfaces, and gateway support for multi‑service requests.

Online Measurement of Network Latency : The SDK uses HTTPS, splitting a request into DNS resolution, TCP handshake, TLS verification, and backend processing. Monitoring shows these four stages dominate latency. Three iOS data‑collection approaches are discussed:

NSURLProtocol – intercepts native, UIWebView, and WKWebView requests but requires private APIs for WKWebView and is intrusive.

Hook Network API – hook low‑level socket functions or NSURLSession/NSURLConnection methods; less intrusive than NSURLProtocol.

NSURLSessionTaskMetrics – available from iOS 10, provides detailed transaction metrics (DNS time, handshake, TLS, request/response sizes, etc.) with minimal impact.

The team selected NSURLSessionTaskMetrics for its low overhead and sufficient coverage.

Optimization Measures :

DNS Optimization – pre‑resolve the ad domain using a shared cloud‑config endpoint to leverage system DNS cache.

HTTP/2 Support – enable multiplexing and header compression; iOS supports it natively, Android upgraded OkHttp to HTTP/2.

Request Channel Separation – isolate ad‑fetch, cloud‑config, and logging requests into dedicated NSURLSession instances.

Request Priority – prioritize ad requests over cloud‑config and logging.

WebP Image Support – serve WebP on iOS 14+ and Android to save ~30% bandwidth.

Reporting URL Optimization – shrink a 2000‑byte device‑ID parameter to ~400 bytes via Redis caching.

Protobuf Usage – replace JSON with protobuf (nanopb) to reduce payload size.

Video Playback Optimization – implement progressive download and caching for video ads on both platforms.

Download Library Research – evaluated TKDDownloader, SDWebImage, FileDownloader, and OKHttpDownload; no significant gains, so custom downloader retained.

Backend Optimizations – address slow queries, rate‑limiting, deployment architecture, and internal service calls.

Future TQuick Integration – plan to replace the current HTTP stack with TQuick for further performance gains.

Code example for retrieving NSURLSessionTaskMetrics:

void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didFinishCollectingMetrics:(NSURLSessionTaskMetrics *)metrics API_AVAILABLE(ios(10.0))

Optimization Results : The combined measures reduced ad‑fetch latency by roughly 40% and increased the proportion of material downloads completed within three seconds to over 90%.

PerformanceiOSAndroidHTTP2network optimizationDNSMobile SDK
IEG Growth Platform Technology Team
Written by

IEG Growth Platform Technology Team

Official account of Tencent IEG Growth Platform Technology Team, showcasing cutting‑edge achievements across front‑end, back‑end, client, algorithm, testing and other domains.

0 followers
Reader feedback

How this landed with the community

login Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.