D
D
Dimus2019-10-25 23:25:30
Nginx
Dimus, 2019-10-25 23:25:30

Why did traffic through round-robin begin to be distributed unevenly?

Good day!
For distributing media files, there is the following configuration:
1) Main server - stores all media files of the project, distributes them
2) Several proxy cache servers distribute the most popular media files from the main server recently through nginx.
Proxy cache server config:

proxy_cache_path /web/media levels=1:2 keys_zone=my_cache:10m max_size=20g inactive=1440m;
location / {
    proxy_cache my_cache;
    proxy_pass http://my-site.com/media/;
}

Balancing occurs simply through DNS Round-robin (all IP addresses of the cache servers are registered for the media.my-site.com subdomain).
All this worked fine and we had approximately the following monthly distribution of traffic on the servers:
Main server - 8.87 TiB
Cash 1 - 6.12 TiB
Cash 2 - 6.14 TiB
Cash 3 - 4.35 TiB (this server did not work for a full month, so the traffic is less than that of its neighbors )
Total traffic - 8.87 + 6.12 + 6.14 + 4.35 = 25.48 TiB
per

month including a band from 100Mbps to 1Gbps), almost all traffic began to go through the main server:
Main server - 25 TiB
Cash 1 - 261.86 GiB
Cash 2 - 264.81 GiB
Cash 3 - 268.34 GiB
Total traffic - 25 + 0.261 + 0.264 + 0.268 = 25.79 TiB
It turns out that the total traffic remained the same, but it all went through the main server.
The only assumption is that the main server now works on a 1Gb network (it used to work on a 100Mbps network)
. The caching servers have remained the same, they have a speed of 100Mbps.
Where to dig? Why, with such a simple distribution, such a bias in traffic began to turn out?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
Dimus, 2019-10-26
@Dimus

Thanks for the advice! It turned out that the matter was completely different, I screwed up with the nginx configs. Simultaneously with the move to a new server, the project completely switched to the https protocol, and the link to the http://... version of the site remained in the cache server configs.
As a result, when a request came to the cache server - the cache server requested a file from the main server via http - on the main server it was given a redirect to https - the cache server gave this redirect to the user and that's it.
Sorry for the trouble, I just registered it: proxy_pass https://my-site.com/media/;and everything worked as it should)

D
Dimonchik, 2019-10-26
@dimonchik2013

dig into the DNS, obviously also
into the location of the new server, if suddenly the DC or the country has changed

K
ky0, 2019-10-26
@ky0

If RR is honest and randomly or cyclically gives records, then most likely it is some third-party caching servers that ignore TTL, which once remembered the answer for your server and, keeping this record in the cache, sent all subsequent ones to it. Well, or just some bot parsed your files in one go.
Look at the traffic statistics if there are spikes within several IP ranges, most likely the reason is somewhere there, and not you.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question