mozilla / pontoon

Mozilla's Localization Platform
https://pontoon.mozilla.org
BSD 3-Clause "New" or "Revised" License
1.45k stars 527 forks source link

Use cloudflare for Pontoon's cacheable content #2118

Open bugzilla-to-github opened 6 years ago

bugzilla-to-github commented 6 years ago

This issue was created automatically by a script.

Bug 1440892

Bug Reporter: @phlax CC: @adngdb, @alex-mayorga, @mathjazz, @MikkCZ

Cloudflare is somewhat controversial so it would be good to hear whether people are happy with this proposal.

In the context of localization it offers some huge advantages as cloudflare has "Points of Presence" all over the world and can server cached content to localizers much more quickly.

It would also be beneficial for overall server performance by reducing load.

I believe it would be in keeping with mozilla policies as www.mozilla.org uses it although we would need to check this

bugzilla-to-github commented 6 years ago

Comment Author: @MikkCZ

My experience with Cloudflare is somewhat mixed. For me the only reason to use it was free HTTPS and fast DNS. However the DNS is still slower than a regional DNS placed in the Czech Republic.

As for "Points of Presence" or performance, the results were mixed for me. For static content that can be cached it was definitely a speed up. For anything dynamic (WordPress and phpBB in my case, all dashboard and especially the AJAX requests during translating in case of Pontoon) it's an extra hop that was actually perceivable. Also there could me limitations for some technologies like WebSockets (I think the support is still experimental) or upload filesize, but the latter is probably something for the free plan only.

If you feel Pontoon slow, I think the better solution would be to wait for Pontoon.next, where AFAIK the frontend should be split from backend and both would be potentially scalable as needed. That's nothing any proxy would solve for you.

In general I am not against using Cloudflare or any CDN if it will actually work. Cloudflare is often said to work out of the box, but it does not. You need to use the cache header properly and very carefully so no dynamic requests get cached and the static ones are cached only for the time you want them to be. Until I did so, purging the cache each time I updated the WordPress template was really annoying.

bugzilla-to-github commented 6 years ago

Comment Author: @phlax

As for "Points of Presence" or performance, the results were mixed for me. For static content that can be cached it was definitely a speed up. For anything dynamic...

Yep, for sure, I only tend to use it for cached content, not for dynamic views.

If you feel Pontoon slow, I think the better solution would be to wait for Pontoon.next, where AFAIK the frontend should be split from backend and both would be potentially scalable as needed. That's nothing any proxy would solve for you.

It's kinda pontoon.next that im thinking of here - specifically cache-busted webpacked es6/react resources

Cloudflare is often said to work out of the box, but it does not. You need to use the cache header properly and very carefully so no dynamic requests get cached

Yep, agreed - it needs some setup and there are alot of ways to use it. For cache-busted static resources the setup is not so difficult and i think offers some pretty big benefits.

I have changed the title of the bug to reflect the focus on cached, not dynamic, content.

Related to this, its much better to serve static content from a separate TLD (eg pontooncdn.net or somesuch) as it prevents request headers/cookies etc generated for the main domain from being sent in requests for static content.

bugzilla-to-github commented 6 years ago

Comment Author: @adngdb

Mozilla has its own CDN, https://cdn.mozilla.net/ . I've never used it and know nothing about it, but I know it exists and sites like addons.mozilla.org use it.

On a different note, I dislike cloudflare for philosophical reasons: it goes completely against my idea of a decentralized Internet, it creates centralization points that thus become points of failure over which we have no control. I know that's a lost war for me (we use Amazon / Heroku / Google Analytics... ) but I'm still fighting it, and every small battle I can win on that front is a victory in its own right.

bugzilla-to-github commented 6 years ago

Comment Author: @phlax

On a different note, I dislike cloudflare for philosophical reasons

Yep, i agree with all of your reasoning here - and yep we use centralized services already, so it seemed like a legitimate conversation to be had given the highly distributed nature of our users.

bugzilla-to-github commented 6 years ago

Comment Author: @mathjazz

Marking as P4: https://wiki.mozilla.org/L10n:Pontoon#Prioritizing_bugs

See also: https://github.com/mozilla/pontoon/pull/241