Please use a Content Delivery Network

Yuri Enjoyer
Staff
Developer
Joined
Feb 16, 2020
Messages
462
This would not be a problem if mangadex used a CDN
The problem is your network connection to us

but it does not according to CDN Finder
because "CDN Finder" isn't doing a very good job at detecting CDNs, by the looks of it
there are telltale signs which any competent network engineer would see, and our site exhibits them very clearly

Here's one that doesn't require network knowledge: https://www.cdnperf.com/tools/cdn-latency-benchmark/?id=c716ednlr4k6o13
You can't have <10ms latency on multiple continents without a CDN. Light doesn't travel fast enough. Yet we do.

But anyway, that "CDN Finder" site is probably lazily just checking for a couple of popular CDNs, amongst which Cloudflare.

Cloudflare offers its CDN for free. I suggest adopting it. It would make mangadex load much faster.
Cloudflare throttled MangaDex years ago when we used it, for using too much traffic on their free plan.
The Pro plan is however only 30$/month or so. But that requires paying. The amount is trivial, but billing details aren't.
If you want your id, name, and credit card information on our dashboard and subject to subpoenas, do tell.

But either way, there are 2 cases where performance remains subpar atm:
  • South America => we don't have a presence there, as it'd be ludicrously expensive, so traffic has to travel back and forth to North America
  • South Africa => same reasons as above, but travelling to Europe instead

If you have shit speeds and aren't in these two cases, I'm sorry but the issue is that your ISP sucks. And most residential ISPs do, in fact, suck. A lot.
The "1Gbps" (or whatever) download speed they sell you is always only a theoretical maximum in perfect conditions.
Cloudflare (& others) pay a lot to various ISPs just to have their traffic prioritized, which helps. But we can't do that.

And even Cloudflare has shit performance in some places where they are being essentially extorted to have decent connectivity: https://blog.cloudflare.com/bandwidth-costs-around-the-world/

There's a lot more to say, and a lot of nuance that could be added, but this shall do for now.
 
Joined
Jan 8, 2024
Messages
7
The problem is your network connection to us
I have verizon fios. I run my traffic through cloudflare warp to bypass Verizon’s peering shenanigans. I also use the iCloud Private Relay through Warp for anonymity. Other sites load lightning fast, while I wait excessive time periods for images from mangadex to load (enabling data saver helped), so the issue is between mangadex and the iCloud Private Relay.
because "CDN Finder" isn't doing a very good job at detecting CDNs, by the looks of it
there are telltale signs which any competent network engineer would see, and our site exhibits them very clearly
It loads so slowly for me that I did not think there was a CDN, and I used CDN Finder as a quick check. I am in the US, and I am used to anything behind a CDN loading quickly. Having to wait minutes for parts of chapters to still not load is abnormal.

I setup a friend’s image heavy (photography) website behind cloudflare and it loads so quickly that I would think the server was in my living room. I do not expect all CDNs to perform like that, but when things go into the multiple minutes time frame, there usually is no CDN.

The problem was so bad that I ended up finding copies of chapters on other websites just to be able to read them. That was until I enabled data saver, and now there is a fraction of the loading problems.
Here's one that doesn't require network knowledge: https://www.cdnperf.com/tools/cdn-latency-benchmark/?id=c716ednlr4k6o13
You can't have <10ms latency on multiple continents without a CDN. Light doesn't travel fast enough. Yet we do.
That tool is awesome. Thanks for sharing.
But anyway, that "CDN Finder" site is probably lazily just checking for a couple of popular CDNs, amongst which Cloudflare.


Cloudflare throttled MangaDex years ago when we used it, for using too much traffic on their free plan.
The Pro plan is however only 30$/month or so. But that requires paying. The amount is trivial, but billing details aren't.
If you want your id, name, and credit card information on our dashboard and subject to subpoenas, do tell.

But either way, there are 2 cases where performance remains subpar atm:
  • South America => we don't have a presence there, as it'd be ludicrously expensive, so traffic has to travel back and forth to North America
  • South Africa => same reasons as above, but travelling to Europe instead

If you have shit speeds and aren't in these two cases, I'm sorry but the issue is that your ISP sucks. And most residential ISPs do, in fact, suck. A lot.
The "1Gbps" (or whatever) download speed they sell you is always only a theoretical maximum in perfect conditions.
Cloudflare (& others) pay a lot to various ISPs just to have their traffic prioritized, which helps. But we can't do that.
They have to pay for transit to avoid congested links. They have not admitted to paying for prioritization, which only matters when the links are congested.
And even Cloudflare has shit performance in some places where they are being essentially extorted to have decent connectivity: https://blog.cloudflare.com/bandwidth-costs-around-the-world/

