Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Low Latency Go API w/ Embedded Caching, Redis Streams, Postgres, & Debezium

Sign upSign InSign upSign InMember-only storyParker RoanFollowLevel Up Coding--ShareIn this article, we’ll construct an API using Go that incorporates an Embedded Cache capable of scaling safely to any specified number of replicas.The use of a embedded cache alongside change data capture (CDC) invalidation is a powerful technique offering a robust method to ensure our high-performance cache remains synchronized with its primary data source.In this pattern, we’ll use the following components:I’ll be leveraging the Cache-Aside approach, often referred to as Lazy-Loading. A standout aspect of this article lies in our strategy to maintain cache synchronization.By harnessing Debezium and Redis Streams, we’ll capture CDC events from Postgres and then consume those events to invalidate records in our embedded cache. Therefore; no matter how one updates our postgres source of truth, the cache will always invalidate stale items across all of the in-memory instances.The results from this exercise were really promising. Local requests made directly to Postgres without caching typically yielded a response time of 10–20ms. In contrast, hits to the embedded cache are impressively swift, clocking in at just 1–2ms.----Level Up CodingSoftware Engineer, Entrepreneur, Python/Golang DeveloperParker RoaninGoogle Cloud - Community--1Arslan AhmadinLevel Up Coding--21Arslan AhmadinLevel Up Coding--30Parker Roan--1Simeon GrancharovinStackademic--5Mahesh SainiinInterviewNoodle--45Okan Özşahin--Edouard Courty--7Chaewonkong--Harendra Kumar--6HelpStatusAboutCareersBlogPrivacyTermsText to speechTeams



This post first appeared on VedVyas Articles, please read the originial post: here

Share the post

Low Latency Go API w/ Embedded Caching, Redis Streams, Postgres, & Debezium

×

Subscribe to Vedvyas Articles

Get updates delivered right to your inbox!

Thank you for your subscription

×