First Byte Time vs CDN?

What are the differences between loading a page using CDN and what kind of prodivers are you using?

I have much longer loading time to use with cdn. Can I do something wrong or don’t know about something ? maybe i should still set some settings I don’t know about?

CDN will be slower until it gets resources cached. You might wait a while before doing any testing.

3 Likes

Well, the first clue … thanks to .
A little bit. How much? We’re talking about days, weeks?

Should we force a payload in https or rather http ? I’m asking because there are differences in loading. What does it depend on whether the page is loaded all or looks like the original javascript would have not been loaded ??

The time frame will depend on how the users interact with the site. The most downloaded assets will get loaded to the CDN caché, and will be faster if you’re closer to the CDN server than from the server.

If you have the datacenter next to you, and the CDN server is 1000Km away, it will always be slower. The idea of the CDN is to serve better a geographically diverse audience, not to improve centralized visits.

4 Likes

But are we talking about a situation once we add the cdn address to our app.yml file or not ?

And what is the reason to use a subdomain for cdn addres? i.e. why can’t it be DISCOURSE_CDN_URL: //637763234.cdn-provider.com and should be discourse-cdn.example.com ??

Yes, I know, but I’m checking with different testing tools from many regions of the world. And cdn is always slower !

Are you talking about TTFB on which path exactly?

TTFB for a static asset (like a JS file, or a JPG user upload) will always be fast using a CDN, as latency only of the multiple PoP will help with it.

TTFB of dynamic routes in the other hand makes no sense to compare, as our DISCOURSE_CDN_URL doesn’t cover those anyway.

Can you explain exactly what you mean ?

I’m giving the results for the test forum. (btw it’s just come out a little faster) // But it’s only on a fresh domain without content.

and for the cloudfront created

What you are seeing is just normal variance. CDN will have no impact on the time to first byte on your the root of your Discourse instance or in any other dynamic route. A CDN will only serve the static assets.

3 Likes

And is there a difference if these resources (static assets) are kept in S3 ?

No, there’s none. The CDN will cache those assets from S3 when needed.

That is just a vanity address, is not needed at all.

3 Likes

I was hoping that CDN will speed up the loading of the page, but I guess it will be negligible.

Are there other much more effective ways to speed up page loading for different parts of the world besides increasing RAM and CPU resources ?

TTFB is the time it takes for the application server to send a 200 response. You can’t boost it using a CDN as the CDN is only serving assets.

5 Likes

You’ll speed up the page, but not the First Byte. You’ll speed up the loading of multimedia (images, PDF, videos) and JS. This will improve the snappiness of the site, but all the dynamic content will need to be loaded from the central server.

So, the Avatars of the users will be quicker, for example, but not the titles of the topics.

4 Likes

Since Discourse blocks the rendering waiting for JS & CSS, you will still make the page interactive faster by leveraging a CDN.

Doing this type of analysis requires a bit more than blindly running lighthouse and webpagetest and picking a result and obsessing over it.

If your priority is having a page with a higher score on those tools I recommend running a blog powered by tools like https://jekyllrb.com/

6 Likes

How am I supposed to analyze it then?