There's a lot more to say, and a lot of nuance that could be added, but this shall do for now.
I really enjoyed reading your rant on the subject. :)
 
Joined
Jan 8, 2024
Messages
7
It occurs to me that you could use subdomains to support multiple CDNs. Either you could have the entire site duplicated on a subdomain or you could have the subdomains host images only and then have a toggle in the interface to allow the user to select the CDN used to deliver images. That would work around the one size does not fit all problem that occurs with CDNs. As long as cloudflare is not the default, you might not incur its throttling problem.

Bandwidth usage would increase, but you could mitigate this by using 1 CDN to feed the other CDNs, effectively having a double CDN configuration.

In the latter configuration, you could have the server automatically pick the CDN based on their region as long as you are okay with having html pages uncached (which should already be the case whenever people are logged in). This would allow you to improve the experience of people in regions where one CDN is known to be terrible without them having to do anything. You could also let users override the choice.
 
Joined
Jan 8, 2024
Messages
7
https://support.apple.com/en-us/102022

Apple has the ability to turn off the private relay for specific websites. I will give that a try after I update my iPad to the latest firmware so that it has the option.

Edit: despite updating, I see no option to use this. :/
 
Last edited:
Yuri Enjoyer
Staff
Developer
Joined
Feb 16, 2020
Messages
462
I have verizon fios. I run my traffic through cloudflare warp to bypass Verizon’s peering shenanigans.
Cloudflare definitely doesn't use its premium peering for Warp usage, and you can be sure that neither does Verizon to Warp.

But if you can provide MTR measurements to help us investigate what is going on, please do (remember to black out the first couple of hops that may contain your own IP address).

so the issue is between mangadex and the iCloud Private Relay.
Well, same question. It's possible we have poor connectivity to Apple's servers. Honestly not something we get a lot of chances to look at.

Having to wait minutes for parts of chapters to still not load is abnormal.
Indeed, it isn't. Loading a chapter (try in an incognito tab just in case) should really be a few seconds at most, typically.

it loads so quickly that I would think the server was in my living room.
Yeah, when it works, it works. However in practice we observed multiple people having dogshit load times on different CDNs and locations (even for the same exact CDN brand-wise) over the years. There's just a lot of factors at the end of the day.

They have to pay for transit to avoid congested links. They have not admitted to paying for prioritization, which only matters when the links are congested.
The thing is, crappy ISPs ensure their public links are congested, on purpose:
  • Deutsche Telekom in DECIX (Frankfurt, Germany) => Every single day at evening time, there's at least 5% of packet loss.
  • Telin in Indonesia, which (when I looked anyway) had a total of 40Gbps total public connectivity in their main DC (they do have multiple, but the point stands), for a population of nearly 300 million of which 80% or so are their customers. Obviously this link was congested to high heavens pretty much 24/7.

Or they make extremely subpar routing decisions by prioritizing transit costs over latency:
  • Most Indian ISPs route their customers to western europe unnecessarily instead of southeast asia, because India<>Europe is cheaper than India<>Singapore even if a CDN is present there. So, around the globe they go.
  • Australian ISPs routinely route their customers to Singapore even if the target CDNs also has presence in Australia (this one is to ensure nobody can ever meet their peering requirements which have a minimum local average traffic clause, as most such requirement lists do)

And all of these have the same exact solution "buy direct connectivity to us where you want, of course at multiple times market price".
They would never word it as "prioritization" because that'd be either illegal, against net neutrality where applicable, or just bad PR.

Finally, the US especially has much deeper problems in general with regards to internet connectivity that border on comedy.
We had multiple issues in the past being caught in the crossfire of fights, like between AT&T and Tata communications around Seattle (connection would just drop for 2h a day every day) or [some ISP I forget] with NTT in Florida (something like 40% packet loss all of a sudden).
But also things like NYC <> Los Angeles traffic costing more than NYC <> London even though the latter goes under an entire ocean.

Point is, not many ISPs actually do the simple, obvious, and sane thing of "I will pick the shortest route and that's it", because then they can't monetize faster connectivity to your service for their customers. They only accept that Netflix etc install cache servers directly on their network because it also saves them some cost as their infra couldn't handle it actually pulling data live.

