What does it mean for a publishing queue to be reliable?
A social post depends on a network, a token, a worker and a media file. In fact, any of them can fail. Therefore, publishing queue reliability starts with four properties of the social publishing queue.
First, the queue keeps the queue state of every item. Second, it prevents two workers from sending the same item. Third, it applies post retries without changing the approved version. Finally, the reason for a permanent failure is recorded.
Those properties of publishing queue reliability matter because the audience sees the result. For instance, a missing post is a gap, and a double post is a mistake. However, a silent failure is worse than both, because the team does not know which one happened.
A reliable queue makes the queue state visible to an operator, not only to an engineer. In fact, publishing queue reliability is mostly a question of visibility, and delivery reliability follows from it. Publishing queue reliability is therefore an operating habit and not a feature.
Publishing queue reliability also has a cost side.
A social publishing queue that retries blindly can flood a network, and a queue that never retries drops good posts. The balance is set by a written policy. For example, a team may allow five post retries within one hour. Delivery reliability then becomes a rule that can be tested.
How do durable state and safe claims keep a queue sound?
Durable state means the queue lives in a database and not in memory, which is basic to publishing queue reliability. As a result, a worker can restart without losing the item, and the queue state survives. In addition, safe claims mean that a worker locks its row, so a second worker cannot take it.
The social publishing queue in DaletPost uses database claims with SKIP LOCKED and a worker identity to fence the work. The PostgreSQL documentation (opens in new tab) describes this locking clause in detail. The claim does not promise that the network accepts the post. Instead, it stops two workers from trying the same item.
Good queue state also supports duplicate prevention and publishing queue reliability. If the state of an item is known, a second send can be refused. As a result, the social publishing queue stays safe after a restart.
Each item state is marked as scheduled, claimed, published, retrying or failed, and the item state is stored. Because these states are explicit, a dashboard can count them for publishing queue reliability. Meanwhile, a queue state that lives only in logs is hard to trust. Therefore, publishing queue reliability depends on state that is stored for every attempt.
Why does a worker need a lease if it can crash?
A crashed worker must not hold an item with no time limit, so the retry limit and lease both matter. For that reason, a lease, or timeout, lets the queue release the row after a set time. A person can then see the stale item and decide what to do.
The lease also bounds the work of each attempt and protects publishing queue reliability. For example, a slow call to a network should end before the lease does. Otherwise, a second worker could pick up an item that the first one still sends.
How do retries and duplicate prevention work as a pair?
First, post retries should be bounded and visible. A temporary error returns the item to the queue with a count and a reason. The queue state is updated. In contrast, a permanent error is stopped and waits for a person.
Backoff spaces the attempts, so a struggling provider gets room to recover. Publishing queue reliability needs that room.
Moreover, a network can ask for a delay. The standard Retry-After header (opens in new tab) tells a client how long to wait. The queue should never poll sooner.
Also, unlimited post retries hide a problem, and a single attempt hides a temporary one. Duplicate prevention adds the other half of the pair. Specifically, the content and the target are checked before delivery, so a manual retry does not create a second post.
Duplicate prevention works at two points.
First, the content and the target are compared before an item enters the social publishing queue. Second, the check is repeated at delivery where possible. A post that was published by hand is therefore not sent again. Duplicate prevention protects the team from its own manual retries, and duplicate prevention costs almost nothing.
For publishing queue reliability, the goal of post retries is not to retry everything. It is to retry the right cases and to know which ones they are. Our queue and delivery page shows how DaletPost applies this rule.
How should an operator read a failure in the queue state?
A failure record should answer three questions. Which network and account failed, and what was the error? Did the error come from a temporary cause? What can the operator do next?
A raw stack trace does not answer the last question. A plain reason does, and publishing queue reliability needs that reason. The record should also keep the approved version and the target. Consequently, post retries need no new approval and no new media upload.
Failures fall into three groups.
First, network errors are usually temporary. Second, credential errors need a person to reconnect an account. Third, content errors, such as a rejected media file, need a fix before post retries can succeed. A good record names the group, so the operator picks the right action first.
What do we need to log for each fail of a post?
First, each failure needs the network, the account, the error and the time. It also needs the retry count and the next step, so the operator knows what to do. Besides, the log should show who acted and when.
For instance, a rate limit says wait, while an expired token says reconnect. Likewise, a rejected media file says fix the file. Each reason leads to a different action, and the reason is shown to a person.
This keeps delivery reliability high. Post retries then follow the reason.
How can a team measure queue reliability in each month?
A team can track publishing queue reliability with a few simple counts. One example is delivery reliability by network, which shows reliable delivery per route. How many items published on the first attempt? How many needed a retry, and how many failed for good?
How long did a recovery take? Notably, the numbers should be read with the reasons and not instead of them. Specifically, a high retry rate may be a provider problem or a validation problem. A low failure rate may hide silent failures.
In addition, the time to recover is worth a count of its own for publishing queue reliability. A failure that is fixed in minutes costs little. However, a failure that sits for a day costs a campaign.
Delivery reliability is therefore measured in recovery time as well as in success rate. Reliable delivery is a trend, not a number.
A team that watches delivery reliability monthly sees problems early.
A sound measure of publishing queue reliability is the ability of the team to explain a failure and recover. Indeed, a monthly review of five failures beats a dashboard with no reasons. The Google site reliability engineering book (opens in new tab) treats this kind of review as a basic habit.