Skip to content
academia.sh

Course Intermediate

The Application Layer and Service Interaction

By the end of this course

Start course

01

Service Design

The decisions that determine whether a service is scalable and changeable: moving state out of the service, service discovery through dynamic addressing and health information, the selection criteria for remote procedure call, resource-based, and query-based calling, preserving compatibility through schema evolution, and the effect of timeout and retry budget on total latency in a call chain.

  1. 01 Stateless Services The effect of moving state out of the service process on horizontal scaling: measuring the same load in two modes with local processes, the session held in a replica's memory splitting across replicas and being lost on restart, reversing the replica count measured in the traffic layer, and computing the cost that moving state outward charges to the state store and the body's byte count.
  2. 02 Service Discovery Moving replica addresses out of a hand-written list and into a registry: separating service discovery from the load balancer's health check, using a model to measure how much a registration's time to live and the resolution cache extend the window for detecting a failure, graceful shutdown resetting that window, and converting the window into the outage budget measured in the introductory course.
  3. 03 Communication Styles Writing the same internal call in remote procedure call, resource-based, and query-based styles and comparing them with three measures specific to the service boundary: the number of internal calls made for one external request, the bytes crossing the internal boundary, and the number of names the caller has to know; multiplying the internal byte volume by the introductory course's peak read rate to convert it into internal boundary bandwidth.
  4. 04 Inter-Service Contracts Measuring the cost of a schema change by the number of broken consumers: counting how many services a single-step release forces to publish together across five internal consumers' read sets, splitting the same change into an expand–contract sequence to bring broken consumers to zero, and computing what carrying two names at once during the transition window costs in record bytes and internal boundary bandwidth.
  5. 05 Timeout and Retry Budget Splitting the end-to-end latency threshold across the steps in the chain: computing how far the product of timeout and retry count inflates the budget in the worst case, deadline propagation turning a threshold overrun into an early failure, a short timeout absorbing transient slowness, and using a model to measure how far the internal request rate multiplies under widespread slowdown when no retry budget is set.

02

Queues and Workflows

Spreading load over time and running multi-step jobs: buffering with message queues, moving long jobs to the background, raising throughput with competing consumers, leveling a spike with a queue, priority for different service levels, managing jobs that require ordering, choreography and orchestration models for a distributed workflow, the durable workflow pattern, leader election for a single point of responsibility, and returning an asynchronous response for a long-running operation.

  1. 01 Message Queues Treating the queue as a capacity decision: choosing capacity by the instantaneous peak on the synchronous write path, moving processing capacity toward the average once a queue is introduced, paying for the gain in backlog and wait time, comparing the number of events two designs lose during a brief store outage, and recalculating the request rate reaching the store.
  2. 02 Task Queues and Background Jobs Measuring the removal of a long job from the request path: deriving the report job's duration from the introductory course's numbers, counting how much queuing a short request accumulates when it shares a slot pool with a long job, which measurement improves once the job moves into a separate task queue, and the scaling unit shifting from replica to worker.
  3. 03 Competing Consumers Measuring how many consumers pull from the same queue as a capacity decision: the shrinking contribution each added consumer makes to drain time, calculating the asymptotic ceiling a shared resource sets, counting the shipment-order breakage and wrong final states traded for throughput, and converting the ceiling into the rate required from a single consumer.
  4. 04 Queue-Based Load Leveling Buffering an unpredicted spike with a queue: a bulk resend after an outage raising the arrival rate tenfold while never changing the buffer requirement, an extra write stream at the same arrival rate growing the buffer by sixty-seven percent, calculating the buffer limit from volume, and counting the events an unbuffered design drops.
  5. 05 Priority Queue Separating three work classes that share the same consumer group by service level: a single queue giving all three classes the same wait, strict priority stopping the lowest class entirely, weighted share redistributing the shortfall, a share acting as both a floor and a ceiling at once, and the total shortfall staying independent of the policy.
  6. 06 Sequential Convoy Managing jobs whose order is a constraint, not a preference: measuring free consumption, sequential convoy — which routes the same shipment's state events into a single lane per key — and a version-stamped handler on the same event set; separating backward writes, wrong final states, and steps missing from history; lane granularity setting the throughput ceiling, and applying the cost to K01's peak write rate.
  7. 07 Choreography and Orchestration Building the end-of-day billing job — four steps spread across four services — in two models: choreography, where steps trigger each other with events, and orchestration, where a single orchestrator calls the steps; showing that the shared transaction boundary is lost, building the compensating step, and measuring both modes in messages, compensated steps, uncompensated steps, and half-finished jobs.
  8. 08 Scheduler–Agent–Supervisor Making resilient a workflow whose half-finished job no one asks about: a scheduler that durably records the job, an agent that runs the step remotely, and a supervisor that finds an expired step and either re-drives or compensates it; measuring half-finished jobs, re-driven steps, and wasted steps in unsupervised and supervised runs, and the trade-off between the scan interval and recovery delay.
  9. 09 Leader Election Assigning a task that requires singular responsibility to a single node: building lease-based leader election with an in-process model, measuring the handover round and the number of rounds two leaders run at once, the leaderless round growing as the lease lengthens, fencing removing double starts, the persistent trigger recovering the missed batch, and translating the results into K01's daily invoice lines.
  10. 10 Asynchronous Request–Reply How a reply is returned for a long-running operation: a 3.60-second period report that does not fit a 200-millisecond threshold, the request being answered immediately with a job id, separating the status and result addresses, measuring the poll interval's trade-off between poll count and time-to-see, and exponential-backoff polling cutting fifteen polls to four.

Start typing to search.

↑↓ Esc navigate · open · close