It occurs to me that you could use subdomains to support multiple CDNs. Either you could have the entire site duplicated on a subdomain or you could have the subdomains host images only and then have a toggle in the interface to allow the user to select the CDN used to deliver images. That would work around the one size does not fit all problem that occurs with CDNs. As long as cloudflare is not the default, you might not incur its throttling problem.
We actually used to do that and have some dedicated rules for certain IP subgroups. It didn't work very well, and was a major hassle for us to maintain.

using 1 CDN to feed the other CDNs
This is usually not necessary, because CDNs typically have good pull speeds. All of what I wrote applies near-exclusively to residential ISPs, because people often don't have a choice (or don't know any better) so there's little competition. There's often a dozen ISPs in a datacenter, so they're forced to not do dumb shit to their professional customers or risk losing them fast.

Anyway, we have no plans to maintain multiple entrypoints to the site, so it'd be best if you really want this fixed to get measurements between different setups (Warp + iCloud, Warp-only, nothing) and see what works best or send over some MTR measurements for each and we can always ask our service providers if they can do something, but don't hope too much on that.
 
Yuri Enjoyer
Staff
Developer
Joined
Feb 16, 2020
Messages
462
Or they make extremely subpar routing decisions by prioritizing transit costs over latency
since we were chatting about it on Discord with some people, I pulled some stats to illustrate this further. This is the traffic we receive in Europe, sorted by originating ISP:
image.png

The #1 ISP is from the Philippines, the #10 ISP is from India. They literally route their users, by default, on the complete opposite side of the world. For no valid reason whatsoever.

---

And here's filtering for North America:
1704857921868.png

Here we see a few interesting things:
  • Comcast is absolutely massive; even AT&T is not comparable in size -- they can do whatever the fuck they want with that kind of hold on the market
  • Telstra (last in this list excerpt) is in Australia -- we have presence in Australia but they still route their customers across the entire goddamn Pacific Ocean

---

Finally, even in Asia we see interesting things:
1704858165900.png

First, note how big Telekomunikasi Indonesia #1 and #4 (aka Telin) is. Combined it's somewhere between T-Mobile and AT&T.

Anyway. There'd be a lot more fun to be had, but the point stands: a lot of residential ISPs are too powerful and/or garbage...
 
Joined
Jan 8, 2024
Messages
7
Cloudflare definitely doesn't use its premium peering for Warp usage, and you can be sure that neither does Verizon to Warp.

But if you can provide MTR measurements to help us investigate what is going on, please do (remember to black out the first couple of hops that may contain your own IP address).
Unfortunately, the iCloud Private Relay does not allow me to run traceroutes through it since the local end point is part of Apple’s web browser. Doing trace routes without it would defeat the purpose since the congestion occurs with it.

What is weird is that the issue happens around 98% of the time with data saver off, but almost never happens with data saver on. It is as if there is no caching for the larger images and there is some slowdown in getting them.
The thing is, crappy ISPs ensure their public links are congested, on purpose:
  • Deutsche Telekom in DECIX (Frankfurt, Germany) => Every single day at evening time, there's at least 5% of packet loss.
  • Telin in Indonesia, which (when I looked anyway) had a total of 40Gbps total public connectivity in their main DC (they do have multiple, but the point stands), for a population of nearly 300 million of which 80% or so are their customers. Obviously this link was congested to high heavens pretty much 24/7.

Or they make extremely subpar routing decisions by prioritizing transit costs over latency:
  • Most Indian ISPs route their customers to western europe unnecessarily instead of southeast asia, because India<>Europe is cheaper than India<>Singapore even if a CDN is present there. So, around the globe they go.
  • Australian ISPs routinely route their customers to Singapore even if the target CDNs also has presence in Australia (this one is to ensure nobody can ever meet their peering requirements which have a minimum local average traffic clause, as most such requirement lists do)

And all of these have the same exact solution "buy direct connectivity to us where you want, of course at multiple times market price".
They would never word it as "prioritization" because that'd be either illegal, against net neutrality where applicable, or just bad PR.
Let’s pretend I am Elon Musk and that there is congestion on the route to my office at Tesla. Paying for prioritization would reserve a lane just for me (which ironically, Tesla actually did in Mexico if I recall) and slow down everyone else. Paying for peering/transit would be having a tunnel built between my office and my house. It is not prioritization since it is not taking away from the existing traffic. It is something else entirely. There is definitely an incentive to try to get people to pay for this.

