1

I have a website hosted by DigitalOcean (1GB Memory/20GB Disk/LON1) and CloudFlare.

Lots of external librairies were from cdnjs.com, which worked well in Europe and US, but they were not stable in China. So I decided to host all of them in my DigitalOcean server.

Then, I check the speed from China by Google Chrome Dev Tools, I notice that TTFB (from 10s to 1s) are really unacceptable:

enter image description here

Does anyone know if I could do something (eg, configuring the DigitalOcean droplet) to reduce the TTFB time?

Thomas
  • 223
  • 1
  • 3
  • 11
  • Page caching may help. Latency is something that can be mitigated depending on the situation. – Tim May 19 '18 at 07:47
  • What I care most is the first time people open my site, where all the libraries need to be loaded. I'm afraid page caching would not help this stage... – Thomas May 19 '18 at 08:07

2 Answers2

1

You can TTFB to about 20ms if you cache the page on CloudFlare. Set up a page rule similar to:

enter image description here

Then after the page is cached on the edge, the next page loads will have TTFB of about 20ms:

enter image description here

I can't promise that speed in China. It's a known bottleneck. You can pay them for faster networking though.

Jules
  • 119
  • 2
0

Cloudflare is not active per default in China. There is only the Enterprise (several thousands dollar/month) plan with access to China pop.

Beside that, you should be aware that too much cache can have side effect. If you using a cms like Wordpress or Magento, too much cache on edge will not be aware of login cookie, different block that eventually needs dynamic content, etc.

For a static website, it's excelent. For dynamic website you should be aware of this.

If China is your main targe, just register to alibaba cloud and spin up a VM behind the Great Firewall. But first remember, to host a website (or event to route trafic on port 80) you need China license (ICP).

Also you can spin up a VM in alibaba cloud eg in Bejing, and with geo dns, pick up the static files directly from chinese hosted vm.

x86fantini
  • 302
  • 1
  • 3
  • 9