I remember last summer, I and a few buddies to open black to play hand swim, is pushing to the high ground, suddenly the delay soared to 460ms, the screen card into the PPT, the group battle directly collapse. Team ADC angry to drop the phone, I also have a stomach of fire - this broken network, simply more than pig teammates pit people. Later, I found out that it was not a WiFi problem at all, but the packet loss rate of the mobile network was too high, coupled with the server was DDoS rubbing the edge, the whole link collapsed. From that moment on, I was determined to figure out how to cure this problem.
Handspring delay and packet loss this shit, to put it bluntly is the mobile network is born chicken plus external attacks to stir up trouble. The mobile network is not as stable as the fixed network, base station switching, signal attenuation, congestion control, any one of the links can let you experience lottery-style delay. I have measured the data in many areas, the average delay in 4G environment fluctuates between 80ms to 200ms, 5G is better, but encountered a crowded place as usual crash. More disgusting is the loss of packets, TCP retransmission mechanism in the game is too late to save the game, UDP is fast, but no checksum, packet loss is really lost, the role of the instantaneous shift, skills are empty is a common occurrence.
In addition, the handheld game server is now simply the hacker's ATM. DDoS attack cost is low to the point of ridicule, just rent a botnet can hit a few hundred Gbps of traffic, the ordinary room simply can not carry. Last year, a large factory game was hammered, because it did not do high defense, the player drop rate soared to 30%, reputation directly on the street. Don't believe in those “single room hard to carry” nonsense, I've seen too many cases, the last is the player scolded the operation of the back of the pot.
In the end, the root of the problem is in the network link and security protection. Mobile network adaptation is poor, server-side optimization is insufficient, security measures are virtually non-existent - these three axes cut down, and then cattle game also have to kneel.
High-defense CDN acceleration program is currently the most reliable solution, the core of the two words: decentralized plus hard to carry. Through the global nodes to share the traffic, so that players close to access, latency naturally down. At the same time integrated DDoS cleaning capabilities, malicious traffic has not touched the server on the edge of the node was strangled. My own project test, the delay can be pressed to 40ms or less, the packet loss rate from 15% down to 0.5% below, the effect of a batch of fierce.
Mobile network adaptation is the key of the key. Ordinary CDNs only care about acceleration, but the mobile network fluctuates a lot, so you have to dynamically adjust the routing. For example, using BGP Anycast to direct user requests to the optimal node, or through the TCP optimization protocol to reduce retransmission. Here insert a code example, using Nginx to configure a dynamic routing strategy:
This configuration can automatically switch according to the node load and network status to avoid a single node crash. I favor CDN5 in the weight setting because their family is the most ruthless in optimizing the mobile network, and the nodes cover the third and fourth tier cities, and even the mountainous areas can be pocketed by the signal.
At the security level, a high-defense CDN has to be able to withstand 7 layers of attacks. For example, CC attacks specialize in hitting the game login interface, which may not seem like a lot of traffic, but the CPU can be drained for you. I tried their WAF rules on CDN07, which directly blocked the frequency of abnormal requests:
This set of rules has helped me block no less than ten attacks. 08Host's solution is similar, but the customization is a little less flexible, and more scripts have to be written to underpin it.
Data comparisons are most telling. I pulled three service providers - CDN5, CDN07, 08Host - to do pressure testing, simulating high concurrency scenarios under the mobile network. The result is that CDN5 has a median delay of 38ms, and the cleaning success rate is 99.9%; CDN07 has a delay of 42ms, but the anti-D capability is slightly weaker, and the cleaning rate is 98.5%; 08Host is cheap, and the delay fluctuates greatly, hovering between 50ms and 100ms, which is suitable for small teams with tight budgets. But to be honest, this year, save anything can not save network budget, players can not have the patience to wait for you to optimize.
When landing the implementation, you also have to pay attention to client-side adaptation. Handicap packet size sensitive, CDN nodes have to support compression and protocol optimization. For example, use QUIC instead of TCP to reduce the handshake delay. I have measured the performance of QUIC in the weak network, the delay can be reduced again 20%, but the client and server side of the double-end support, tossing up a slight pain.
Finally nagging a little dry: choose CDN do not just look at the offer, you have to test the quality of the node and after-sales response. I was once attacked in the middle of the night, CDN5 customer service 10 minutes on the line to adjust the rules, CDN07 slowed down for half an hour, 08Host simply can not find people - really out of the ordinary, time is the player retention rate.
In short, the hand tour high defense CDN is not the icing on the cake, is the snow in the charcoal. Mobile network adaptation is done, delayed packet loss pressure down, the player's reputation naturally come. Of course, there is no once-and-for-all program, you have to continue to monitor the tuning. Anyway, I summarize this wave of stepping on the pit: network stability, the game won; security collapse, the whole game lost.

