Move host, use CDN or implement Varnish?


Seeing my test results ( ) I am in doubt about what could be done to improve my loading time. The server is in Chicago, and the users are in Brazil, so changing the host to Brazil would be good.

But there are some serious problems about doing this. First, that hosts in Brazil are very unreliable. And second, they are very expensive. I can easily pay 4x more to host here, which is more than a good CDN.

What do you suggest?


My recommendation would be to get a CDN that has edge nodes in Brazil and leave your hosting in Chicago (or possibly move it to Florida where most of the cables from Brazil land).

If the CDN can also provide DSA services they can help with the times for the base page as well but I’d save that for after you see how just moving the static content first works.

You can also get some pretty big performance wins if you can restructure the page and get the javascript out of the head (easier said than done but there is a lot of javascript up there blocking the page from rendering).

Beyond that it looks like a lot of the requests are for 3rd-party stuff that you don’t directly control (Facebook, Ads, etc).

Thanks Patrick. A consultant here in Brazil suggested we install Varnish on Amazon CDN in São Paulo, and make that respond for the requests, using CNAME, what do you think?

(I would not make everything be served from Amazon, since we move 3 TB per month, and as for brazilian prices, it would add up to 750 dollars per month just for transfer.)

I’m not sure what that would get you. That might be one way to implement a DSA-style tunnel but you’d still want to pick up a CDN for all of your static resources.

If the base HTML is cacheable (even for a short period) then it could be a good win but otherwise it’s basically just running as a reverse proxy to your host in Chicago (which is basically what DSA is from the CDN providers).

I see. You mentioned previously about hosting in Miami. Do you recommend any company there?

And about the JS on the head, do you know how I could start improving that?

Sorry, I’m not familiar with hosting companies in Miami. I just know it’s pretty common practice to put equipment there to serve South America (and Brazil in particular) because it’s where the undersea cables connect.

For the JS in the head, it’s a matter of going through the page templates, eliminating any inline code and then moving the script tags to the end of the HTML (or at least further down the document). You can try just moving it all but odds are that something will break if you’re not careful.