My FeedDiscussionsHeadless CMS
New
Sign in
Log inSign up
Learn more about Hashnode Headless CMSHashnode Headless CMS
Collaborate seamlessly with Hashnode Headless CMS for Enterprise.
Upgrade ✨Learn more
Matteo Collina

13 likes

·

1.1K reads

4 comments

Vasu Rangpariya
Vasu Rangpariya
Feb 26, 2024

How to implement deduplication without using platformatic with Fastify. Is there any demo code to implement it with a route or controller?

1
·
·2 replies
Melroy van den Berg
Melroy van den Berg
Mar 18, 2024

I guess implement the package yourself in your Fastify app: github.com/mcollina/async-cache-dedupe

I guess just adding a cache behind each DB call? See some TS example code: github.com/mcollina/async-cache-dedupe?tab=..

Here another example implementation: github.com/Shyam-Chen/Fastify-Starter/blob/..

·
Melroy van den Berg
Melroy van den Berg
Mar 18, 2024

If you are more advanced... And understand the examples above.

You could also checkout the Platformatic code, if you want to see a template style of implementing it, thus it can be used in a very general way: github.com/platformatic/platformatic/blob/b..

Then the setupCache method is used here: github.com/platformatic/platformatic/blob/b..

·
Melroy van den Berg
Melroy van den Berg
Mar 29, 2024

You have a typo: "requests per second increase to approximately 25,567 at the 97.5th percentile."

This is for 50th percentile. For 97.5th percentile you actually have 26,191!

1
·