AlexsLemonade / AlexsLemonade/refinebio
[Planning] Create read-only DB to keep API Highly available
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 135
- Forks
- 21
- PR merge metrics
- No merged PRs in 30d
Description
This issue is not yet ready for implementation because it's not fully planned out yet.
Context
Our API goes down every time we deploy. It also becomes unresponsive sometimes if we're processing too hard and causing the DB to get overloaded.
Problem or idea
@davidsmejia has been wanting to add a read-only database. I think this will help with both issues.
We can have the API use the read-only DB for every endpoint other than datasets since that's the only endpoint that isn't read-only.
We can also change our deploy process to deploy the read-only-db in a separate step. This means that our deploy process could:
- Migrate the existing DB
- Start a new API that points at the existing DB.
- Forward traffic to the new API.
- Migrate the read-only API
- Restart the old API.
- Forward traffic back to the old API.
- Remove the new API.
This process can be broken up such that we can trigger a new type of deploy, api-only, that only does steps 2, 3, 5, 6, 7 and should only be run for deploys that contain no new migrations.
Solution or next step
Kick the tires on this approach some. Will this work? What's the hard part? If this approach seems reasonable then I think this should be broken into at least many sub-issues including but not limited to:
- Create read-only DB
- Make API use read-only DB for as many endpoints as possible.
- Modify deploy process
- Add new deploy tag to trigger api-only deploys.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No files, tests, or entry points are named. Start by mapping the current API, database access, and deployment process, then assess whether a read-only database and separate API-only deploy are feasible. Done means the approach is validated and split into implementation-ready sub-issues with clear migration and traffic-switching requirements.
Written by the indexing model from the issue text.
Assessment
- Domain
- api, backend, databases, infrastructure
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 15/100