-
Notifications
You must be signed in to change notification settings - Fork 231
Cdn Q&A
pkra edited this page Jun 13, 2013
·
2 revisions
-
Is it faster if I host a copy of MathJax on my own?
- For the majority, this is unlikely. The MathJax CDN is provided through Rackspace Cloud Files, which serves MathJax via Akamai, the leading CDN in the world. It's unlikely you will be using a significantly better CDN in both speed and reliability.
- In addition, your visitors will not receive the benefits of browser caching across CDN users. Once a visitor has visited a site using the MathJax CDN, the components downloaded dynamically (input/output components, extensions, webfonts etc) will remain in the visitor's browser cache. If the same visitor visits another site using the CDN, these components will not have to be downloaded again. For security reasons, browsers do not allow this re-use across domains, so hosting your own copy of MathJax will mean visitors will only get the benefit of caching if they have visited your site before.
-
Isn't there a risk that the MathJax CDN is down?
- Since we switched to Rackspace/Akamai, we had no downtime of the CDN. Some users experienced a 15 min downtime when our DNS provider (godaddy) failed -- a rare and extreme event by all standards. But you can even reduce the chance of that kind of outage by using the direct rackspace url instead of our cdn.mathjax.org.
-
Isn't it safer to use my own copy?
- Besides optional https access, the MathJax CDN is actively maintained by our team and critical bug fixes will be pushed to the CDN immediately. This means it's easier and safer to use our CDN. In addition, the
/latest
branch will be updated to each new version upon release (after an announcement on our website to give the opportunity to switch to older versions should anybody want to).
- Besides optional https access, the MathJax CDN is actively maintained by our team and critical bug fixes will be pushed to the CDN immediately. This means it's easier and safer to use our CDN. In addition, the
-
Does the CDN restrict my ability to configure and extend MathJax?
- No. MathJax is designed with modularity and flexibility in mind. When using the CDN a content host is still able to configure it anyway they like, including loading additional configuration files together with those from the CDN and loading third-party extensions that are not available in the CDN. The only thing you can't do is modify/hack the original MathJax code that are on the CDN -- but you shouldn't do this anyway.
-
Is there any scenario where I should host a copy myself?
- If you use MathJax in restricted networks (intranets, education) or offline (apps), then you probably want your own copy of MathJax. However, we suggest you use it only as a fallback. This is actually a good thing (for those who can actually host a copy of MathJax themselves). Given the nature of the net, there's always a chance that a visitor might have temporary connection problems to our CDN due to unstable network connections. Obviously, if they are visiting a site, they can connect to that site. MathJax is resilient to temporary connection loss once it's loading up -- but if the initial download fails, there's nothing MathJax can do. To get the best of both ways it's easy to write a short line of javascript to check if the visitor has been able to get the initial MathJax script from the CDN (and maybe retry a few times), and, if not, fall back to your own copy when necessary.