Archive

The Dulin Report

Browsable archive from the WordPress export.

2022

In most cases, there is no need for NoSQL Apr 18, 2022 TypeScript is a productivity problem in and of itself Apr 20, 2022 Best practices for building a microservice architecture Apr 25, 2022 Good idea fairy strikes when you least expect it May 2, 2022 If you haven’t done it already, get yourself a Raspberry Pi and install Linux on it May 9, 2022 Most terrifying professional artifact May 14, 2022 Peloton could monetize these ideas if they only listen May 15, 2022 Am I getting old or is it really ok now to trash your employer on social media? May 25, 2022 There is no such thing as one grand unified full-stack programming language May 27, 2022 Automation and coding tools for pet projects on the Apple hardware May 28, 2022 Java is no longer relevant May 29, 2022 Good developers can pick up new programming languages Jun 3, 2022 Scripting languages are tools for tying APIs together, not building complex systems Jun 8, 2022 Keep your caching simple and inexpensive Jun 12, 2022 All developers should know UNIX Jun 30, 2022 Monolithic repository vs a monolith Aug 23, 2022 Why don’t they tell you that in the instructions? Aug 31, 2022 Using GNU Make with JavaScript and Node.js to build AWS Lambda functions Sep 4, 2022 Stop Shakespearizing Sep 16, 2022 The Toxic Clique Sep 28, 2022 Book review: Clojure for the Brave and True Oct 2, 2022 Why you should question the “database per service” pattern Oct 5, 2022 Why I am a poll worker since 2020 Nov 11, 2022 If we stop feeding the monster, the monster will die Nov 20, 2022 Things to be Thankful for Nov 24, 2022 Working from home works as well as any distributed team Nov 25, 2022 Should today’s developers worry about AI code generators taking their jobs? Dec 11, 2022

Keep your caching simple and inexpensive

June 12, 2022

Caching is a complex topic. It can make your application perform faster, and it can also make your life living hell. Here are some things I learned from experience:




  • If you want to cache data that might be frequently updated and you always need up to date values, you cannot do better than DB cache;
  • Cache coherence is tough to get right. If you have some shared data that you want cached, use a shared cache like Redis or rely on DB;
  • In a distributed stateless system (i.e. AWS Lambda), in-memory caching is ineffective because your compute resources are short-lived. Use a shared cache;
  • In a distributed system, the latency of calls to a shared cache like Redis is outweighed by reliability and consistency. See point 2 on “Cache Coherence.”
  • Memoization helps only when the same expensive function is used many times in the same computation;
  • Always err on the side of open source tools over proprietary. It is highly unlikely that proprietary tools are better;
  • Don’t overthink vendors. Caching is complex but not complex enough to require a complex proprietary product and a vendor contract;
  • If you can’t provision a shared cache service on AWS using the AWS Dashboard, avoid it like a plague. See point above;



Point is — keep your caching simple, inexpensive, and don’t overthink it.