How to improve Discourse Load time

Hi Guys,

Our users located in mainland China, India or Indonesia are complaining about the discourse load time. In some of our locations, it takes more than 1 minute to load the discourse main page.

Infrastructure wise,

  • Discourse is hosted within a docker container on a single server in AWS Singapore.
  • We also use Cloudflare as a free CDN service to “replicate” our static content.

We did NOT set the DISCOURSE_CDN_URL as Cloudflare does not provide this “feature”.

In Hong Kong, the main page is loaded in less than a second. However, in Mumbai / Beijing, it takes sometimes more than 1 minute to load the main page. In these locations, we should have high speed internet connection so I do not really understand what is happening.

Besides CDN services, are there some other ways to speed up Discourse?


Given that the only independent variable in your setup is the network location of the end user, I think it’s very likely that the problem isn’t one that Discourse can solve.


1 minute seems too long for Asia user to visit a Hongkong server. Do you have performance data for static file to be accessed in those location with issues?

you mean the discource performance report?

No. I suggest to test the performance by visiting a static file. For example, the favicon or robots.txt file. If static file accessing is also slow, then the issue may exist in network.


Let me check with my users. It’s a good test

I believe your servers being in Singapore is the crux of the prob. China has only a few thick pipes out of the country (passing thru the Great Firewall). Hong Kong is one of the main pipes.

I have most of my servers in Azure Hong Kong and I get consistently reasonable access speed from all parts of China. Of course, it is still much slower than if you move your servers into China, to services such as Aliyun.

I do have pretty poor results with Cloudflare though… consistently poor access speed even in Hong Kong, and even worse in China. I ended up turning Cloudflare OFF and speeds returned to normal for direct access.

So I’d suggest you move away from Cloudflare and try again. Cloudflare may be one of your problems.

What I said about China above means that a CDN is useless for users in China. In many cases it is probably worse.

EDIT: Not sure about Mumbai, but my team in India have been accessing the Hong Kong-based VM’s with no speed prob other than congested Internet.


That’s very interesting! We specifically added CF because they offer a good coverage in China (=lots of CDN servers). I though this would help with static content.

What do you mean by reasonable access speed. Are we talking about 1-2 second to load discourse?

Frankly speaking, depending on the location. And 4G speeds. Don’t assume big cities like Beijing and Shanghai will have lightning-fast speeds – they don’t. Larger cities have slower speeds due to congestion. Second-tier cities have fastest. Third-tier cities or less urban areas also have slower speeds due to less infrastructure.

But, for example, I’m sitting on the fringe of Shenzhen (South China) and accessing my Discourse VM on a PC took about 3 seconds to load. If I use a cell phone, it took 5 seconds to load the page assets, and another 5 seconds before all the topics appeared. Total 10 seconds – and I’m in a semi-rural area.

As for Cloudflare, my personal experience is that it took FOREVER to access the site on it from China. That’s why I took my sites off CF.


Oh, and by the way, make sure that you remove ALL scripts and fonts loading from Google sites. Those will just hold up your 4G connection forever and eventually they time out.

I’m sure you don’t use those in your site because otherwise your site won’t even load in China. However, the trick is… Check Google Analytics!

Make sure you are NOT loading Google Analytics when the IP is in China, or the GA calls will block. Sometimes they block the whole page in China until the GA calls time-out.


1 Like

I always imaged Discourse’s modern architecture would be fairly optimal.

Correct me if I’m wrong but most of the rendering is handled by the client with Ember, so apart from the initial load, subsequent pages should appear quicker?

In this respect you are minimising the number of calls and the size of the responses.

That would only leave an option to distribute the database and webservers. I’ve never tackled such a project but should imagine it’s possible, if not supported out of the box. However that will definitely add to cost and maintenance overhead even if it were technically feasible!

Yes, the slowest is loading the first page. If the assets are cached locally, even that is quite fast. Subsequent pages are loaded via Ajax and much faster.

However, the OP is facing a slow problem in multiple countries. Some, like India and Indonesia, really depends on where you are, because the Internet infrastructure is still not 100% well-covered. However, in China, the Internet is REALLY developed, so the slowness should come from something else.


Just note that CloudFlare only offer services in China if you’re on an enterprise plan:

Also, it is possible use a CDN URL with CloudFlare (don’t route your primary domain through CloudFlare, point a extra subdomain there, set that to route through CloudFlare, then use that as your CDN URL)


Indeed. You are right. I did not see that coming :slight_smile:!!

I guess I thought it was christmas :slight_smile: A free plan with an extensive coverage accross china. Too good to be true!



So that explains why my previous Cloudflare sites were so slow in China (but their china site is lightning fast)!

Good catch!