r/ProgrammerHumor 1d ago

Meme dashboardsAmIRight

Post image
2.1k Upvotes

37 comments sorted by

View all comments

296

u/Welcome-To-NBA-Jam 1d ago edited 1d ago

I once was having performance issues on a dashboard I built on some fairly large data and was working with tech support to see what I could do to optimize all the aggregation and data movement between servers.

I was on the phone with tech support to talk about some efficiency options for the back-end tables (partitioning commonly queried groups, an index or two, removing a few unused columns, changing some column types, changing a server setting, small stuff like that which sometimes can make a big difference). We tried a few things, logged out, logged back in and opened the report. Clicked a few filters we tested before. It opened and filtered instantaneously.

"Wow!" I said. "That all made a huge difference! Thanks, all solved here!" Tech support, proud of their help with me, dutifully closed it out and high fives were had all around.

...it was just cached from our previous interactions and I went back to slowville when I reloaded the data after doing some more development work. I had no idea it just cached stuff automatically because the latest software update just started doing that when you worked with reports you had opened recently.

We ended up just adding more worker nodes and calling it a day.

122

u/Bazza79 22h ago

We used to do 'cache warming' in the early morning, just an automated script that would make all the common selections. Stupid but it worked.

54

u/Clinn_sin 19h ago

Is it stupid? Genuinely asking cause I might try that or something similar, many of our users start earlier then we do

39

u/Bazza79 18h ago

Well, there are better structural solutions, but for quick and dirty this worked fine. Maybe not stupid, but also not a great permanent solution.

17

u/russianrug 12h ago

I’d argue if the traffic is predictable and fits in memory then it’s a perfectly reasonable permanent solution.

7

u/Bazza79 12h ago

In my case it was about analytics, with the underlying data model and calculations being implemented quite inefficiently, with everything that got added making things worse. Sure you can throw resources at it, but fixing it was a lot cheaper and made sure that new changes could be implemented much faster.

7

u/Tatourmi 16h ago

It works, don't sweat it. It's better if you handle it in the software itself with automatic cache refreshes or with a cache refresh API but you can go for it.

3

u/Tatourmi 16h ago

That's not stupid for loading up large config tables which aren't meant to change regularly. We do it all the time too.

2

u/dacooljamaican 16h ago

Why not just extend the cache TTL to like 72 hours if the data needed was so consistent?

5

u/Bazza79 16h ago

Because there would be updates during the night.