🌳 Evergreen thought

2022 Week 32 in Review

planted on in: Week In Review.
~398 words, about a 2 min read.

"Freedom is the only worthy goal in life. It is won by disregarding things that lie beyond our control."
— Epictetus

This week has been spent split between a Node.js project and Laravel. The Node project uses Fasifty with Prisma and Redis to build a service for our routing engine to be hosted on aws lambda.

The project itself is going well, coming from PHP there was a huge shift in mindset needed at the beginning as building for lambda comes with its own constraints. When making requests for example I kept hitting a delay of two seconds before each request would process.

Using the JavaScript Performance measurement APIs I was able to nail this down to the first database query. It's a simple query and ran in about 500ms within TablePlus, even quicker at 23ms once I added an index on the two columns being filtered, so why the ~2000ms delay?

It turns out the delay is the Prisma.js cold boot time. This is compounded by the fact that I am booting Prisma for each request meaning it ends up garbage collected rather than remaining in global scope for all requests to utilise. The solution I have yet to implement is writing a Fastify Plugin to instantiate and expose the Prisma Client instance. The cold boot time will still be there but importantly; it won't be felt by every single request.

Joke of the week

"Why did the scarecrow win an award? Because he was the best in his field."

Notable Articles Read

Notable Videos Watched

Cool things from around the internet

Game Wishlist

Page History

This page was first added to the repository on August 24, 2022 in commit b17ff2ab and has since been amended twice. View the source on GitHub.

  1. refactor(#304): move files into src folder
  2. chore: prefix slugs for 2022 week in review with year
  3. feat: publish week 32 in review