Quick revision
The short answer
I would decide from evidence, not taste: first measure the risk the system carries today (two key people, incidents, scaling limits, missing features, operating cost), then compare investing in it, adopting an open source scheduler or workflow engine, and moving the messaging parts to a managed broker. Whatever we choose must keep transactional enqueue, which is the system's real strength, and any migration goes job type by job type with dual running and exit criteria, never as a big-bang rewrite. Meanwhile we spread knowledge immediately, because that risk exists whatever we decide.
What to remember
In this answer, we saw that the decision starts with measuring the risk the legacy system carries: key people, incidents, limits, missing features and operating cost. We compared keeping and investing, adopting an open source scheduler or engine, and moving messaging to a managed broker, with the rule that transactional enqueue must survive through the same database or an outbox. Any replacement goes job type by job type with shadow runs, exit criteria and a decommission date, and knowledge spreading starts at once.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would decide from evidence, not taste: first measure the risk the system carries today (two key people, incidents, scaling limits, missing features, operating cost), then compare investing in it, adopting an open source scheduler or workflow engine, and moving the messaging parts to a managed broker. Whatever we choose must keep transactional enqueue, which is the system's real strength, and any migration goes job type by job type with dual running and exit criteria, never as a big-bang rewrite. Meanwhile we spread knowledge immediately, because that risk exists whatever we decide.
Why this question is asked
Home-grown infrastructure that became critical is one of the most common situations a principal engineer inherits. It works, it carries the business, and it is a single point of failure in people rather than machines. Interviewers ask this to see whether we can make a measured decision instead of either defending the old system or rewriting it out of enthusiasm. In this answer, we will assess the risk, lay out the options with their costs, identify what must be preserved, plan a gradual migration, and start reducing the people risk on day one.
1Start With an Honest Risk Assessment
Before choosing anything, we need facts about the current system. The first risk is key-person dependency: if one of the two engineers leaves and the other is on holiday when it breaks, how long would recovery take? We can make this concrete by listing the last ten incidents and asking who resolved each one; if the answer is the same two names every time, the risk is real and measurable.
Then we gather the rest. Incidents and their impact over the last two years. Scaling limits, such as throughput ceilings, table bloat or lock contention that already needed tuning. Missing features teams keep asking for, such as delayed retries, priorities, workflow steps, or visibility into a single job's history. And the cost of operating it: engineer time spent on support, on-call load, and features delayed because the two experts are busy.
2Comparing the Options
There are three realistic paths, and they can be combined. We can keep and invest: document it, add tests and observability, fix the top limits, and train more engineers; this is cheapest if the design is sound. We can adopt an open source scheduler or workflow engine, such as Quartz, db-scheduler or JobRunr for jobs, or Temporal for multi-step workflows, which brings a community and documentation but means migrating thousands of job types and running new infrastructure. Or we can move the messaging part to a managed broker such as a cloud Kafka or RabbitMQ service, which removes the hardest scaling work from our team but loses the simplicity of one database.
Each option has a cost in migration effort, new failure modes and skills. A decision table makes the trade-off visible to the people who must approve it.
| Option | Gains | Costs and risks |
|---|---|---|
| Keep and invest | no migration, proven behaviour | still custom, needs lasting staffing |
| Open source scheduler or engine | community, docs, features | migrate thousands of job types, new infra |
| Managed broker for messaging | scale and operations handled | lose same-transaction enqueue unless outbox kept |
| Hybrid by job type | each part on the best fit | two systems for a while, needs an end date |
3Keep What Already Works
A system that has run a business for ten years usually got some important things right, and the replacement must not quietly lose them. Here the most valuable property is transactional enqueue: because jobs and messages live in the same database as the business data, a job is created in the same transaction as the change that requires it. That gives exactly-once creation without any dual-write problem.
So the requirement for any replacement is explicit: it must either use the same database for enqueue, or keep an outbox table written in the business transaction and relayed to the new system. We should also list other implicit guarantees, such as ordering within a customer, de-duplication of jobs, or retry behaviour, by reading the code and asking the two experts, and turn each into a test that the replacement must pass.
4A Gradual Migration With Exit Criteria
If the decision is to replace some or all of it, we migrate job type by job type, starting with low-risk, high-volume types that teach us the most. For each type, the new system runs in shadow or dual mode first, processing the same work with side effects disabled or deduplicated, and we compare results. Then we switch the type over and keep the old path available for quick rollback.
Exit criteria keep the migration honest: for example, error rates and latency equal or better for four weeks, no data differences in shadow mode, runbooks written, and on-call trained. Just as important is a decommission date for the old system once the last type has moved, because a migration without one tends to stop at 80 percent and leave us running both forever.
- Pick a job typelow risk, high volume first
- Shadow runnew system processes copies, side effects off
- Results match and metrics are healthy?Yesswitch the type to the new systemNofix and repeat the shadow run
- Keep rollback for a few weeksold path ready to take the type back
- Retire the old path for this typecount down to decommissioning
5 steps in order. Play them, or step through them one at a time.
5Spread Knowledge Now, Whatever We Decide
The people risk should be reduced immediately, because any of the options takes months. We can rotate two or three more engineers into on-call shadowing for the system, have the experts write runbooks for the top ten incident types, and record walkthroughs of the architecture. Adding automated tests around the core claiming, retry and scheduling logic is also a way to capture knowledge, because tests describe behaviour precisely.
This work pays off in every outcome. If we keep the system, more people can run it. If we replace it, the same knowledge is what tells us which behaviours the replacement must keep.
6Follow-up questions
How do you present this decision to leadership?
As a risk and cost comparison over three years: the current risk, with incident data and the key-person exposure, the cost and timeline of each option, and what the business gains, such as faster delivery of features teams are waiting for. A recommendation with a staged plan and decision points is easier to approve than a single large rewrite budget.
What if the two experts resist the change?
Involve them as owners of the assessment rather than as obstacles. They know the hidden guarantees better than anyone, and their input decides what the replacement must preserve. Often their resistance is about losing something that works, which the keep-what-works requirement directly addresses.
Why not a big-bang rewrite if the system is so risky?
Because a rewrite of thousands of job types concentrates all the risk at one cut-over date, needs the experts' full attention, and usually takes far longer than planned while the old system still needs care. Migrating by job type spreads the risk, delivers value early, and can stop at any point with a working system.
7Conclusion
In this answer, we saw that the decision starts with measuring the risk the legacy system carries: key people, incidents, limits, missing features and operating cost. We compared keeping and investing, adopting an open source scheduler or engine, and moving messaging to a managed broker, with the rule that transactional enqueue must survive through the same database or an outbox. Any replacement goes job type by job type with shadow runs, exit criteria and a decommission date, and knowledge spreading starts at once.
Open with
I'd start by turning the worry into data: who fixed the last ten incidents, how many incidents and how severe, what scaling limits we've already hit, which features teams keep asking for, and how much of the two engineers' time goes to support.
Then, if they want more
Then I'd compare three options, possibly mixed by job type: keep it and invest in docs, tests and observability; adopt an open source scheduler like db-scheduler or JobRunr, or a workflow engine like Temporal; or move the messaging part to a managed broker.
Whatever we pick, I'd protect what it does well, especially transactional enqueue, jobs created in the same transaction as the business change. A replacement has to use the same database or keep an outbox, and the other implicit guarantees become tests.
If we replace, it's gradual: one job type at a time, shadow running, clear exit criteria like four weeks of equal error rates, rollback kept for a while, and a decommission date so we don't run two systems forever.
And regardless of the decision, I'd reduce the people risk right away with on-call rotation, runbooks and tests, because that pays off in every outcome.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
- Official documentation
- PostgreSQL documentation, MySQL reference manual
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "A decade ago your company built its own job and messaging system on top of database...": https://scrivio-interview-library.netlify.app/databases/database-locking/26fcbf24bf/