
MathJax CDN shutting down on April 30, 2017 - JohnHammersley
https://www.mathjax.org/cdn-shutting-down/
======
aplaice
Will the developers of Chromium and Edge perhaps reconsider incorporating
native support for MathML in light of this, considering that apparently people
do use maths on the web?

180 million monthly users is a significant portion of the world's population.
I'm not sure to what extent MathJax is cached, so it's possible that these are
not 180 million unique users. On the other hand, this does not include all
those self-hosting MathJax, using KaTeX or just using server-generated images
(for example Wikipedia†).

†It's possible to force Wikipedia to use native MathML (which, at least on
Firefox, looks really nice) or MathJax, but it's non-trivial.

[https://bugs.chromium.org/p/chromium/issues/detail?id=6606](https://bugs.chromium.org/p/chromium/issues/detail?id=6606)

[https://bugs.chromium.org/p/chromium/issues/detail?id=152430](https://bugs.chromium.org/p/chromium/issues/detail?id=152430)

[https://wpdev.uservoice.com/forums/257854-microsoft-edge-
dev...](https://wpdev.uservoice.com/forums/257854-microsoft-edge-
developer/suggestions/6508572-mathml)

~~~
chr1
People use math, but they use it with Latex not MathML, MathML is too verbose,
so even if browsers implemented it people would need libraries like MathJax.

~~~
runarberg
Nothing is stopping you from authoring your math however you like as long as
there are tools that support the translation[1]:

[1]: [http://fred-wang.github.io/TeXZilla/](http://fred-
wang.github.io/TeXZilla/)

------
kyledrake
It would be interesting to see what they tried to bill them. I can push out
70TB for about $700 right now (through our 11 PoP anycast network). AWS S3
would have cost $5,717.85 according to their calculator. My guess is the bill
is somewhere in the middle.

If you don't need a fancy anycast network, you can buy a 1GbE pipe from
Hurricane Electric for about $400/mo and push 192TB/mo through it. Actually
they include that when you get their $400/mo server cabinets in the bay area.
Probably not the best option ever, but I don't think S3 is 14.29x better than
it. Dedicated server providers like OVH might be okay with it too, probably
ask them first. But if you had 2-4 servers and round-robined them my guess is
you would be fine. You could get one server in Europe and one in NA and GeoDNS
them and get probably-good-enough close to what an anycast network can do. For
~$200/mo. Not too bad.

I've given my rant a million times so I won't do it again, but "The Cloud"
heavily upcharges on bandwidth. Or they tell you it's "unlimited" (a word I've
learned through experience to hate) then tell you "except for the kind of
stuff you're doing" and send a bill or shut you down. If you've got to ship a
ton of bandwidth, you should at least look into the alternatives.

If you really want to go future tech, look into something like IPFS
([https://ipfs.io](https://ipfs.io)) - it was built for stuff like this and
it's going to make a real dent in transit costs for heavy data sets, CDNs,
package distribution and the like. I absolutely cannot wait for the
distributed web.

~~~
Veratyr
> I've given my rant a million times so I won't do it again, but "The Cloud"
> heavily upcharges on bandwidth. Or they tell you it's "unlimited" (a word
> I've learned through experience to hate) then tell you "except for the kind
> of stuff you're doing" and send a bill or shut you down. If you've got to
> ship a ton of bandwidth, you should at least look into the alternatives.

It stuns me just _how_ bad it upcharges and how much it could be hurting their
business. I can imagine so many use-cases where reasonably priced bandwidth
would drive consumption elsewhere. I use cloud storage for backups without
worrying about the insane cost of a restore. I could send large video
production files to cloud storage, use cloud compute to produce renders and
then download the processed files again without paying a multiple of the
compute cost on bandwidth.

To illustrate a bit on that video example, 4K 422 ProRes HQ is 424 GB/hr [0].
Assuming I have say 2h of footage I want processed, that's 848GB. Then if I
need say 2h on 2x g2.8xlarge GPU instances to process the video, that's $2.78
* 2 * 2 = $11.12 for the entire process. Then I need to download that 848GB
again, that's $76.32. The cost of retrieving the processed data is 7x the cost
of processing it, that's insane.

[0]: [https://ssl.apple.com/final-cut-
pro/docs/Apple_ProRes_White_...](https://ssl.apple.com/final-cut-
pro/docs/Apple_ProRes_White_Paper.pdf)

------
tyingq
Interesting that the solution doesn't change the problem at all. As far as I
can tell, cdnjs doesn't pay Cloudflare either. So all the traffic still flows
through Cloudflare, unpaid. Cloudflare is listed as a sponsor for cdnjs. Guess
it just keeps the list of who CF subsidizes shorter.

~~~
btown
Realistically, many legacy sites using this for rendering will just break and
stay broken. Academic upload-and-forget posts, etc. Users may be unhappy but
the overall volume of requests could drop.

Additionally, every sponsorship may have a fixed cost to someone in the
organization, some manager who would rather read a 20 line vs. 100 line
report. And I doubt mathematicians and physicists drive the CF bottom line.
Generosity has its limits.

~~~
jmts
I thought the same thing regarding legacy sites. My workplace blocks file
sharing and image hosting websites, so I've been acutely aware of the impact
to UX recently when domains disappear. I can be almost certain now that when
there are no images on a blog or stackoverflow post that they were hosted on
imgur. I've been considering this for a while but it seems somewhat curious to
me that not so long ago hotlinking was a big no-no and as sites disappeared
broken image icons on small websites multiplied, and now we have an increasing
number of CDNs where hotlinking is essentially the intended usage.

~~~
Dylan16807
Have you asked what the justification is for allowing general internet sites
but not image hosting sites? I can't imagine it's at all reasonable.

~~~
technion
It's a fairly common rule in an enterprise. Unless you can guarantee that
imgur will never host porn, it's going to get blocked per an HR policy.

~~~
Dylan16807
But you can't guarantee that random blogs don't host porn either.

~~~
tyingq
I believe it's mostly about legal liability vs actual effectiveness.

If someone watching porn causes someone else to file a hostile workplace suit,
you can show that you invested in whatever is the standard off the shelf tech
to prevent it.

It's all kind of silly today now that most people walk around work with 4g
phones with high res screens. That leaves preventing malware on company PCs as
the sole actual reasoning.

~~~
Dylan16807
And why would the liability be different between random sites and imgur? I
fully understand the idea of blocking both. I don't understand the idea of
only blocking imgur.

~~~
tyingq
It's meeting the legal definition of "reasonable care" to buy an industry
standard blocking tool and maintain it with software updates.

The companies that use this software are checking boxes like "no porn", "no
gambling". They aren't typically making URL level decisions. The stuff that
sneaks by will happen because filtering isn't perfect.

The makers of the software categorize popular sites with tags (porn, file
sharing, proxy avoidance, hate speech, etc). Less popular sites get content
keyword filtering...so something like porn images without porn words can slip
by.

~~~
jmts
This is a reasonable description of the internet filters we have. There is a
lot more than just file sharing sites blocked, and they usually specify the
category they are blocked under. The others just don't affect me as much.
Though my above comment about IP paranoia still stands. We have other policies
around access to email, USB permissions, bans of VM software etc purely to
raise the bar above 'easy' leaks.

------
franciscop
What a huge mess.

\- Only 1 month to re-route 70TB of content. I wonder if even over 10% will be
re-routed, with all the other sites broken.

\- Cloudflare notice could have beem some months in. Hopefully now that this
got some traction they will provide some more time.

\- There are a lot of situations where devs cannot change the CDN any longer.
I for one won't trust CDNs (including CDNJS) for anything durable any longer,
which seems a big loss for Cloudflare.

~~~
CJefferson
Worse, mathjax is very popular with statically generated sites. Any pelican or
Jekyll website you see with maths probably has this CDN hardwired into it. I
am involved with 2 projects where we hard wired it into our docs.

Worse, the full download is massive, so it's tempting to not local host it.
There are some cryptic messages about reducing the size, which link to out of
date pages. If they were going to do this, they could at least have decent
docs on how to locally host in a small size.

~~~
majewsky
It's right in the article, under the "Optimization" header.

------
jnpatel
Is there a way in which MathJax could redirect their cdn.mathjax.org to
cdnjs.cloudflare.com and maintain backwards compatibility for existing sites?

A DNS redirect would break the SSL, right? Perhaps a HTTP 3xx redirect?

~~~
bhouston
HTTP 3xx would work fine, but you would need an active server there. But
really setting up nginx with such rules as basically the only thing it is
doing to handle these requests on OVH or some other fairly unlimited bandwidth
server shouldn't be too hard.

------
joshmn
So, yeah, ugh, why would a niche library (in the sense that it's not jQuery or
YUI) need to operate its own CDN, for anything other than style points? There
are major players who are already doing this who own and operate their own
network (see MaxCDN). What's wrong with just plugging into their existing
infrastructure?

If that fails, I'd give a shout to FDCServers or LeaseWeb (or of that
capacity) and see what they can do. I know of a handful of people who've moved
100TB monthly for less than $100/month, just because they asked.

~~~
buu700
Why is this downvoted? Nitpicking of the phrase "niche library" aside, I'm
having trouble understanding this without more context as well.

The post starts:

> Our CDN has been an important part of MathJax’s history. When MathJax made
> its first public release in 2010, hosting a library like MathJax was a
> complex challenge. The CDN launched a year later and helped resolve this
> difficulty

What is "like MathJax" alluding to? Standing up a web host to serve a single
JS file sounds like the opposite of a "complex challenge", so there must be
something else going on here.

After reading further down, I see that the post does mention that "A common
concern with local installations is the size of a complete copy of MathJax, in
particular the ~29,000 PNGs", so I guess that's what they're talking about? If
so, the comments at the top make more sense and their having had their own CDN
at all is more understandable in that light, but it seems needlessly confusing
not to lead with that explanation.

~~~
joshmn
Your guess is as good as mine. I edited my original post to reflect my
subjectiveness of niche.

I guess my point was that... Okay, so they took advantage of CloudFlare.
Great, plenty of people do that, but not on the scale of 10s of TBs. What plan
were they on with CF? The $20/month one? If I was a provider, I wouldn't want
someone moving that volume of data through my pipes for $20/month (but as a
developer, I'd love it)

They mentioned how Google provided free storage. Storage is so cheap!
Providers make their money on bandwidth. Having said, I can't imagine what
kind of price they paid for bandwidth.

Like I alluded to in my (now edited) original post: Guys, it never hurts to do
your research in the hosting space and learn that there is more to hosting
than just AWS/Google/Azure/Heroku/OVH/DigitalOcean/Vultr. Go to
webhostingtalk.com, learn a bit, browse the offers forums, write some emails,
compare providers, ask questions. Hosting isn't complicated, especially
compared to some of the problems you're/we're solving.

~~~
lrem
Let's say you don't care about DDOS protection and can live with 0.1x the
number of PoPs. How much does it cost these days to host these terabytes/month
from ≥10 well spread locations?

~~~
tyingq
If you want to maintain the basic benefit of a CDN, the cheapest I know of is
OVH's CDN. MathJax says they use 70TB/month.

The OVH 100TB CDN plan is £509.99/month. Other CDNs would be 3x that amount or
more.

It wouldn't be available much cheaper even if you skipped the CDN. A $20 VPS
comes with 3TB outbound, so you would need 24 of them to spread across.

Of course, there may be some opportunity to fix their cache headers, or
optimize their js/CSS/images and reduce that 70TB requirement.

~~~
Dylan16807
> A $20 VPS comes with 3TB outbound

You can get $40 servers with 30TB outbound.

~~~
tyingq
I assume that's a 100mbps unmetered port, and probably not able to push 100%
at peak times (over provisioned). How many of these would you need to serve
the implied peaks that come with 70TB/month? And have them spread on at least
2 continents?

~~~
Dylan16807
Gigabit port limited to 30TB. It should be able to handle the load patterns
fine. That's from Hetzner. That's only one continent by itself, but that's a
very significant chunk of the load solved with 1-2 servers.

------
Hydraulix989
I have an old web site hosted by my university that has several math equations
on it using MathJax. Unfortunately, since graduating, I no longer have access
to it, but my professor still hosts all of past students' content for us.

I'm just glad that I had the foresight to have hosted my own copy of that
library.

------
lpage
I switched from MathJax to a middleman + execjs + KaTeX pipeline for my static
sites earlier this year, and I'm very happy with it overall. KaTeX isn't 1-1
with MathJax when it comes to syntax support; I was surprised to see that
underset and overset - which are ubiquitous - aren't supported. That said, I
was able to work around every issue with alternative syntax. It's awesome that
the heavy lifting is no longer client side, and it's a significantly easier
build pipeline than MathJax if you're trying to generate a single minimized
script or use webpack.

~~~
rahimnathwani
Is there a reason why ebooks don't use KaTeX? I subscribe to
safaribooksonline.com, which presents HTML versions of ebooks. I think they're
just unpackaged versions of epub or mobi versions. Anyway, I'm surprised that
equations are generally embedded in images, even in recent (published this
month) O'Reilly-published books.

Is there some technical reason why authors/publishers do it this way, or is it
just about tooling?

Gitbook claims that it works:
[https://www.gitbook.com/blog/features/katex](https://www.gitbook.com/blog/features/katex)

------
ims
Github code search for 'script src "cdn.mathjax.org"':

> 1,811,496 code results.

Woof.

------
nikdaheratik
It's kind of strange to think that you need fewer of your own server resources
the more successful your software is at meeting its goals, but this seems to
be one of those cases.

------
kevin_thibedeau
Is there any way to make Sphinx use its own copy of the script rather than the
CDN?

------
reustle
I wonder if BuiltWith would be willing to release a list for free of sites
using MathJax, so someone could build a tool to notify them all if contact
info can be found

------
pacaro
I just noticed this last week. I was trying to work out how to use MathJax
directly from within JS to render math inline with rendering the rest of my
content, rather than asynchronously after the fact.

I love MathJax, but I'm now rendering math on the server using a latex ->
dvisvgm pipeline and caching the results

~~~
jnetterf
Depending on your use case, KaTeX [1] may be worth a look. It has a
"renderToString" function that returns an HTML string.

[1] [https://khan.github.io/KaTeX](https://khan.github.io/KaTeX)

~~~
The_suffocated
One problem of KaTeX is that its feature set is too small. It doesn't even
support some very basic commands such as \overrightarrow.

------
abhirag
Jupyter Notebooks containing maths and exported as html are also going to get
affected. I personally write my articles in a Jupyter Notebook and export them
to html and put them on my site so need to update a few of them.

------
mp3geek
I thought cloudflare didn't have a data cap? I'm somewhat concerned.

~~~
tyingq
See [https://www.cloudflare.com/terms](https://www.cloudflare.com/terms)

Specifically, SECTION 10: LIMITATION ON NON-HTML CACHING.

------
zerop
Lots of products become popular when they are actually announced here as
shutting down :)

------
slackoverflower
I read that as MaxCDN shutting down.

------
infinity0
> We recommend cdnjs which uses CloudFlare for delivery

Oh man, so close to

> We recommend cjdns (which is against everything CloudFlare stands for) for
> delivery

~~~
thomasfoster96
> which is against everything CloudFlare stands for

Could you explain this? Have I missed some big Cloudflare news?

~~~
yclept
cjdns is a different thing from cdnjs

~~~
thomasfoster96
Thanks, I thought it was a typo.

