Skip to content

feat(reader): add support for read replica#137

Closed
johannsonic wants to merge 1 commit intoeoin-obrien:mainfrom
johannsonic:main
Closed

feat(reader): add support for read replica#137
johannsonic wants to merge 1 commit intoeoin-obrien:mainfrom
johannsonic:main

Conversation

@johannsonic
Copy link
Copy Markdown

@johannsonic johannsonic commented Aug 30, 2024

Hey!

We had a big problem in our production setup where all raw prisma-kysely queries hit our writer db, even for read-only operations. With this proposed solution, one can pass a configuration object to the extension and opt-in to use the replica instance for read queries.

I already used this implementation in our prod setup and our writer instance immediately cooled down :)

Johann

@tylerjbainbridge
Copy link
Copy Markdown

Would love to see this landed :)

@eoin-obrien
Copy link
Copy Markdown
Owner

Hi, and thanks for using prisma-extension-kysely!

The extension should work with read replicas as-is, but the order the extensions are applied in (and the way the read replicas are created) can result in the primary Kysely instance being shared across the .$primary().$kysely and .$replica().$kysely.

I've added some documentation on it to the readme if you'd like to check it out and see if it works properly when run like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants