This is not about uttaraayan, where so far i have not been caring about the file size, pretty evident from the fact i randomly upload full gifs as small board tags so on.

It's related to bharatchan, as a dev there, recently found out the user's complain about 5seconds to 10 seconds of page load time - which is bad.

So i started investigating, it couldn't be database queries since even worse hosting services with worse indexing and almost 300k+ posts i never faced that issue. We looked into if db was hitting the cache limit - nil nada.

So once db was found out as non-issue, atleast not the major enough to cause 5 seconds to 10seconds delay, went back to the square one, starting with tracking of network in the browser. Checking which payloads are taking time to load, so on.

Moment of Truth

While investigating i could clearly see, the major cause of delay was due to the files - i look at their cache, some of them are cached, some are repeatedly hitting either the server of the cloudflare proxy. It's a mess.

So my first thought was maybe the server ones are causing the issue, so added some rules at cloudflare for precise caching of the media files. Nope, that was not it.

During this time, since i have using certain type of traditional file style - i ensured that atleast 48gb worth of data was relegated away from the active directory.

And during the same time, i had migrated to the subdomain temp.bharatchan.com which i use for testing new features, updates etc. before they are moved to prod.

So while stuck in wagie cagie and this issue lingering in the mind, i thought about pinging the services - cloudflare, server and i could find almost 5x slower response when the cloudflare proxy was used compared to not using it. It's free tier service, so possibly that - but this was the truth.

For temporarily, i just disable the cloudlfare proxy for my subdomain and tested it, voila! page is loading faster, it's swift, response time is down, time taken to load resources is down by almost a factor of 4x.

This was my cue, so i have disabled the cloudflare proxy for now. It's working great, while working on this i realized that the output response from the server peak to around 200MBit/s, this is within the limit but obviously not optimum so i started searching again.

Looking into the networks section of the browser, checking the files - their response headers etc. I realize, there it is - the max-age:0, bruh. So i update the details to ensure proper caching of fonts/images/scripts/styles. Of course among these only images one is in the prod rest are tested and working fine at the temp subdomain.

The moment of Bliss

So for months, anons had complained about the issue related to huge data spike, slower load time for the pages all came down to two things

  • Cloudflare proxy being slower

  • Improper caching settings - causing hit or miss of caching at the browser end

And with atleast point 1 being half way taken care, i will check if the premium ones are better since i like the cloudflare services, and second one taken care completely the page loads are smoooooothhhh like butter smoooth.

I saw the page load in less than a second, i saw the entire page load content size limited to 1.3kb, the time taken to load one such payload went from 600ms to 60ms.

And it feels great.

There's lot to do and improve upon still but here we are.

Good Night sirs.

happy wojak.jpg
View happy wojak.jpg

Image Refs in the Post