From RFC to Production: What They Don't Tell You About Implementation
Where RFC designs diverge from production reality, using notification systems as the worked example, and how to tell useful adaptation from architectural drift.
RFCs rarely survive contact with production unchanged, and that is not automatically a failure. Architecture diagrams that looked clean in review become tangled six months later, as timeline pressure, missing requirements, and operational realities force trade-offs that were never in the design.
The pattern is not bad design or bad engineers. It is the normal cost of building complex systems under business constraints. The useful skill is separating signal from drift: a gap is signal when the design met a requirement nobody could have known about at review time, and drift when the design was abandoned because following it was inconvenient. A change with no recorded reason counts as drift, because nothing shows that it met an unknown requirement. Notification systems make a good worked example, because the specification is short and the operational surface is unusually wide.
Building a Notification System from RFC to Reality#
Take a hypothetical notification RFC of the kind most teams would recognise. It opens with four success criteria, and every one of them can be checked against numbers that operators have published about their own systems.
// A hypothetical RFC's success criteria, written before any code exists
interface NotificationSystemGoals {
deliveryTime: '<100ms for in-app, <5s for email',
throughput: '10,000+ notifications per second',
uptime: '99.9% availability',
timeline: '12 weeks with 2 developers'
}
Checked one line at a time against published figures, three of those four change meaning.
Uptime. The availability table in Google’s Site Reliability Engineering book converts 99.9% into 43.2 minutes of unavailability per month and 8.76 hours per year, and 99.99% into 4.32 minutes per month and 52.6 minutes per year. One deploy that takes an hour to roll back has spent the entire monthly budget at 99.9% and the entire yearly budget at 99.99%. The target buys a fixed number of minutes, and that number is smaller than most incidents.
Delivery time. LinkedIn’s engineering blog reports that its notification platform, Air Traffic Controller, processes over a billion requests per day, and that reworking the delivery path brought P90 end-to-end latency for member-to-member messaging push notifications down from about 12 seconds to about 1.5 seconds. That figure belongs to push. The RFC prices in-app and email and sets no target for push at all. It stays silent about the path a notification takes when the app is not open.
The in-app line needs an in-app measurement, and the published ones are sub-millisecond with a narrow scope. Netflix’s Pushy team reports median latency under one millisecond and 99th-percentile latency under 4ms, measured “from the incoming message arriving at Pushy to the response being sent back to the device”. That covers one hop inside infrastructure Netflix owns. A user’s phone sits several hops further out, and none of those hops are in the number. So 100ms holds where Netflix draws its boundary, and the RFC never says where it draws its own.
Throughput. The same Netflix post describes hundreds of millions of concurrent WebSocket connections and a system that regularly reaches 300,000 messages sent per second, running at an average of 200,000 connections per node with room to reach 400,000, up from 60,000 per instance previously. That is the shape of a channel the sender owns end to end. The moment a notification fans out to a channel somebody else owns, the ceiling is theirs to set:
| Fan-out path | Limit per target | Limit per account |
|---|---|---|
| Slack channel post | Slack’s chat.postMessage reference documents roughly 1 message per second to a specific channel, with generous bursts | Several hundred messages per minute per app across the whole workspace |
| SMS via Twilio | A short code sends 100 messages per second and a US toll-free number 3 by default, each per sender. A US long code under A2P 10DLC gets a set rate per registered campaign, shared by every number in it and counted in message segments: 225 per second toward the major US networks at the top Trust Score tier, 12 at the lowest | An account-wide rate limit caps every sender and campaign combined, and segments above it wait in a queue; messages that wait more than 10 hours (the default) fail with error 30001, queue overflow |
| Email via Amazon SES | 50 recipients per message | Sandbox accounts get 1 email per second and 200 per 24-hour period; production rates vary by use case, and every quota applies per Region |
| iOS push payload | 4096 bytes for a regular remote notification, 5120 bytes for VoIP; APNs refuses anything larger | No throughput figure; the cap applies to each notification |
The two columns combine in a fixed way. The aggregate ceiling of a channel is the smaller of two numbers: the per-target limit times the number of targets (channels, senders or campaigns) the system sends through, and the account limit. A burst of 10,000 single-segment notifications shows how far apart the results land:
- SMS from one US toll-free number: 10,000 messages at the default 3 per second take about 3,333 seconds, close to an hour.
- SMS over one A2P 10DLC campaign: 12 per second at the lowest Trust Score tier, so about 14 minutes; 225 per second at the top tier, so about 45 seconds. Adding numbers to the campaign changes neither figure, because every number in it shares the campaign’s rate.
- SMS from one short code: 100 per second, so 100 seconds.
- Slack posts to 1,000 channels: the per-channel rule alone would allow 1,000 posts per second, but the workspace limit decides. Read the workspace limit of several hundred messages per minute as 300, and the burst takes over half an hour.
None of these reach 10,000 per second, and no amount of internal engineering moves the per-target or per-account numbers. What the design controls is which of those limits applies. For US SMS that means the sender type (short code, toll-free number or 10DLC campaign) and the campaign’s registration tier. Sender count helps only where the provider meters per sender, and only up to the account limit. For SES it means the Regions the system sends from. The throughput line in the RFC therefore describes buffering capacity, and sending speed is set by the channel owner’s limits and those choices.
Everything else in the RFC can be genuinely thorough: rate limiting, deduplication, preference management, quiet hours. All of that sits under your control. The ceilings in the table above do not, and being rigorous about the first set buys nothing on the second.
Implementation Challenges and Adaptations#
Database Schema Evolution#
The initial database schema design emphasized clean normalization with proper foreign keys and constraints. A stricter version of the same table, with NOT NULL columns, TIMESTAMPTZ and monthly partitions, is worked through in the section-by-section RFC guide; the looser draft below keeps the comparison short:
-- Initial RFC schema design
CREATE TABLE notification_events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID REFERENCES users(id) ON DELETE CASCADE,
notification_type VARCHAR(100) NOT NULL,
template_id UUID REFERENCES notification_templates(id),
data JSONB DEFAULT '{}',
status VARCHAR(20) DEFAULT 'pending',
sent_at TIMESTAMP,
delivered_at TIMESTAMP,
read_at TIMESTAMP,
created_at TIMESTAMP DEFAULT NOW()
);
An illustrative production version, assembled from changes that are common in systems of this kind, looks more like this:
-- Schema after production adaptations
CREATE TABLE notification_events (
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
user_id UUID, -- Foreign key removed due to performance issues
notification_type VARCHAR(100),
notification_type_v2 VARCHAR(255), -- Migration in progress
template_id UUID,
template_id_v2 BIGINT, -- Different team used different ID type
data JSONB DEFAULT '{}',
data_compressed BYTEA, -- Added when JSONB got too large
status VARCHAR(20) DEFAULT 'pending',
status_v2 VARCHAR(50), -- More statuses than expected
priority INTEGER DEFAULT 0, -- Not in RFC, critical for production
retry_count INTEGER DEFAULT 0, -- Not in RFC, essential for debugging
channel VARCHAR(50), -- Denormalized for query performance
correlation_id UUID, -- Added for distributed tracing
partition_key INTEGER, -- Added for sharding
sent_at TIMESTAMP,
delivered_at TIMESTAMP,
read_at TIMESTAMP,
failed_at TIMESTAMP, -- Not in RFC, very much needed
expires_at TIMESTAMP, -- Not in RFC, prevented infinite growth
created_at TIMESTAMP DEFAULT NOW(),
updated_at TIMESTAMP DEFAULT NOW() -- Added once nobody could tell when a row last changed
);
-- Every new access path arrives with an index, and every index is paid for
-- on each insert and update, not just on the query it was added for
CREATE INDEX CONCURRENTLY idx_notification_events_user_created ON notification_events(user_id, created_at DESC) WHERE status != 'deleted';
CREATE INDEX CONCURRENTLY idx_notification_events_correlation ON notification_events(correlation_id) WHERE correlation_id IS NOT NULL;
The indexes are the part that keeps costing. The PostgreSQL documentation states the trade plainly: once an index exists the system has to keep it synchronized with the table, which adds overhead to data manipulation operations and can prevent heap-only tuple updates, so indexes that are seldom or never used in queries should be removed. CREATE INDEX CONCURRENTLY is what makes adding one safe on a live table, since it avoids locking out writes, and PostgreSQL also documents its two costs: the build takes longer, and a build that fails leaves an invalid index behind that still carries the update overhead until somebody drops it.
The columns do not all earn the same verdict. Applied to each change, the test from the opening asks two things: could the review have known about the requirement, and does the change carry its reason?
| Change | Verdict | Why |
|---|---|---|
priority, retry_count, failed_at, expires_at, correlation_id, updated_at | Signal | Each answers a question only operation asks: which message goes first, why one failed, when a row may be deleted, how to follow one send across services |
channel, partition_key, data_compressed | Signal if measured | Valid when a slow query, a table size or a payload size forced them; drift when they were added in anticipation |
notification_type_v2, status_v2 | Signal with an expiry | A migration in progress is legitimate; one with no owner and no end condition leaves duplicate columns behind for good |
user_id without its foreign key | Drift | The comment cites “performance issues” but names no query and no number, and the integrity the RFC asked for is gone |
template_id_v2 BIGINT | Drift | A second team’s ID type was accepted because aligning was inconvenient, and every join now has to know which column to read |
Reversing a drift is mostly a matter of doing it without an outage. The foreign key is the cleanest case, because PostgreSQL lets the constraint come back in two steps. With NOT VALID, adding the constraint skips the scan of existing rows and commits immediately, while every later insert and update is checked. VALIDATE CONSTRAINT then scans the old rows under a SHARE UPDATE EXCLUSIVE lock, which does not lock out concurrent updates. The documentation names this exact use: a table known to contain violations gets the constraint first, so no new violations enter, and the old ones are fixed before validation succeeds.
-- Step 1: new writes are checked from now on; existing rows are not scanned yet
ALTER TABLE notification_events
ADD CONSTRAINT notification_events_user_fk
FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE NOT VALID;
-- Step 2: find the orphans written while the key was missing, and resolve them
SELECT e.id, e.user_id
FROM notification_events e
WHERE e.user_id IS NOT NULL
AND NOT EXISTS (SELECT 1 FROM users u WHERE u.id = e.user_id);
-- Step 3: scan the old rows; concurrent writes keep flowing
ALTER TABLE notification_events VALIDATE CONSTRAINT notification_events_user_fk;
If the key was removed for a measured reason, the reversal has to answer that measurement as well. With no measurement on record, the constraint simply comes back.
WebSocket Connection Management Complexity#
The RFC specified WebSocket-based delivery for optimal performance. The initial implementation approach was straightforward:
// RFC's WebSocket implementation
class NotificationWebSocketManager {
private connections: Map<string, WebSocket> = new Map();
async sendNotification(userId: string, notification: NotificationEvent) {
const connection = this.connections.get(userId);
if (connection && connection.readyState === WebSocket.OPEN) {
connection.send(JSON.stringify({
type: 'notification',
data: notification
}));
}
}
}
The transport’s own documented limits do most of the redesigning. Amazon API Gateway publishes the quotas for a WebSocket API: 32 KB per frame and 128 KB per message payload, neither of which can be raised, a 10-minute idle connection timeout, a 2-hour maximum connection duration, and 500 new connections per second per account per Region. The quota page also spells out the consequence of ignoring the first one: a message larger than 32 KB has to be split into frames of 32 KB or smaller, and a larger message or frame closes the connection with code 1009. The same page states that this applies to @connections commands, so the split is the sending backend’s job. The service does not do it on the sender’s behalf.
The ownership model settles the rest. A managed WebSocket API terminates the socket at API Gateway, so the backend never holds a socket at all. The $connect route hands it a connection ID instead, and every message after that goes out as a signed POST to @connections/{connectionId}. The process that sends a notification is rarely the one that accepted the connection, so those IDs have to live in storage both of them can read. AWS also documents the answer when an ID is stale: a post issued before the connection is established, or after the client has disconnected, returns GoneException. There is no local socket to inspect and no server-side call that reopens one, so that response is the health check.
The quotas and that ownership model explain most of what a second version contains:
import {
ApiGatewayManagementApiClient,
GoneException,
PostToConnectionCommand
} from '@aws-sdk/client-apigatewaymanagementapi';
import CircuitBreaker from 'opossum';
// Amazon API Gateway WebSocket quotas: 32 KB per frame, 128 KB per message.
// The frame quota applies to @connections, so one post has to fit in one frame
const MAX_FRAME_BYTES = 32 * 1024;
type PostOutcome = 'delivered' | 'gone' | 'throttled' | 'failed';
class NotificationDispatcher {
constructor(
private management: ApiGatewayManagementApiClient,
private connections: ConnectionStore, // shared storage, not process memory
private rateLimiter: SharedRateLimiter
) {}
// Circuit breaker for cascading failures. A stale ID is a routine answer:
// fire() still rejects with GoneException, but the filter keeps it out of
// the failure count, so stale IDs cannot open the breaker on live connections
private circuit = new CircuitBreaker(
(command: PostToConnectionCommand) => this.management.send(command),
{ errorFilter: (error: unknown) => error instanceof GoneException }
);
async sendNotification(userId: string, notification: NotificationEvent) {
// $connect wrote these IDs; the process sending now may never have seen the client
const connectionIds = await this.connections.listByUser(userId);
let message = this.serializeNotification(notification);
// Splitting a message above 32 KB into frames applies to @connections as well,
// so a single post stops at the frame quota and anything larger goes out as a reference
if (Buffer.byteLength(message) > MAX_FRAME_BYTES) {
message = await this.serializeAsReference(notification);
}
// One user, several devices (mobile + web + tablet), one connection ID each
const outcomes = await Promise.all(
connectionIds.map((connectionId) => this.postTo(userId, connectionId, message))
);
// No IDs, only stale IDs, or every live one throttled or failing: nothing
// reached the user, so the notification takes the offline path, once
if (!outcomes.includes('delivered')) {
await this.queueForLaterDelivery(userId, notification);
}
await this.recordDeliveryMetrics(userId, notification, outcomes);
}
private async postTo(userId: string, connectionId: string, message: string): Promise<PostOutcome> {
// Rate limiting per connection, counted where every sender can see it
if (!await this.rateLimiter.tryAcquire(connectionId)) {
return 'throttled';
}
try {
await this.circuit.fire(new PostToConnectionCommand({
ConnectionId: connectionId,
Data: message
}));
return 'delivered';
} catch (error) {
// Idle for 10 minutes or open for 2 hours: either way the ID is gone,
// and only the client can open a new one
if (error instanceof GoneException) {
await this.connections.remove(userId, connectionId);
return 'gone';
}
// Everything else, including the breaker's own rejection while it is open
await this.recordDeliveryFailure(userId, connectionId, error);
return 'failed';
}
}
// The $connect and $disconnect routes keep the store in step with reality
}
Nothing here is clever. The second version manages no connections at all: it reads connection IDs and posts to them. The idle timeout and the two-hour ceiling are why the store is the only authority on who is reachable. The same two are why a GoneException is a routine answer, and a routine answer must not count as a failure. A circuit breaker such as opossum counts every rejected call toward opening unless its errorFilter option exempts the error. Without the filter, a store full of stale IDs opens the breaker, and posts to the live connections stop as well. With the filter, fire() still rejects with the GoneException, so the dispatcher can remove the ID, but the breaker records the call as a success.
Routine does not mean free. A send can end with nothing delivered in several ways: every ID stale, every live connection throttled, or a mix of stale and throttled. The fallback therefore counts deliveries. When there are none, the notification goes to the offline queue exactly once, the same path an empty store takes. The frame quota is the one the backend cannot hand off. Splitting a message into 32 KB frames applies to @connections as well, so a payload above that size travels as a reference the client fetches separately. Reconnection belongs to the client on this transport, and it deserves its own attention: Netflix reports that devices on Pushy reconnect roughly every 30 minutes with some staggering, which turns reconnect from an exception into steady-state traffic that has to be smoothed deliberately.
Schedule and Scope Slip in the Published Data#
The phase plan in an RFC usually looks like this: core infrastructure in weeks 1 to 4, advanced features in weeks 5 to 8, integration and optimisation in weeks 9 to 12. A schedule of that kind is a prediction, and predictions of this kind have a measured distribution that nobody needs to guess at.
Flyvbjerg and Budzier analysed 1,471 IT projects for Harvard Business Review and found an average cost overrun of 27%, with one project in six behaving as an outlier: cost overrun averaging 200% and schedule overrun of almost 70%. The average is survivable and the tail is not, and the tail is one in six rather than one in a hundred. PMI’s Pulse of the Profession 2018 measures the scope side of the same problem: 52% of projects completed in the previous 12 months experienced scope creep or uncontrolled changes to scope, up from 43% five years earlier, while only 52% finished within their initially scheduled times and 57% within their initial budgets. At the population level, finishing on schedule is a coin flip. A flat percentage buffer covers the average case and misses the tail, which is where schedules break. The more useful planning question is which parts of the plan survive an outlier and which parts collapse with it.
That reframes what a growing channel list means. Adding SMS, Slack, a webhook and eventually a voice channel after launch is the modal outcome for the population any given project belongs to. By the test from the opening, each of those channels is signal: the review could not have known which ones the business would ask for, because nobody could. It can ask which integration surfaces are likely to still exist when they arrive.
Microsoft’s retirement of Office 365 connectors is the documented version of that risk. The Microsoft 365 developer blog announced in July 2024 that new connector creation would be blocked on 15 August 2024 and that all connectors in all clouds would stop working on 1 October 2024. The shutdown date then moved four times: through December 2025, then to 31 March 2026, then to 30 April 2026, then to a rollout between 18 and 22 May 2026, with Power Automate Workflows given as the migration path. Any Teams notification built on connectors had to be rewritten, and the schedule for that rewrite came from a vendor blog post that kept being edited.
The lag runs in the other direction as well. RFC 8030, Generic Event Delivery Using HTTP Push, was published as a Proposed Standard in December 2016. WebKit announced Web Push for Home Screen web apps in the iOS and iPadOS 16.4 beta on 16 February 2023, just over six years later, and only for web apps the user had added to the Home Screen. A design that treated a published standard as an available platform capability would have been waiting the entire time.
Authentication Contexts the RFC Did Not Model#
A clean API design assumes one authentication pattern. A notification system attached to an existing product inherits every pattern that product has accumulated:
// RFC assumption
interface AuthContext {
userId: string;
token: string;
}
// What a notification path in an older product tends to meet
type AuthContext =
| { type: 'jwt'; userId: string; token: string; claims: JWTClaims }
| { type: 'oauth2'; userId: string; accessToken: string; refreshToken: string; expiresAt: Date }
| { type: 'legacy'; sessionId: string; userId?: string; cookieData: LegacyCookie }
| { type: 'service_account'; serviceId: string; apiKey: string }
| { type: 'anonymous'; temporaryId: string; ipAddress: string };
// Each variant carries its own rate limiting, security validation
// and audit requirements
None of this is architecturally interesting, which is exactly why a design review prices it at zero. It is also the kind of work that expands a schedule without producing anything a demo can show. All five variants are signal: the product had them before the RFC existed, and nobody had written them down. The drift risk sits one level lower, in a variant that skips the rate limiting or audit its siblings carry because adding it was inconvenient.
Team Scaling and Organizational Changes#
An RFC sizes the work before anyone knows what the work is. In an illustrative case, a plan written as “2 developers for 12 weeks” grows along familiar lines: someone joins to absorb production support, a contractor arrives for a quick win, a database specialist is pulled in once query latency becomes the blocker, and the engineer who was only meant to consult on deployment ends up owning it.
The expensive part of those changes is context transfer. People who arrive after a decision was made will reopen it, because the reasoning lives in a review thread they never read. Reorganizations revisit architecture questions the RFC treated as settled. Sizing an RFC in calendar weeks assumes a stable team, and that is usually the first assumption to break.
Monitoring Requirements Discovery#
The monitoring section of an RFC covers standard metrics: delivery rate, response time, and error rate. Operating the system adds more, and the temptation is to add one per surprise until the list stops guiding anyone during an incident. A shorter test works better. Keep a metric when it answers the first question of a specific incident, and keep its labels bounded. The Prometheus naming guide states the second rule plainly: every unique combination of label values is a new time series, so user IDs and other unbounded sets do not belong in labels. A metric sliced by channel, priority and user segment at once creates one series per combination of the three, so its series count is the product of their sizes and grows with every segment someone adds.
For the system in this example, six metrics cover the incidents the earlier sections predict:
| Metric (labels) | The incident it answers |
|---|---|
notification_deliveries_total (channel, outcome) | Users report missing notifications: which channel stopped delivering, and whether the posts answered gone, throttled or failed |
notification_age_at_delivery_seconds (channel) | Notifications arrive late: a growing backlog shows here before any error rate moves |
offline_queue_oldest_age_seconds | The offline fallback absorbs traffic it should not, for example after a bug marks live users as unreachable |
provider_throttle_responses_total (channel, provider_code) | An external ceiling has been reached: Slack’s rate_limited, Twilio’s 30001, an SES sending-rate rejection |
circuit_breaker_state_changes_total (target, state) | Sends stopped for everyone: whether the breaker opened, and when |
websocket_connects_total | A reconnection storm, read as a rate against API Gateway’s 500 new connections per second per account per Region |
Everything else, from template render time to cost per notification, belongs on a debugging dashboard or a weekly report, and earns a place here only when an incident shows it was needed. The section-by-section RFC guide draws the same line between health signals that page someone and product metrics reviewed weekly.
Technical Debt Accumulation Patterns#
Technical debt is absent from every RFC, because at review time there is none. Two patterns are common in notification systems that live long enough to need a second version.
Template System Complexity#
More than one template engine is a normal end state. Transactional messages, marketing messages and in-app copy arrive from different teams with different tooling, and each engine brings its own escaping rules, helper set and failure modes. By the test from the opening, a second engine is signal: the teams and their tooling existed before the RFC did. The renderer stops being a function and becomes a dispatch table:
// A hybrid template layer, which is where multi-team requirements land
class NotificationTemplateManager {
private engines: Map<TemplateEngineId, TemplateEngine>;
private engineByTemplate: Map<string, TemplateEngineId>;
async render(templateId: string, data: unknown): Promise<string> {
const engineId = this.engineByTemplate.get(templateId);
if (!engineId) {
throw new UnknownTemplateError(templateId);
}
const engine = this.engines.get(engineId);
if (!engine) {
throw new UnsupportedEngineError(engineId);
}
// Rendering is the cheap part. The mapping above is the debt:
// it has to stay correct for every template anyone has ever created.
return engine.render(templateId, data);
}
}
Rendering is also where personalisation costs surface. A template that interpolates data from three services turns one notification into three calls, and that cost is paid per recipient rather than per template, so it stays invisible until volume arrives.
Schema Migration Challenges#
Not every schema change needs a second table. Adding a nullable column, creating a concurrent index, backfilling the same table and moving readers and writers over in stages all happen in place. A split into a shape the old table cannot hold is where two schemas have to run at once. The shape of that work has been published. Stripe describes its online migrations in four phases: dual write to the existing and the new table to keep them in sync, move every read path to the new table, move every write path to the new table, then remove the data that relies on the outdated model. The first phase exists because of a constraint: the service could not be paused for the transition and had to keep operating at full load throughout.
The same post makes the scale legible with arithmetic that anyone can repeat. At one second per object, one hundred million objects take one hundred million seconds; divided by 86,400 seconds in a day that is roughly 1,157 days, or over three years, if the work runs sequentially. Backfills are batched and parallel for exactly that reason, which is why the migration runs as a repeated small batch that pages through the rows written before dual write started:
-- One backfill batch next to the dual-write path; a worker repeats it until it selects nothing
BEGIN;
-- Without a cutoff the batch below selects nothing, which looks exactly like "done"
DO $$ BEGIN
IF NOT EXISTS (SELECT 1 FROM migration_status
WHERE migration_name = 'notification_schema_v2'
AND dual_write_started_at IS NOT NULL) THEN
RAISE EXCEPTION 'notification_schema_v2: dual_write_started_at is missing';
END IF;
END $$;
WITH batch AS (
SELECT e.id, e.user_id, e.notification_type, m.new_type, e.data, e.created_at
FROM notification_events e
JOIN migration_status s ON s.migration_name = 'notification_schema_v2'
LEFT JOIN type_map m ON m.old_type = e.notification_type -- old vocabulary to new
WHERE (e.created_at IS NULL OR e.created_at < s.dual_write_started_at)
AND NOT EXISTS (SELECT 1 FROM notification_events_v2 v WHERE v.id = e.id)
AND NOT EXISTS (SELECT 1 FROM migration_unmapped u WHERE u.id = e.id)
ORDER BY e.created_at
LIMIT 10000
FOR UPDATE OF e SKIP LOCKED -- each worker claims its own page
),
parked AS ( -- a type the map does not know is parked, never counted as migrated
INSERT INTO migration_unmapped (id, notification_type, seen_at)
SELECT id, notification_type, NOW() FROM batch WHERE new_type IS NULL
)
INSERT INTO notification_events_v2 (id, user_id, notification_type_v2, data, created_at)
SELECT id, user_id, new_type, data, created_at FROM batch WHERE new_type IS NOT NULL;
COMMIT;
Three parts of that batch carry the weight. FOR UPDATE ... SKIP LOCKED lets a second worker claim a different page instead of waiting on the same rows, because PostgreSQL skips any selected row it cannot lock immediately. The parked branch keeps rows with an unknown legacy type out of the new table and out of every later page, so the loop ends instead of selecting the same unmapped rows forever. The guard at the top covers the quiet way to stop early. Without a migration_status row the join returns nothing, and with a NULL cutoff only undated rows match. Either way the batch soon selects nothing, and a worker that stops on an empty page would report the migration as finished.
The Metrics the RFC Did Not Name#
Every success criterion in the hypothetical RFC was technical: 99.9% uptime, sub-100ms in-app delivery, 10,000 notifications per second. Those targets are necessary and not sufficient. The measures that decide whether a notification system is worth operating sit outside the specification entirely:
- Opt-out rate: a high delivery rate means little if users mute the channel because the timing is wrong.
- Integration time for other teams: an API that needs hand-holding to adopt is not a clean API, whatever the design review concluded.
- Operational burden: automation that still requires someone on call every week has only relocated the work.
- Feature reachability: capabilities that only the authoring team can configure are not shipped in any useful sense.
None of these appear in a throughput target, and each of them determines whether the system survives its second year.
Three Habits That Keep the RFC in Step with the System#
Each habit below turns the signal-or-drift test into routine team work.
A Divergence Log at the End of the RFC#
Add a section to the RFC that only grows. Each row records one place where the running system differs from the design, the verdict from the test, the evidence, and the next step. For the example system, the first rows might read like this:
| Divergence | Verdict | Evidence | Next step |
|---|---|---|---|
| Slack and SMS added after launch | Signal | Product request after launch; both channels publish per-target limits the RFC never priced | Amend the throughput section with per-channel ceilings |
user_id foreign key removed | Drift | The schema comment cites performance, with no query plan or number attached | Restore with NOT VALID, then validate; one named owner |
template_id_v2 BIGINT | Drift | A second team’s ID type was accepted at integration | Pick one type and migrate the smaller side |
notification_type_v2 | Signal with an expiry | Migration in progress | Drop the old column once every reader has moved; the end condition goes in the row |
The RFC stays the first thing a newcomer reads, and the log tells them which parts of it still describe the system.
A Scheduled RFC-to-Production Diff#
Once a quarter, compare the RFC with the running system itself. Three inputs make the comparison mechanical: the schema the database reports (pg_dump --schema-only prints it without data), the interfaces the services expose today, and the measured value behind each success criterion. Every difference already has a row in the log or gets one. A drift row leaves the meeting with an owner and one of two outcomes: revert the system, or amend the RFC and record why. Success criteria get the same review. If the in-app target still reads 100ms with no stated measurement boundary, this meeting is where the boundary gets written down.
Decision Records Linked from the Code#
Michael Nygard’s architecture decision records give each significant decision a short file in the project repository with a title, context, decision, status and consequences. A reversed decision is kept and marked superseded, so the history stays readable. Nygard aims the format at the reader the team-change section described: someone who arrives after a decision and, without its reasoning, can only accept it blindly or change it blindly. The link from the code is what makes the record findable. A schema comment such as -- Foreign key removed due to performance issues becomes -- See ADR-0012, and the ADR holds the query and the number that justified the change. When nobody can write the context section, the divergence log gets a drift row instead.
When the Gap Is Signal and When It Is Drift#
Treat the RFC as a hypothesis and the gap as data. A gap is acceptable when it traces to something the review could not have known: a channel the business needed later, an authentication scheme nobody had documented, a metric that only an incident could reveal. Record the change in the divergence log and move on. The gap becomes a problem when nobody can explain why it exists, when the current shape is defended only by “it works”, or when the RFC and the running system disagree while new engineers still read the RFC first. At that point the document is what needs fixing.
One useful next step: pick a system where the design doc and the deployment have diverged, sort each divergence into one of those two categories, and make the result the first rows of its divergence log.
References#
- RFC 8030: Generic Event Delivery Using HTTP Push - IETF (opens in new tab) - The Web Push specification, published as a Proposed Standard in December 2016, with its full status and document history
- Web Push for Web Apps on iOS and iPadOS - WebKit (opens in new tab) - WebKit’s February 2023 announcement of Web Push support for Home Screen web apps, six years after the specification was published
- Availability Table - Google, Site Reliability Engineering (opens in new tab) - Converts availability percentages into concrete downtime budgets per year, quarter, month, week and day
- Air Traffic Controller: Member-First Notifications at LinkedIn (opens in new tab) - LinkedIn’s notification platform, handling over a billion requests per day, and the P90 end-to-end latency it reports before and after optimisation
- Pushy to the Limit: Evolving Netflix’s WebSocket Proxy for the Future (opens in new tab) - Netflix on running hundreds of millions of concurrent WebSocket connections, including per-node connection counts, message rates and reconnection behaviour
- chat.postMessage - Slack Web API reference (opens in new tab) - Slack’s documented posting limits per channel and per workspace, including its burst allowance
- Build to Scale: Queueing and Latency - Twilio (opens in new tab) - How Twilio meters outbound SMS per sender by number type, the 100-per-second short code limit, and why the guide does not assume 10DLC senders
- Message Throughput (MPS) and Trust Scores for A2P 10DLC in the US - Twilio Help Center (opens in new tab) - Per-campaign 10DLC throughput shared by every number in the campaign, the rates by Trust Score and use case, the account-wide limit, and the toll-free default of 3 per second
- Error 30001: Queue Overflow - Twilio (opens in new tab) - Twilio queues by the sending rate of a sender or an account, and fails messages that wait longer than 10 hours
- Service Quotas in Amazon SES - AWS (opens in new tab) - Sending rate and daily volume limits for sandbox and production accounts, plus per-message recipient and size caps
- Creating the Remote Notification Payload - Apple (opens in new tab) - Apple’s maximum payload sizes for regular and VoIP push notifications, and what APNs does with anything larger
- Quotas for Configuring and Running a WebSocket API - AWS API Gateway (opens in new tab) - Frame and message size quotas, idle and maximum connection durations, connection rates, and the close code returned for oversized frames
- Use @connections Commands in Your Backend Service - AWS API Gateway (opens in new tab) - How a backend sends to a connected client through a connection ID rather than a socket it owns, and the GoneException returned once that connection is gone
- opossum circuit breaker source - nodeshift (opens in new tab) - The
errorFilteroption, and how a filtered error still rejects the call without counting toward opening the breaker - Online Migrations at Scale - Stripe (opens in new tab) - Stripe’s four-phase dual-write migration pattern and why a live service cannot be paused for a schema change
- Introduction to Indexes - PostgreSQL documentation (opens in new tab) - What an index costs after creation, why unused indexes should be dropped, and how concurrent index builds behave
- ALTER TABLE - PostgreSQL documentation (opens in new tab) - Adding a foreign key as NOT VALID and validating it later, the locks each step takes, and why the split suits tables with existing violations
- Metric and Label Naming - Prometheus (opens in new tab) - Why every label combination is a new time series and why unbounded values such as user IDs do not belong in labels
- Documenting Architecture Decisions - Michael Nygard (opens in new tab) - The original ADR format: title, context, decision, status and consequences, kept in the repository and marked superseded when reversed
- Why Your IT Project May Be Riskier than You Think - Flyvbjerg and Budzier (opens in new tab) - Author preprint of the Harvard Business Review study of 1,471 IT projects, covering average cost overrun and the fat tail behind it
- Pulse of the Profession 2018: Success in Disruptive Times - PMI (opens in new tab) - Survey figures on scope creep, schedule and budget performance, and rising project complexity
- Retirement of Office 365 Connectors within Microsoft Teams - Microsoft 365 Developer Blog (opens in new tab) - The full retirement timeline, including each extension, and the Power Automate migration path
Related posts
How a notification cascade spreads across email, push and WebSocket, how to trace it to one root cause, and the breakers and limits that contain it
debugging · monitoring · production +4
Practical guidance on RFC structure, review, and decision ownership, with a condensed example RFC that turns a technical debate into a decision a team keeps.
rfc · documentation · architecture +3
Fargate failure modes that green dashboards hide: ENI and subnet address exhaustion, NAT routing breaks, socket leaks, and the checks that find each.
aws · fargate · debugging +4
Chesterton's Fence is quoted as a reason to leave old code alone. Read as a time-boxed debugging question, it says when to remove it and how to record the answer.
technical-debt · best-practices · documentation +3
Stop asking who wrote the legacy code. Ask who owns it now, separate accountability from blame, and make sure the answer exists before the next incident.
engineering-culture · leadership · team-management +3