Usually, good network maintenance requires upgrading links whenever the 95th percentile of traffic uses 50% of the link, but good network maintenance is evidently beyond a number of organizations.
Finally, the US especially has much deeper problems in general with regards to internet connectivity that border on comedy.
We had multiple issues in the past being caught in the crossfire of fights, like between AT&T and Tata communications around Seattle (connection would just drop for 2h a day every day) or [some ISP I forget] with NTT in Florida (something like 40% packet loss all of a sudden).
But also things like NYC <> Los Angeles traffic costing more than NYC <> London even though the latter goes under an entire ocean.

Point is, not many ISPs actually do the simple, obvious, and sane thing of "I will pick the shortest route and that's it", because then they can't monetize faster connectivity to your service for their customers. They only accept that Netflix etc install cache servers directly on their network because it also saves them some cost as their infra couldn't handle it actually pulling data live.
That is hot potato routing and it is the reason I route all my traffic through either cloudflare or cloudflare + the iCloud private relay (which is fastly if I recall). The internet was originally meant to consist of connections between peers, but it ended up being bifurcated between the content providers and content consumers. My personal experience is that getting to the provider side of the content divide is usually enough to get sane connectivity. For example, during the famous Netflix peering disputes, when others were having problems, I was routing my traffic through hurricane electric and had none of their problems. Then years later, Netflix banned traffic using the HE IPv6 tunnel broker and I cancelled my subscription in protest.
We actually used to do that and have some dedicated rules for certain IP subgroups. It didn't work very well, and was a major hassle for us to maintain.


This is usually not necessary, because CDNs typically have good pull speeds. All of what I wrote applies near-exclusively to residential ISPs, because people often don't have a choice (or don't know any better) so there's little competition. There's often a dozen ISPs in a datacenter, so they're forced to not do dumb shit to their professional customers or risk losing them fast.
The double CDN idea was intended to avoid a situation where traffic to the actual server doubles from having two CDNs request copies of the same things. Since CDNs generally have good connectivity between each other, the additional hops involved would be unlikely to cause a problem and should avoid the traffic doubling effect.

The “correct” way to do multiple CDNs and use different ones for different regions is to use geolocation DNS routing at the name servers for the domain to pick the CDN. However, the moment this is setup, a DDoS attack would be able to take the entire thing down unless you use a DNS provider that does anycast routing. Such a provider will undoubtably charge an arm and a leg for the “enterprise” feature. Having images use different subdomains was an idea to avoid that expense, although it understandably would not work well if the links are so bad that even the html, js and css take forever to load.

That said, this is all a moot point given your past bad experiences with multiple CDNs.
Anyway, we have no plans to maintain multiple entrypoints to the site, so it'd be best if you really want this fixed to get measurements between different setups (Warp + iCloud, Warp-only, nothing) and see what works best or send over some MTR measurements for each and we can always ask our service providers if they can do something, but don't hope too much on that.
Unless Apple provides a way for me to do a trace route over the iCloud private relay, there is no way that I can provide that. I would also need Apple to provide a way to disable the private relay for mangadex for trace routes over cloudflare to matter. Despite Apple’s documentation to the contrary, they have not provided me with such an option.

I guess the best I can do is complain to Apple and hope they do something at their end.
 
Last edited:
Joined
Jan 8, 2024
Messages
7
since we were chatting about it on Discord with some people, I pulled some stats to illustrate this further. This is the traffic we receive in Europe, sorted by originating ISP:
View attachment 822

The #1 ISP is from the Philippines, the #10 ISP is from India. They literally route their users, by default, on the complete opposite side of the world. For no valid reason whatsoever.

---

And here's filtering for North America:
View attachment 825

Here we see a few interesting things:
  • Comcast is absolutely massive; even AT&T is not comparable in size -- they can do whatever the fuck they want with that kind of hold on the market
  • Telstra (last in this list excerpt) is in Australia -- we have presence in Australia but they still route their customers across the entire goddamn Pacific Ocean

---

Finally, even in Asia we see interesting things:
View attachment 828

First, note how big Telekomunikasi Indonesia #1 and #4 (aka Telin) is. Combined it's somewhere between T-Mobile and AT&T.

Anyway. There'd be a lot more fun to be had, but the point stands: a lot of residential ISPs are too powerful and/or garbage...
Thanks for sharing. That data is fascinating. :)
 
Joined
Jan 8, 2024
Messages
7
I just gave it a try without data saver. Things are loading properly. Whatever was done to improve performance over the past few days made a difference. Thanks. :)
 

Users who are viewing this thread

Top