Skip to main content
Stream Processing and Analytics

Mid-Semester Problem Solving: Architecture, Message Design, and Kafka Partition Estimation

Published: 2026-08-07
Level: postgraduate
Audience: Postgraduate students in Stream Processing and Analytics

Prerequisite Knowledge

This lecture builds on the following concepts from earlier lectures. If any feel unfamiliar, review the linked notes before proceeding.

Previously Covered in This Subject

  • Stream processing vs batch processing — covered in Lecture 1 (1.6)
  • Topics: the email subject-line analogy — covered in Lecture 2 (2.4)
  • Non-functional requirements — covered in Lecture 2 (2.5) and Lecture 4 (4.6.3)
  • The layered streaming architecture and the rate mismatch problem — covered in Lecture 4 (4.2, 4.4)
  • Lambda and Kappa architectures — covered in Lecture 4 (4.5)
  • Message delivery semantics and the three decision questions — covered in Lecture 6 (6.1–6.3) and Lecture 7 (7.1)
  • Kafka in the data flow layer and the publish–subscribe model — covered in Lecture 7 (7.2)
  • Kafka topics and partitions — covered in Lecture 7 (7.3)
  • Ingestion rate vs processing rate (Ri and Rp) — covered in Lecture 7 (7.4)

8.1 How to Approach a Scenario-Based Architecture Question

Picture the exam question: "Design a data processing architecture for the following system…" followed by a paragraph of business description. Most students react by drawing boxes immediately. The instructor's advice is the opposite — before you draw anything, before you name a single component, make one decision first: is this a batch problem, a stream problem, or both? Everything else in the answer hangs off that single choice.

Hook: What is the very first thing you must decide when a scenario question asks you to design an architecture? Not the tool, not the diagram — the processing regime: batch, stream, or both. Get that wrong and every component you place afterwards is wrong too.

8.1.1 The First Decision: Batch or Stream

Every scenario question in this area comes down to one starting decision: is this a batch processing use case, a stream processing use case, or both? Before you draw anything, before you name any component, decide that. The instructor's rule for reading a problem is direct: read the scenario, look for the activities, and for each activity ask which pipeline it belongs to. You do not invent use cases. You find the ones that are already written into the problem statement.

Two quick definitions to anchor the decision. A batch processing use case (a job that runs on a full collection of data at once) is one where the data is collected first and processed later, on a schedule — nightly, hourly, or daily. A stream processing use case (a pipeline that handles each message as it arrives) is one where the answer must be produced while the events are still happening — the moment a message is generated. Some scenarios are purely one or the other; many are both, with different activities on each side. Your job is to label every activity in the text with its regime before choosing an architecture.

To find them, underline every activity mentioned in the problem text. Only those activities get mapped to components. If a requirement is genuinely unclear, that is not a licence to guess silently — you may state an assumption out loud: "this requirement is not clear, but I am assuming that this requirement is also present." Assumptions based on the domain are acceptable. But the default is: the problem statement is the contract, and every underlined activity must land somewhere in your architecture.

Exam note: Expect a question where you are given a scenario and asked to design an architecture. The skill being tested is exactly this: understand the components, understand the use cases, and map each use case to the component activity that handles it. The mapping is the marks; the generic theory is assumed knowledge.

8.1.2 Lambda versus Kappa

Once you know whether the use case is batch, stream, or both, you pick the architecture family. Lambda architecture carries both a batch provision and a stream provision — batch layer, speed layer, and a serving layer that merges them. Kappa architecture is useful only for stream processing; there is no batch layer in it. So the reasoning chain is: decide the processing regimes → if both batch and stream are needed, Lambda; if only stream, Kappa; if only batch, Lambda with the streaming layer removed (the instructor's phrasing for the education case later: "Lambda architecture without the streaming layer").

Dimension Lambda Kappa
Processing regimes covered Batch and stream (two provisions) Stream only
Batch layer Present — recomputes views from historical data Absent
Speed layer / streaming layer Present — covers data too recent for the batch The only layer
Serving Merges batch views with realtime views Serves stream-computed results directly
Best answer for "Both batch and stream are needed" "Only stream is needed"

If you choose Lambda, you then enumerate its components and map the problem's scenarios onto individual components. That mapping — not the generic description of what a collection tier does — is what earns the marks.

Intuition: Think of Lambda as two parallel kitchens serving one restaurant. One kitchen works from a complete recipe book (the historical batch data) and prepares everything from scratch; the other handles only the last few minutes of orders as they arrive (the speed layer). The waiters (the serving layer) present the combined result to the customer. Kappa is a single fast kitchen that only cooks à la carte — it cannot serve the full banquet because it has no recipe book at all.

8.1.3 Reading the Problem: Underline Activities, Map to Components

When asked to explain the components of a data processing architecture, the instructor's advice is concrete:

  • Keep a generalized architecture in mind (collection tier → data flow layer → analysis/processing tier → serving/delivery).
  • For each component, write only what happens with respect to this use case. Do not write the generic story. The evaluator already knows what a data flow layer is responsible for; you are not being tested on that. You are being tested on what this specific data flow layer does for this specific problem.
  • Keep each component as its own subheading and write under it. If the question says "draw", draw; otherwise headings and prose are fine.
  • Once the data processing is done, think about what happens after — the delivery tier. That part of the flow is easy to forget and is part of the same question.

The four-tier skeleton is worth keeping fixed in memory, because it is the template every scenario maps onto: the collection tier is where events enter the system; the data flow layer moves and holds messages between tiers (this is where a message queue or a Kafka-style broker lives); the analysis/processing tier does the computation on the data; the serving/delivery tier pushes the results out — to screens, customers, or downstream systems. When you are asked to "explain the components," walk these four in order and say, for this scenario only, what each one does.

8.1.4 How Marks Are Distributed and How to Write Answers

For the sample question the breakdown was made explicit: explaining the various components of the architecture is worth six marks; evaluating the architecture on non-functional requirements is worth three marks; message management (delivery semantics) is worth three marks. The instructor's advice about six-mark parts: first look at what is asked, then answer it properly and completely — points are not counted, substance is.

Pitfalls:

  • Inventing use cases. If the problem does not mention an activity, do not add it — and if it is not clear, say the assumption out loud instead of guessing silently.
  • Writing the generic story for a tier ("the data flow layer transports data"). The evaluator knows that already. Write what this data flow layer does for this use case.
  • Stopping at the analysis tier. The delivery tier is part of the same question and students routinely forget it.
  • Forgetting the regime decision. Naming components before deciding batch/stream produces a random pile of boxes, not an architecture.

Exam note: Questions come in pairs — one architecture design question from a scenario, one message design question. The second of the pair typically asks about message delivery semantics with justifications, and the justifications are what get graded. Naming a delivery semantic without defending it earns nothing; the reasoning earns the marks.

8.1.5 Student Questions and Answers

Q: For part A, which carries six marks, how many points should be in the answer?

A: Instead of thinking about points, first look at what is asked. If you can explain the various components properly, you have your six marks for that part. Non-functional requirements are three marks, message management is three marks. Substance, not point count.

Q: Do we need to draw a block diagram, or is it enough to write the answer?

A: If the question says draw, you should draw. Otherwise, keep each component as a subheading and write. For example, under "collection tier" you write what the collection tier does for this use case — specific to the use case, not generic.

Q: How many use cases should we think about? Should we assume more than what is written?

A: You do not think up use cases. You look at the problem, underline the activities that are mentioned in the problem statement, and map only those activities to the components. If something is not clear, you can say this requirement is not clear but you are assuming it is present — that is acceptable, as long as the assumption is stated and domain-based.

Recap: A scenario architecture question is solved in one order: label each activity in the text as batch, stream, or both; choose Lambda or Kappa from that label; enumerate the tiers; map only the underlined activities onto the components; and remember the delivery tier at the end. In the next sections this exact recipe is run on two real sample problems — first a banking system, then an online education platform.

Real-world connection: this method is not exam-specific. In industry, system-design interviews and architecture reviews follow the same discipline — an architect is given a business description, must separate the workloads that need immediate answers from the ones that can wait, and must justify every component against a stated use case. An architecture that "does streaming because streaming is modern" fails review; one that can point at the specific activity each tier serves passes.

8.2 Worked Case Study: Smart Device Banking System

This is the first full run of the recipe from Section 8.1 on a real exam question. Watch how a paragraph of banking business text turns, line by line, into a Lambda architecture with named components — and how every answer point traces back to an underlined activity in the problem statement.

8.2.1 The Problem Statement

The sample question ran as follows. Consider a smart device system pertaining to the banking domain. The core activities under consideration are customer service, home loan, personal loan, unit link insurance plans, and similar products, and the bank wants to track and process these transactions. At the same time the bank is expected to provide safety measures around credit card and debit card transactions — tracking them and processing the data. The closing line of the problem says the bank likes to use insights from card-related transactions for the loan department as well.

The instructor walked the class through the last line explicitly, because it is the hinge of the whole problem. "Based on your spending history, they may also offer you some loan" — that is what it means. The main emphasis is on credit card and debit card transaction alerts and the analysis that follows them.

Intuition: Read the closing line as a business promise: "we use your card-spending data to decide which loans to offer you." That single sentence contains both processing regimes — a live part (watch each card transaction as it happens) and a studied part (mine the accumulated history). If you miss what that line is saying, you will draw the wrong architecture and every subsequent mark falls.

8.2.2 Mapping Use Cases: Batch and Stream

The decision tree starts with the transaction alerts. Card transactions happen in real time, so the alerts must be produced as the transactions arrive — that is stream processing territory: process the message the moment it is generated. Fraud detection sits in the same bucket: to ensure safety you need fraud detection in real time, at the moment the message is generated, not later.

The loan side is batch. The bank wants insights from historical transactions — how much customers are spending, what they are buying — and uses those insights to broadcast offers from time to time. Historical analytics, promotions, spending analysis: all batch. The activities around customer service, home loan, personal loan, and unit link insurance plans are tracked and analyzed for insight generation, and that tracking can also be placed in the batch regime.

So the answer is: the use case needs both batch processing and stream processing. You should be able to say exactly which scenarios go to batch and which go to stream — and the instructor stressed that naming the split correctly is the first thing the question is checking. On that foundation the architecture is Lambda, which carries both provisions.

Activity from the problem statement Regime Why
Credit/debit card transaction alerts Stream The alert must fire the moment the transaction is generated
Fraud detection Stream Safety requires real-time checking of each message as it arrives
Spending history insights (how much, what customers buy) Batch Built from accumulated historical transactions
Loan offers / promotions broadcast "from time to time" Batch Derived analytics over history, no per-second urgency
Customer service, home loan, personal loan, unit link tracking Batch Tracked and analyzed for insight generation, not for instant response

Worked example — mapping the banking scenario to a Lambda architecture. Start from the four-stage skeleton of Section 8.1 and place each underlined activity:

  1. Collection stage — every transaction and activity event enters the system here (the card networks, the bank's internal service touchpoints).
  2. Data flow layer — a message queue / broker (Kafka-style) carries the events onward. The card stream is routed to the streaming path; copies of all events are kept for the batch path.
  3. Streaming side of the processing stage — consumes each card message the moment it arrives, produces the transaction alert, and runs fraud detection against the live message.
  4. Batch side of the processing stage — periodically recomputes views over all historical transactions: how much customers spend, what they buy, loan uptake per product, customer demographics.
  5. Serving stage — merges and serves the views: the real-time alert reaches the customer instantly; the batch views feed the offer engine that broadcasts loan offers.

Final answer (sense-check): both regimes are present, so the architecture is Lambda — batch layer plus speed layer, with a serving layer that presents both. Every component you name must point back to an underlined activity; none of the items in the table above may be dropped.

8.2.3 Batch Views and the Database-View Question

A question that produced real confusion: what kind of view do we generate from the batch? The instructor's example: a view in terms of the number of customers who have opted for a particular loan, or a view under demographics. That raised a follow-up — is this view the same as a database view? The answer is yes, it is, and the reasoning matters. You store the batch layer data in a database; the view is generated from that stored data, so the batch view is literally a database view. It is a snapshot of the analysis you generated, kept in the form of views. One more detail the instructor added: the views you generate come from the historical data in the batch layer and also from the speed layer.

Key concept — what a "view" is in this architecture. In the Lambda design, the batch layer's job is to compute results from the complete historical dataset (the master data), and those results are stored as views — precomputed, indexed answers such as "loan uptake by product" or "customers per demographic." The serving layer holds these views so queries are answered from the index, not by recomputation. Because the views are stored in and queried out of a database, they are database views in the literal sense: a named query over stored data, kept up to date by the batch jobs. The speed layer additionally produces realtime views covering the data too recent for the last batch run; the serving layer presents both kinds together.

Real-world: this is exactly how a bank's offer engine works — batch views of loan uptake and customer demographics feed campaigns, while the real-time view (transaction volume in the last two or three minutes) feeds the alerting side.

8.2.4 Replacing the Data Flow Layer with Publish-Subscribe

A common exam twist is to ask you to model the generalized architecture using a specific mechanism — for example, replace the data flow layer with a publish-subscribe model (pub/sub for short). The instructor walked through the mapping:

  • The publisher-subscriber model has a producer, a broker, and a consumer. The broker maintains a message queue internally: producers put messages into the queue, and the queue delivers them to consumers.
  • The producer is nothing but whatever comes through the collection tier. So the producer is part of the collection tier, not a separate box.
  • The broker and its message queue reside in the data flow layer.
  • The consumer is the analysis tier.

Then you explain how it works and what it buys you. Because the model decouples producers from consumers, you can add different types of producers on one side and different types of analytics platforms on the other side, and the broker maps them. That flexibility is the reason the design is chosen, and it should appear in your answer.

Pitfall — the producer is not a separate box. A common diagramming error is drawing the producer as its own layer between the collection tier and the data flow layer. In the pub/sub mapping the producer is the collection tier's exit point: whatever comes through the collection tier becomes the producer, the broker with its message queue sits in the data flow layer, and the consumer is the analysis tier. Place the producer inside the collection tier, not beside it.

The decoupling benefit is worth spelling out in an answer: because the broker is the only thing the two sides talk to, the bank can add a new event source (a new card channel, a new loan product) without touching the analytics platforms, and can add a new analytics platform without touching the sources. In industry this is exactly why message queuing tiers exist — they absorb growth on either side without re-plumbing the pipeline.

8.2.5 After Processing: The Delivery Tier

The instructor's reminder: once the data processing is done, think about what happens next — the delivery tier. In the banking problem that is where alerts reach the customer, offers reach customers, and results of analytics are broadcast. It is part of the same architecture question and students routinely stop at the analysis tier.

8.2.6 Student Questions and Answers

Q: What kind of view do we generate from the batch layer — is the batch view the same as a database view?

A: It is a database view. You store the batch layer data in a database and generate the view from that stored data — a snapshot of the analysis you generated, kept in the form of views. The views you generate come from the historical data of the batch layer and from the speed layer.

Q: Do we need to explain, for every block — collection tier, data flow layer, analysis tier, delivery tier — what functionality would be handled for this use case?

A: The generic story about the layers is not required. You need to tell the story about the specific requirements of this use case. You can assume the evaluator already knows that the data flow layer is responsible for what data flow layers do. What you must add is what this data flow layer does for the smart device banking system.

The two questions about the scenario split were asked while the class was still reading the problem, and the instructor answered them inline:

Q: What does the last line of the problem mean — the bank likes to use insights from card-related transactions for the loan department?

A: Based on your spending history, the bank may offer you a loan. The main emphasis is on credit card and debit card transaction alerts, and the bank wants to do analysis on them. What you highlighted — the alerts — comes from stream processing, because transactions happen in real time and you process them as they come in. The insights for the loan department come from batch processing.

Q: What are the scenarios that go to the batch side?

A: If the bank wants insights from historical transactions — how much we are spending, trends over time — that is batch. The customer service, home loan, personal loan, and unit link insurance activities, which are tracked and then analyzed for insight generation, can also be put under batch.

The pub/sub mapping produced its own exchange:

Q: In the publisher-subscriber model, does the producer become part of the collection tier, or is it separate?

A: It is part of the collection tier. The consumer becomes the analysis tier. The broker and the message queue reside in the data flow layer.

Q: Why use the publisher-subscriber model here?

A: Because you can add any different types of producers here and any different types of analytics platforms there. The broker in the middle maps them, so both sides stay interchangeable.

Recap: The banking problem splits cleanly — alerts and fraud detection on the stream side, historical insights and loan offers on the batch side — so the architecture is Lambda; its batch layer produces database views, the data flow layer can be modeled as pub/sub (producer in the collection tier, broker in the data flow layer, consumer in the analysis tier), and the delivery tier must still be drawn. Next, the same discipline is tested from the other direction: evaluating the architecture on non-functional requirements.

Real-world connection: modern banking alerting runs exactly on this split. Card transaction systems such as those built on Kafka streams fire fraud alerts in seconds per transaction, while the marketing analytics warehouse recomputes offer and demographic segments daily — the two halves of one Lambda-style pipeline, one serving the customer-facing alert, the other the campaign engine.

8.3 Non-Functional Requirements Evaluation

The architecture is drawn; now the question turns: "evaluate the proposed architecture on non-functional requirements." This part carries three marks and is the most template-shaped of the whole paper — there are exactly three requirements to discuss, they were taught in class, and each gets a subheading and a use-case-specific story.

Hook: After the six-mark architecture question comes a quieter three-mark request: evaluate the architecture on non-functional requirements. Students lose these marks not because they do not know the three names, but because they write the names without saying what each one means for the banking use case. The names are free; the mapping to the scenario is the marks.

8.3.1 The Three Requirements

When a question says "evaluate the proposed architecture on non-functional requirements in the big data systems," the three to write about are the three taught in class: low latency, high availability, and horizontal scalability. Put each one as a subheading and write, for each, what you expect the architecture to provide in this use case.

Key concept — the three non-functional requirements. A non-functional requirement describes how the system behaves, not what it computes. In the big data space the class covers exactly three:

  • Low latency — how quickly the system responds: from an event arriving to the answer or alert leaving. Measured in time (milliseconds to seconds on the streaming path, hours on the batch path).
  • High availability — the system keeps serving even when a component fails. Measured by uptime and by what survives a single failure.
  • Horizontal scalability — the ability to handle more load by adding more machines (scale out), rather than by making one machine bigger (scale up).

Each one gets its own subheading in the answer, and under it you write what the architecture provides for this specific problem — not a dictionary definition.

8.3.2 Horizontal Scalability

The answer template the instructor modeled: considering the volume of customers the bank has, you may want a cluster with multiple nodes. Multiple brokers, and an analysis tier that is itself a cluster consisting of many consumers. The scale-out story is told in terms of the workload: if the bank is huge and has many customers, multiple brokers and multiple consumers handle the volume. You do not decide the topology first and then justify it; you look at the volume, and the volume recommends the cluster.

The direction of the argument matters in the answer. The wrong version starts with the design ("I will use a cluster of ten brokers") and then hunts for a justification. The right version starts with the workload ("a large bank processes a large number of card transactions per minute") and lets the volume dictate the topology ("therefore multiple brokers share the message flow, and the analysis tier is a cluster of consumers, each handling a share of the stream"). One sentence naming the volume driver, one sentence naming the cluster it implies — that is the template.

8.3.3 Low Latency: The Two Latencies

The class pushed back on a naive reading of low latency — "customer should be responded back with an alert, so latency matters," and separately "low latency is not critical because loan data is stored anyway." The instructor corrected both directions with the same point: the question is not whether you need low latency or not; it is what latency means in this use case and what you set up to meet it. Latency shows up in two places:

  1. In the batch layer — how fast you can store something and retrieve it. That store/retrieve latency matters because the serving of insights depends on it.
  2. In the streaming path — the speed at which Kafka is serving the analysis tier, the speed at which messages are ingested into the streaming layer, and the speed at which the streaming layer processes them.

Those speeds should be compared and analyzed, and the cluster is set up accordingly. You cannot say "latency is not required" by looking at the use case alone, because it depends on the number of customers and the number of loan takers. What you can say is: considering the volume, you may want to set up the cluster — that is the recommendation.

Pitfall — both naive readings are wrong.

  • "The alert must reach the customer, so latency matters" — true but incomplete: latency also lives in the batch layer, where insights are stored and retrieved. The alerting path does not remove the batch latency question; it merely highlights one half of it.
  • "Loan data is stored anyway, so low latency is not critical" — false in the exam sense: you cannot declare latency irrelevant from the use case alone. Whether the store/retrieve speed and the streaming speeds are adequate depends on the volume — the number of customers and the number of loan takers. The defensible sentence is "considering the volume, we set up the cluster accordingly," never "latency is not required."

8.3.4 High Availability

High availability is the third pillar — the architecture should keep serving even when components fail. In this use case that translates to having redundancy across the tiers: more than one broker so a broker failure does not stop the message flow, and a consumer cluster so the analysis tier keeps running. The professor presented availability and scalability as siblings: the volume argument that drives cluster sizing is the same argument that buys you failover.

The sibling relationship is the key insight to reuse in the answer. You do not write two disconnected paragraphs — you write one story twice: the volume is too large for a single broker, so we run several brokers, and because several brokers exist, losing one does not stop the message flow. The cluster sized for load is the same cluster that provides redundancy. In the banking case: a second (or third) broker means a single broker failure degrades nothing, and a multi-consumer analysis tier means one failed consumer leaves the rest processing.

Requirement What it means for this architecture Answer sentence to write
Horizontal scalability Multiple brokers; analysis tier as a cluster of consumers "Considering the volume of customers, a cluster with multiple nodes."
Low latency Two latencies: batch store/retrieve; Kafka serving + ingestion + processing speeds "Those speeds are compared and analyzed, and the cluster set up accordingly."
High availability Redundancy across tiers; a broker failure must not stop the flow "More than one broker, and a consumer cluster, so the system keeps serving."

8.3.5 Student Questions and Answers

Q: What are the non-functional requirements in the big data space?

A: Three things: low latency, high availability, and horizontal scalability. Put a subheading on each and write what requirements you expect the architecture to have under it.

Q: For horizontal scalability, what do we actually write?

A: Considering the volume of customers that you have, you may want a cluster with multiple nodes. It can be multiple brokers, or the analysis tier can also be a cluster consisting of many consumers. The volume decides.

Q: Is low latency critical here? The customer should be responded back with an alert after a transaction, and loan-related data is stored anyway.

A: The alerting does not remove latency from the picture — it moves it. Low latency appears in two things. One is in the batch layer: you are storing something and retrieving something, and with respect to that you have latency. The other is at what speed Kafka is serving the analysis tier, at what speed messages are ingested into the streaming layer, and at what speed the streaming layer processes them. Those speeds should be compared and analyzed, and the cluster set up accordingly. You cannot say latency is not required — it depends on the number of customers, the number of loan takers. What you can say is that by considering the volume you may want to set up the cluster.

Recap: Non-functional evaluation is a three-part template — low latency (with the two latencies), high availability (redundancy across tiers), horizontal scalability (volume-driven cluster sizing) — where availability and scalability are told as one argument. In the next section the paper moves to the second question of the pair: message delivery semantics, where the justification is worth more than the choice.

Real-world connection: the same three requirements appear in every production data platform. Cloud providers market exactly these properties — a message queue's replication factor answers "availability," its partition count answers "scalability," and its end-to-end delivery times answer "latency." A bank evaluating Kafka for card alerts reads the vendor documentation looking for these three columns before any feature list.

8.4 Message Delivery Semantics

The second question of the paper's pair is about message design — typically message delivery semantics, with justifications. This section holds the class's sharpest debate of the session: exactly-once versus at-least-once in banking, and the rule that finally resolves it — one semantics per architecture.

Hook: Ask any student what a banking system needs and the answer is instant: "exactly-once, of course." The instructor's response is the whole lesson in one line: you cannot just declare it. The right semantic is a conclusion you are forced to reach by answering three questions — not a label you attach at the start.

8.4.1 The Three Justification Questions

Whenever a question asks about message delivery semantics, the instructor's framework is three questions, and every answer must put all three down and justify each:

  1. What is the business impact if I lose a message?
  2. How much worth of data can the system tolerate?
  3. What is the requirement for long-term storage?

The semantics choice — at-most-once, at-least-once, exactly-once — is a consequence of answering these three for the specific problem. The marks come from the justification, not from naming a semantic.

Key concept — the three delivery semantics. A delivery semantic is the guarantee a messaging system makes about what happens to a message under failures:

  • At-most-once — a message may be lost, but it will never be delivered/processed a second time. Simplest guarantee; no retry machinery, no duplicate tracking. Losing the occasional message is accepted.
  • At-least-once — a message will never be lost, but it may be delivered and processed more than once (duplicates can occur, for example when an acknowledgment is lost and the broker re-sends). Requires the consumer to tolerate duplicates — typically by being idempotent, producing the same result if the same message arrives again.
  • Exactly-once — a message is never lost and is processed exactly once. The strongest guarantee, and the most expensive: it must hold at both ends, the producer and the consumer, and requires coordination machinery (for example, the producer tracking sent messages and the consumer recording the last processed message so a re-send can be recognized and ignored).

The three questions are the bridge from business to semantics: the first decides whether loss is tolerable, the second decides how much duplicate/retry machinery is worth paying for, and the third decides whether the system must keep messages for replay or can discard them. Answer all three for the given problem and the semantic chooses itself.

8.4.2 Exactly-Once versus At-Least-Once for Banking

The class opened with a confident guess: for banking, delivery must be exactly-once. The instructor agreed with the instinct but forced the reasoning out: what kind of transaction are you doing? For credit card transactions, exactly-once is the natural choice — a duplicated or lost charge is a real business event. But the full architecture is not only the card stream; it also carries messages pertaining to batch layer semantics. For the batch layer that kind of guarantee is not required; for the streaming layer you need the guarantee.

Then the alternative surfaced: at-least-once delivery, with the analysis tier handling replicated messages — deduplicating and ignoring duplicates. The instructor accepted that as a legitimate answer: it is also possible, provided you say why and you specify how the analysis tier handles duplicates, because the analysis tier is part of your design too. Both exactly-once and at-least-once-with-dedup are acceptable if justified.

The cost angle matters: exactly-once needs to be ensured from both ends — producer and consumer — and from a cost perspective that is a challenge. A student also pointed out that the use case gives no numbers — how many messages per second or per minute is not stated — which is a legitimate argument for the simpler at-least-once choice. When the problem does not quantify load, you can argue from that absence.

Pitfall — naming a semantic is not an answer. "For banking we choose exactly-once" earns nothing by itself. Every choice must run the three questions for the actual problem: which activities are on the streaming path (where the guarantee is needed) and which on the batch path (where it is not), how duplicates will be detected if the consumer may see a message twice, and what the absent numbers imply. An unjustified semantic — or worse, two different semantics in one architecture — is the failure the instructor is hunting for.

8.4.3 One Semantics per Architecture

The sharpest point of the debate: you may propose only one message delivery semantics for an architecture. Whether you have a batch layer and a stream layer, you cannot have one semantics for batch and another for stream. A student tried to argue that at-least-once is architecturally weak because delegating deduplication to the processing layer violates the separation of duties — the bifurcation of layers. The instructor agreed the point was valid, and generalized it: one message delivery semantics for the whole architecture, and if you delegate the dedup work to the processing layer, then how the processing layer does that work is part of your answer, because you are the one implementing that layer.

The logic behind "one semantics per architecture" is worth stating in full. The message pipeline — collection, data flow layer, processing — is one path; a message does not know whether it is a "batch message" or a "stream message" at the point it is produced, and the data flow layer cannot apply two different sets of rules to the same flow without doubling its machinery. So the guarantee is chosen for the whole architecture, and the stronger requirement (here, the card stream) sets the floor. If the processing layer is asked to clean up duplicates, the cleanup mechanism is your design decision and must be explained as part of the architecture — you cannot hand the problem to an unspecified layer.

Exam note: In the banking answer, both "exactly-once" and "at-least-once with deduplication in the analysis tier" are acceptable — provided the three questions are answered, the duplicate-handling mechanism is described, and one semantic is used for the whole architecture. What is not acceptable is an unjustified choice, or a different semantics for batch and for stream. The justifications are what get graded.

8.4.4 Student Questions and Answers

Q: For this banking problem the delivery semantic should be exactly-once, right?

A: You cannot just declare it. Look at what kind of transaction you are doing. For credit card transactions it has to be exactly-once, yes. But this architecture also has messages pertaining to batch layer semantics — for the batch layer that guarantee is not required; for the streaming layer you need it. Answer the three questions: what is the business impact if I lose a message, how much worth of data can the system tolerate, and what is the requirement for long-term storage — and justify the choice from them.

Q: If we choose at-least-once delivery and say that in the analysis tier we will take care of replicated messages and ignore duplicates, is that acceptable?

A: Yes, that is possible. At-least-once with deduplication in the analysis tier is an accepted answer if you justify it. But if you delegate the handling to the processing layer, you must also explain how your processing layer works, because you are implementing it. Exactly-once and at-least-once are both acceptable — what is not acceptable is an unjustified choice, or two different semantics in one architecture.

Q: Architecturally, at-least-once is not good, because delegating deduplication to the processing layer violates the separation of duties between the layers.

A: That is a valid point. The principle it supports is the important one: only one message delivery semantics per architecture, whether you have a batch layer, a stream layer, or both. You cannot have one semantics for batch and one for stream. On top of that, exactly-once has to be ensured from both ends, which is a cost challenge — and the use case gives no numbers, no messages per second or per minute, so you can argue from that too.

Recap: Delivery semantics is a three-question reasoning exercise — business impact of loss, tolerable data worth, long-term storage need — producing one semantic for the whole architecture, with the duplicate-handling mechanism specified wherever it lives. The next case shows the opposite extreme: an architecture where the answer is at-most-once, because the messages are slow and loss is harmless.

Real-world connection: the same trade-offs govern production messaging choices. Fraud detection and financial transaction pipelines demand strong guarantees — losing a single fraud signal can have an "undesirable effect," so operators accept the cost of exactly-once-style coordination. Web analytics pipelines, by contrast, tolerate a dropped event here and there and run the cheapest guarantee. The three questions are literally how practitioners pick: the business impact column decides.

8.5 Worked Case Study: Online Education System

The second sample problem flips the first: the class read the banking scenario and split it into stream plus batch; here they read an education platform and must realize that nothing needs real-time processing. The whole case turns on one observation — certificates are not events — and one rate judgment: the tallies run once a day, so the processing is batched.

Hook: Certificates, or events? The class's first instinct was to treat every milestone — including certificate awards — as a message in the stream. The instructor's question forces the distinction: which things are produced as they happen (events), and which things are outcomes computed from accumulated events? Mixing those up sends the whole architecture in the wrong direction.

8.5.1 Identifying the Events

The second sample problem is an online education system, and the class's first struggle was identifying what the events are. The instructor's example: suppose you are tracking the progress of a learner. A student completes a module, or a lab session — that is an event. Certificates are not events; they will not be generated as an event because they are the outcome of accumulated progress. So the event stream is progress events: module completions, lab session completions. You collate all of them and see how much the learner has progressed.

The class found this genuinely tricky, and the instructor's response was that it is not tricky — it is straightforward once you notice the scheduling. This is about scheduled events, not per-second events. You do not track every minute or every second; you need to track every day.

Intuition — events versus outcomes. Think of a marathon runner: the events are the checkpoints crossed along the route (each one happens at a moment in time and is recorded as it occurs). The medal is not an event — it is the outcome, printed after all checkpoints are tallied. A certificate in the education system works exactly like the medal: it is computed from accumulated progress, so it is generated by the system as a result, not reported by the learner as a happening.

8.5.2 Daily Tracking Means Scheduled Batches

Here is the reasoning that resolves the case: a two-month course has an expected daily pace — how much is expected to be completed each day, and how much has been completed. That daily progress is the event stream. But because you process daily, each day is a batch. When you are tracking every day, it is batch processing, full stop. The rate question settles it: you have plenty of time to process these messages, so nothing about the design is driven by real-time pressure.

The decision rule being applied is the same one from Section 8.1 — read the activities, then ask the rate question: how fast must the answer exist after the event? Here the answer to "how much has this learner progressed today" is needed once per day, not once per transaction. A daily need means a daily job: collect the day's module and lab completions, run the rollup, update the progress view. Nothing in the pipeline is waiting per-second, so no per-second machinery is justified.

Key concept — the rate question decides the regime. Whenever an activity is ambiguous, ask how long the system may wait between an event happening and its effect being visible. If the wait is bounded by "immediately" (a transaction alert, a fraud check), the activity is stream. If the wait is bounded by "by the end of the day" or "by the next run of the job" (progress rollups, spending insights), the activity is batch. In this case the wait is a full day, so the regime is batch — and that single sentence is the hinge of the whole architecture.

8.5.3 The Architecture: Lambda Without the Streaming Layer

Because the streaming requirements are minimal, Kappa is ruled out — you cannot use it as a stream-only design when there is barely a stream. The architecture is Lambda architecture without the streaming layer. The instructor's exact formulation: "Lambda architecture without the streaming layer would be the architecture." Batch ingestion, batch views of learner progress, and a serving side for certificates and progress reports.

Pitfall — reaching for Kappa because "it is modern." Kappa is a stream-only architecture; choosing it here would commit the design to streaming machinery for a workload with no real-time requirement. The trap is choosing the architecture family from fashion instead of from the regime decision. Batch activities → batch provisioning; only when a genuine stream exists does the speed layer earn its place. Here the answer is Lambda minus the streaming layer: batch ingestion, batch views of progress, and a serving side that issues certificates and progress reports.

8.5.4 At-Most-Once Delivery

For the message delivery semantics, the answer is at-most-once, and the student who said it first got a "fantastic." The justification is built from the three questions: if a message is lost, the business impact is tiny — one progress event missing from a daily rollup barely matters; the data tolerance is high; and long-term storage needs are modest. The instructor's supporting point: the hard semantics — at-least-once, exactly-once — exist because systems cannot cope with message volume. Here the messages arrive slowly and you have a lot of time to process them, so you do not need retries or deduplication machinery at all. Losing a message is acceptable, so at-most-once is correct.

Worked example — the education case through the three questions.

  1. Business impact if a message is lost: a single module-completion event missing from today's progress rollup. The learner's reported progress is off by one module until the next run — essentially invisible, and correctable tomorrow. Impact: tiny.
  2. How much worth of data can the system tolerate: high. The whole point is a daily summary; one missing event among thousands does not change any decision, and a certificate is issued from accumulated tallies that remain overwhelmingly accurate.
  3. Requirement for long-term storage: modest. Progress rollups (not raw per-second data) are what matters; the system does not need years of replayable message history.

Answer: at-most-once. The hard semantics exist because systems cannot cope with the message volume; here the messages arrive slowly and there is plenty of time to process them, so no retries and no deduplication machinery are needed. Final answer: at-most-once is correct — and the student who said it first had it exactly right.

8.5.5 Student Questions and Answers

Q: What are the event messages in the online education system? Certificates will not be generated as events, right?

A: Correct — certificates won't be an event. The event can be the progress of the student: a student accesses modules or lab sessions, and whenever he completes one module you can treat it as an event. You collate all of those and see how much he has progressed.

Q: Why at-most-once? Why would we want to lose messages about the progress of a module the student completed?

A: Look at the rate messages are coming. The hard semantics — at-least-once, exactly-once — exist because so many messages are generated that you cannot cope with them. Here you have a lot of time to process these messages: the progress is tracked daily. So loss has almost no impact, and at-most-once is right. The student who answered at-most-once first had it exactly right.

Q: Using Kappa here is completely ruled out, then?

A: Correct — you cannot use it as a stream because there is no streaming requirement of that scale. Lambda architecture without the streaming layer is the architecture.

Recap: The education case runs the same recipe to the opposite conclusion: events are daily progress completions (not certificates), daily tracking means scheduled batch processing, the architecture is Lambda without the streaming layer, and the delivery semantic is at-most-once because slow messages make loss harmless. The next sections leave exam strategy behind and build the Kafka machinery the answers rely on — topics, partitions, and offsets.

Real-world connection: the pattern of "events, not outcomes" and "daily means batch" is everywhere. Learning management systems roll up learner progress nightly and issue certificates from accumulated totals; payroll systems treat each clock-in as an event but settle pay in a weekly batch; analytics platforms ingest website clicks in real time but compute the daily dashboard overnight. Naming the event stream correctly is the same skill as naming the real-time boundary — get that right and the architecture mostly draws itself.

8.6 Kafka Topics, Partitions, and Offsets

Before the partition-count formula of Section 8.7 can make sense, three terms must be absolutely clear — topic, partition, offset. Each one is simple alone; the confusion comes from who does what (the broker does nearly everything) and from picturing them as unrelated ideas when they are actually three views of one structure: a topic is the label, a partition is the file, an offset is the position in that file.

Hook: "A topic is nothing but a subject line." That is the instructor's entire opening move — and the whole lesson of this section is contained in the follow-up: who decides what the subject line is. Spoiler: not the producer. Every other confusion in Kafka's vocabulary unravels once the broker is seen as the sole coordinator.

8.6.1 Topic

Three terms must be familiar before any partition math: topic, partition, offset. A topic is a kind of unique name for a data stream. The instructor's analogy is email: in an office you do not respond to every email — you ignore some, and the basis for deciding is the subject line. A topic is nothing but a subject line. Events come in, and you group them into different logical groups; each logical group is a topic.

In the banking example: if several events are connected with the amount of transactions, you can say that a transaction-volume-based event is a topic. If you want to analyze whether a message is a fraudulent transaction or not, you create a topic called "validate transaction." A producer might send different types of data; the topics group the events according to those types. Topics have unique names. The same message can land in multiple topics — a transaction can be looked at as "volume of purchase" and as "valid or fraudulent" at the same time. You can do that.

Analogy (the professor's own): Email. In an office, you do not respond to every email — you ignore some, and the basis for deciding is the subject line. A topic is exactly that: the subject line of a data stream, a name that lets anyone look at an incoming event and know which logical group it belongs to. Where the analogy breaks: an email subject line is chosen by the sender, but in Kafka the label on an event is chosen by the broker — the producer's message arrives, and the system decides which topic (which "subject line") it goes under.

The labeling detail is easy to get wrong: the producer does not put the label. The broker puts the label, and according to that label the producer's messages are routed to the matching topic. Producers write messages to topics; consumers say what type of messages they are interested in; the broker maps them accordingly.

8.6.2 Partition

A topic will accumulate a large volume of messages, and a single broker may not be able to handle them. In that case you create partitions. A partition is a small independent portion of a topic. Concretely: each partition is an individual machine in the cluster — some messages are written to partition P1, some to P2, and so on. The broker takes care of which message goes into which partition; producers and consumers query the broker and it is all done by the broker.

Two design facts from the discussion: messages fill partitions in order — unless one partition is fully filled, the broker will not start putting messages into the next one. And the number of partitions is a design decision you specify explicitly. There is no runtime provision for the broker to decide the partition count; there may be a default, but you must mention the number you want.

Key concept — why partition at all. A topic can grow to millions of messages, and one machine cannot hold or serve them fast enough. Partitioning splits the logical stream across many machines so that each partition is an independent append-only segment — independent files on independent machines. That is what makes a single logical stream scalable: the producers and consumers spread their work across partitions, and each partition keeps its own ordered sequence of messages. The number of partitions, however, is set by configuration at design time — the broker never decides it at runtime.

Pitfall — "each partition is its own machine" is the unit of parallel work. One consequence often surprises students: because partitions are independent, order is guaranteed within a partition (messages append in order), but there is no ordering promise across partitions — two messages in different partitions may be read in any order. Any design that needs strict total ordering must either live with one partition or treat partition order as meaningless. The professor's fill-in-order picture (fill P1 before P2) is the simple mental model; the exam-safety version is "per partition, ordered; across partitions, no promise."

8.6.3 Offset

Every partition has offset numbers. The instructor's picture: every partition is like an array, and the indexing of that array is the offset ID. When a new message arrives in a partition, it gets appended at the end of the existing offset IDs. Consumers read messages based on the offset ID: the consumer subscribes to a topic, the broker takes it to the partition, and from the partition it goes to the offset ID — that is how the message is fetched. The offset ID is nothing but the indexing in an array.

The consumer is not aware of offsets at all. That bookkeeping is handled internally by the broker: the broker tracks how far the consumer has read and updates the offset accordingly. A student asked whether the broker itself stores each consumer's last offset, and the answer refined the picture: that state information is not necessarily maintained by the broker alone — supporting systems exist for it, for example a resource manager like YARN.

Analogy (the professor's own): every partition is like an array, and the indexing of that array is the offset ID. When a new message arrives it is appended at the end of the existing offset IDs — array element 0, element 1, element 2, and so on. A consumer's read position is just "which index am I up to." Where the analogy breaks: a normal array is static and shared, while a partition grows forever by appends, and each consumer keeps its own index into the same array, so two consumers can be at different positions at the same time.

Real-world: this topic-partition-offset model is exactly what lets Kafka scale a single logical stream across many machines while still giving consumers an ordered, resumable read position per partition. Because the offset is recorded, a consumer that crashes can restart from its saved position instead of losing or re-reading work — the mechanism underneath the delivery semantics of Section 8.4.

8.6.4 Who Coordinates: The Broker

Putting the flow together: the producer sends messages to topics; the broker labels and routes messages into partitions, appends at the end of the partition's offsets, and tracks each consumer's position; the consumer subscribes through the broker and fetches from partition offsets. The broker is the coordinator for all three jobs — routing, ordering, and position tracking — which is why the broker, not the producer or consumer, holds the design decisions in a Kafka deployment.

Key concept — the broker's three jobs. One coordinator owns the whole read/write path:

  1. Routing — deciding which topic a message belongs to, and which partition it lands in (producers and consumers both query the broker).
  2. Ordering — appending each message at the end of its partition's offsets, preserving the fill-in-order picture.
  3. Position tracking — recording how far each consumer has read and updating the offset as consumption progresses.

The producer's job is to send; the consumer's job is to say what it is interested in and fetch. Everything between — the label, the destination partition, the read position — is the broker's. That division is why the design decisions (topic names, partition counts, retention) live in the broker's configuration, not in the client code.

8.6.5 Student Questions and Answers

Q: When the events come into the collection tier, does the producer put the label — like "this is for monitoring, going to the monitoring topic"?

A: No — the broker puts the label. According to that label, the producer's messages get sent to the matching channel. The broker decides which topic a message belongs to.

Q: Can one producer push the same message into two different topics?

A: You can do that. The same event can be looked at in different ways — a transaction as purchase volume, and as a valid or fraudulent transaction — so it can belong to more than one topic. Topics always have unique names.

The partition discussion produced two questions about who controls partitions:

Q: Does the broker decide which message goes into which partition?

A: Yes. Producers and consumers query the broker, and which partition a message lands in is all done by the broker. It is a design decision how many partitions you configure in the beginning — based on past experience you might say ten partitions, seven, six — but the routing within them is the broker's job.

Q: So unless one partition is fully filled up, the broker won't put messages into the other partition?

A: Correct — messages fill the partition, and only when one is full does the next one take messages.

Q: Can the broker decide the number of partitions on its own at runtime?

A: No, that provision is not there. There may be a provision for a default number of partitions, but you explicitly need to mention the number of partitions in the configuration.

And the offset questions, in order:

Q: What is the significance of the offset ID?

A: Whenever a new message comes, it is appended at the end of the existing offset IDs. When a consumer reads a message, it reads based on the offset ID: through the broker, to the partition, to the offset ID — that is how it fetches the message. The offset ID is nothing but the indexing in the array.

Q: Is the consumer aware of the offset IDs? Does it manage them?

A: No, the consumer is not aware of them. It is internally handled by the broker. The broker has to take care of how far the consumer has read and accordingly update the offset ID.

Q: So the broker stores the last offset for each consumer?

A: That state information is not necessarily maintained by the broker itself — supporting systems will be there for it. You can think of something like the YARN resource manager taking care of it.

Recap: Topic = the subject line (chosen by the broker), partition = the independent per-machine segment that gives the stream its scale, offset = the array index inside a partition that gives each consumer its resumable read position. One coordinator — the broker — does the routing, ordering, and position tracking. With these three terms fixed, the formula for how many partitions a system needs becomes a pure arithmetic question.

Real-world connection: LinkedIn — the company that built Kafka — routes billions of messages a day through topic-partition structures exactly like this: hundreds of services producing and consuming through shared topics, each consumer group reading independent positions from shared partitions, and partition counts tuned to throughput targets. The topic-partition-offset model is not an exam curiosity; it is the load-bearing structure of the most widely deployed message platform in industry.

8.7 Estimating the Number of Partitions

With topics, partitions, and offsets in place, partition count becomes the session's first pure-arithmetic question — and the numerical shape of the exam. Three letters carry the whole thing: , , . Everything else is unit conversion and division.

Hook: How many partitions should a topic have? Too few and producers or consumers saturate a single partition and the pipeline stalls; too many and you pay for machines and bookkeeping you do not need. The exam asks for the number that just covers the load — and the load is described by three throughput numbers.

8.7.1 Mathematical Formulation

With topics, partitions, and offsets in place, the number of partitions is a formula-based question. The instructor's setup, given verbatim: "Tt is total system throughput. Tp means maximum throughput of a producer writing to a partition. TC is of a consumer reading from a partition." The number of partitions is

where is the total system throughput (what the whole pipeline must move), is the maximum throughput of a single producer writing to a partition, and is the maximum throughput of a single consumer reading from a partition. The two ratios also have names: is the number of producers needed by the system, and is the number of consumers needed by the system. Because partitions must be able to absorb the producers' output and keep the consumers fed, you take the larger of the two ratios.

Key concept — why the max. Each partition is one unit of parallel work: one producer can write into it, and one consumer can read from it, at the partition's maximum speed. So the pipeline needs enough partitions that the producers can write the whole system throughput into them — that forces — and enough partitions that the consumers can read the whole system throughput out of them — that forces . The number of partitions must satisfy both constraints at once, so it is the larger of the two ratios:

Sanity checks on the formula: the ratios are (throughput) ÷ (throughput), so the result is a plain count, not a unit of measure. If producer and consumer speeds were equal, both ratios would be identical and the max would be that common value. And in practice the answer is rounded up to a whole number — you cannot configure 16.67 partitions.

Unit hygiene is the whole game in these problems: system throughput is usually given per minute (GB per minute), while producer and consumer throughput are given per second (MB per second), so you must convert one side before dividing. The instructor accepts ("more precise is 1024, it doesn't matter"), so the numbers stay clean.

Pitfalls:

  • Dividing with mismatched units. in GB per minute against in MB per second gives a meaningless ratio — convert to MB per second (multiply by for GB→MB, then divide by 60 for minutes→seconds) before dividing.
  • Confusing total producer throughput with per-producer throughput. If the question says "50 MB/s across 100 producers," divide first — one producer writes 0.5 MB/s.
  • Forgetting the consumer side. The formula is the max of the two ratios; a solution that only covers the producers is half the answer.

8.7.2 Worked Example: 10 GB per Minute System Throughput

Problem: system throughput GB per minute, and the maximum throughput of a producer writing to a partition is MB per second. Estimate the number of partitions — and the consumer throughput it implies.

Worked example — 10 GB/min system, 10 MB/s producers.

Step 1 — convert the system throughput to MB per second:

(10 GB becomes MB; the minute becomes 60 seconds.)

Step 2 — divide by the producer throughput:

So the system needs roughly 16.67 partitions. The instructor's arithmetic along the way: , "this 10 cancels" against the 10 MB/s denominator, leaving MB, "here the numerator is in minutes, so we have to change it to seconds," giving , and "because this 10 cancelled, 100 by 6" — which is 16.67.

Step 3 — what the answer implies for consumers. The consumer throughput must not make the system the bottleneck: the ratio must be less than or equal to 16.67, otherwise the partition count is no longer the maximum. Rearranged, , which is about 10 MB per second. In words: if a consumer can read at roughly the same speed as one producer writes, the partition count holds.

Sense-check: 16.67 partitions each absorbing 10 MB/s of writes gives MB/s, which matches the converted system throughput MB/s. The producer side is exactly covered, and a consumer reading at 10 MB/s reads the same 167 MB/s across 16.67 partitions.

8.7.3 Worked Example: 24 GB per Minute with 100 Producers

Problem: a streaming system with system throughput GB per minute. Throughput from the producers is 50 MB per second in total, spread over 100 producers. Find the expected number of partitions.

Worked example — 24 GB/min system, 100 producers at 50 MB/s total.

Step 1 — per-producer throughput. The 50 MB/s is the total across all producers, so one producer's estimate is

Step 2 — convert the system throughput:

Step 3 — divide:

The instructor first read the ratio as 8000, then stopped and corrected himself: "not 8000, I think it's 800," and the class confirmed — 800 partitions is the expected number. The correction is worth keeping as a reminder to check the decimal in the last step: 400 divided by 0.5 is 800, not 8000. (The trap: is 800 because 0.5 goes into 400 twice per unit — ; misreading the decimal as 5 would produce the false 80 or, writing an extra zero, the false 8000.)

A shortcut the instructor pointed out: if the per-producer throughput is already given directly, the count of producers can be ignored — you only need the system throughput and the single-producer number.

Sense-check: 800 partitions at 0.5 MB/s of writes each absorb MB/s — exactly the converted system throughput, so the writes fit with no slack and no overflow.

8.7.4 Student Questions and Answers

Q: Sir, this ratio — Tt by Tp — was the number of partitions, right?

A: Correct. That ratio is the number of partitions. And this number Tt by Tp is also called the number of producers needed by the system, while Tt by Tc indicates the number of consumers needed by the system.

Q: When does Tc come into the picture? Our formula uses max of Tt by Tp and Tt by Tc.

A: Right. You take the max of the two ratios. You estimate the throughput of a consumer from this — here it is Tt divided by 800 if you want it. And sometimes Tc may be given to you in the question; then you compute Tt by Tc directly. Both cases are possible.

Recap: The partition count is — partitions must absorb the producers' throughput and feed the consumers' throughput, so the larger ratio wins. Convert units first (GB per minute → MB per second with ), divide, and check the decimal in the last step. In the next section the partition count feeds directly into the storage calculation.

Real-world connection: partition-count planning is a standard capacity exercise in production Kafka deployments — operators estimate expected message rate and per-partition throughput, then size the topic. Too few partitions caps parallelism (one consumer per partition, so a topic cannot be read faster than the number of partitions allows); too many adds file-handle and bookkeeping cost. The exam formula is the same trade-off, stripped to its arithmetic.

8.8 Storage Requirements for the Partitioned System

The partition count from Section 8.7 does not just size the parallelism — it sizes the disks. Once is known, storage falls out of a three-factor product: how many partitions, how many messages each holds, and how big each message is.

Hook: A student asked the sharpest question of the discussion: if the system can process 400 MB per second while the producers only generate 50 MB per second, why store anything at all? The answer exposes what partitions really are — the storage is the partitions, and consumers read from that storage. Speed of processing never removes the need for the data to live somewhere.

8.8.1 Mathematical Formulation

Once the partition count is known, the storage question follows. You know the number of partitions . Assume each partition can store messages, and each message is on the order of kilobytes. Then the storage requirement is

Key concept — three factors, three names. Every symbol in is defined before use:

  • (uppercase) — the number of partitions, from the throughput formula of Section 8.7. In the 24 GB per minute problem, .
  • (lowercase) — how many messages one partition can hold. This is the offset-ID idea in action: a partition is the array, and is how many entries the array can store.
  • — the size of a single message in kilobytes (KB).

Multiplying gives in KB. The message count per partition and the message size are problem parameters: the question either supplies them or leaves them symbolic, as here.

The professor's verbal description: "this is nothing but 800 times n times m." To use it you need two facts: how many messages each partition holds, and how big each message is. Message sizes are assumed to be small — the instructor explicitly says each message is on the order of some small KB, because stream messages are lightweight, not megabytes. The per partition is the offset ID idea in action: a partition is the array, and is how many entries it can store.

Pitfalls:

  • "Processing is fast, so storage is unnecessary." Processing speed and storage are unrelated questions — messages land in partitions when produced and are read from partitions when consumed; a fast consumer changes nothing about where the messages live.
  • Treating message size as unknown means "no answer." The exam convention is to assume lightweight messages of KB — state the assumption and keep the formula symbolic rather than stopping.
  • Mixing units: if is in KB, the result is KB. If a variant asks for cluster disks, convert to the required unit (MB or GB) with the same convention used in Section 8.7.

8.8.2 Worked Example: 800 Partitions

In the 24 GB per minute problem the partition count came out to . So the storage requirement is

with the two parameters left symbolic because the problem does not fix them: , how many messages one partition can store, and KB, the size of a single message. The exam variant flips the missing pieces — sometimes the question gives you message size and retention and asks you to size the cluster's disks.

Worked example — storage sizing for 800 partitions. Use the numbers from Section 8.7's second problem: .

Step 1 — write the formula with the known factor:

Step 2 — plug in what the problem gives. This version of the problem leaves both parameters open, so the answer stays symbolic: is the message capacity of one partition (the array length), KB the size of one message.

Step 3 — spot the exam variant. If the question instead supplied the message size and a retention window, the missing piece changes: given KB per message and messages per partition, the storage per partition is KB, and multiplying by the number of partitions gives the cluster's disk footprint to provision.

Sense-check: the result's unit comes from : with in KB the storage is in KB; a real cluster would convert to GB (dividing by under the course's convention) — the arithmetic stays the same, only the unit label changes.

A student raised a sharp question during this discussion: if the system can process 400 MB per second and the producers only generate 50 MB per second total — the processing throughput is eight times the production rate — why store anything at all? The answer: storage is not about catching up; it is the partitions themselves. The messages must live in the partitions regardless of how fast they are consumed.

8.8.3 Student Questions and Answers

Q: The system processes 400 MB per second while producers generate only 50 MB per second, so why do we even need storage?

A: Because you need to store the messages in the partitions. The partition is where messages land, and consumers read from there. Processing speed does not remove the need for storage.

Q: The size of each message is not given in this problem — how do we calculate storage?

A: That is why you assume: each message size is KB — messages will be very lightweight, they won't be in MB. And each partition can store such messages — that is the offset ID idea, the partition holding its array of messages. So is the storage per partition, and you multiply by the number of partitions, 800.

Recap: Storage is — partition count from the throughput formula, message capacity per partition from the offset-array picture, message size assumed small in KB. Storage is the partitions themselves, so consumption speed never justifies skipping it. The next topic leaves numbers behind: security in the generalized architecture.

Real-world connection: this multiplication is what capacity planning looks like in production. Kafka operators estimate messages per second and average message size, multiply by the retention window to get per-partition disk need, multiply by the partition count — then order that many gigabytes of cluster storage. The "why store at all" question also answers itself in industry: consumers are often offline or batched (hourly jobs, re-runs, backfills), and the partitions must hold the data while those consumers catch up.

8.9 Security in the Generalized Architecture

A security question framed at the level of the generalized architecture is independent of the problem statement — the instructor says it has nothing to do with the use case; it is general. That is the liberating part of this topic: the same answer template works for banking, education, or any other scenario, because it is about the tiers, not the business.

Hook: Security in a big-data architecture question is not a hacking quiz. It is two questions wearing one label: who is allowed in (identification and authorization on every tier-to-tier connection) and what happens when a link breaks (fault tolerance at the touch points). Answer those two and the security marks are yours.

8.9.1 What Security Means Here

A security question framed at the level of the generalized architecture is independent of the problem statement — the instructor says it has nothing to do with the use case; it is general. Security here means identification and authorization: how secure the connections are between the tiers. The concrete checklist: the link between the collection tier and the data flow layer is connected via a secured connection only after authorization, and the analysis tier likewise connects to the data flow layer only after authorization. Protocols like TLS or SSL are exactly the vocabulary expected — a student asked "security means we have to tell about TLS or SSL or something of that sort, right?" and the answer was yes.

Key concept — identification versus authorization. Two words carry the answer. Identification is who you are: the system can tell which producer, consumer, or broker is talking (authentication — for example, certificates or credentials). Authorization is what you may do: a producer is allowed to produce, a consumer is allowed to consume, and only after that authorization may the connection be established. In the generalized architecture the rule is the same at every seam: the collection tier and the data flow layer connect over a secured connection, and only after authorization; the analysis tier connects to the data flow layer the same way. TLS/SSL are the transport-level encryption protocols that secure the link in flight — the vocabulary the question is looking for.

The check should also cover data at rest — messages stored in the data flow layer or in storage should be protected when written, not only while moving between tiers. In the exam answer, the two or three sentences that matter are: each tier-to-tier link is authorized, then secured (TLS/SSL), and stored data is protected as well.

8.9.2 The Touch Points and Fault Tolerance

The second half of security is the touch points between layers. Walk the architecture from left to right: collection tier → data flow layer (where the Kafka broker sits) → processing tier. For each link, ask what happens if the link breaks. What happens if the link between the collection tier and the data flow layer is broken? What happens if the link between the data flow layer and the processing layer is broken? You list three or four aspects related to fault tolerance — the aspects that keep the pipeline alive when a tier or a link fails. That is what a security question is really asking at the generalized level: not firewall trivia, but protected connections and resilient touch points.

Touch point If it fails… What keeps the pipeline alive
Collection tier → data flow layer Producers cannot deliver events Producers retry/buffer; the broker's durable store holds what arrived; the link re-syncs on recovery
Data flow layer (broker) Messages stop flowing Multiple brokers — a second broker keeps serving; replicated partitions protect stored messages
Data flow layer → processing tier Consumers cannot fetch Consumers query the broker again on recovery and resume from their saved offsets
Storage under the broker Disk loss Replication (a copy of each partition elsewhere); durable storage so committed messages survive

The pattern to state in the answer: for every seam in the architecture, name the failure, name the resilience mechanism that absorbs it, and show that the flow resumes — that is the fault-tolerance story the question wants.

Pitfall — security is not "one firewall." Answers that treat security as a single perimeter (a firewall at the edge) miss the point of the generalized question. The expected answer walks the internal seams: every tier-to-tier connection is secured and authorized, and every link has a fault-tolerance aspect. Also do not invent use-case details — security here is general, so the answer must not depend on the scenario at all.

8.9.3 Student Questions and Answers

Q: For security, do we have to tell about TLS or SSL, something of that sort?

A: Yes, that is exactly what you need to worry about. The collection tier and the data flow layer would be connected via some secured connection only after authorization, and the analysis tier would connect with the data flow layer the same way.

Recap: Security in the generalized architecture is use-case-independent: identification and authorization on every tier-to-tier link, secured with TLS/SSL-class protocols, plus a fault-tolerance aspect at each touch point — broker redundancy, replication, resumable consumers. The final section of the paper returns to numbers: message writing mechanisms judged by ingestion rate versus processing rate.

Real-world connection: production data platforms enforce exactly this pattern — Kafka clusters run TLS for in-flight encryption, authenticate clients with certificates, authorize produce/consume per topic, and replicate partitions across brokers so a single broker or disk failure does not stop the flow. When a company's security review asks "what happens if this link breaks?", the answer is the same touch-point walk taught here.

8.10 Message Writing Mechanisms: Ingestion Rate versus Processing Rate

The last concept of the paper — and the instructor's own exam intel says it is in the midterm syllabus — gives you rates and asks what kind of queue or writing scheme the data flow layer needs. It is a two-number problem: ingestion rate versus processing rate, one ratio, and a decision.

Hook: Water flowing into a bathtub faster than the drain removes it — eventually the tub overflows. The question "what message writing mechanism does the data flow layer need?" is exactly the bathtub problem: compare the inflow (ingestion) to the outflow (processing), and the size of the backlog tells you what to do.

8.10.1 The Decision Rule: Compare the Rates

The message writing mechanism question gives you rates and asks what kind of queue or writing scheme your data flow layer needs. The model: collection tier → data flow layer → processing tier, with ingestion rate (rate of injection) and processing rate (rate of processing). The first move is always the same: compute . That ratio decides whether the data flow layer is fine as it is, needs a bigger queue, or forces you to scale the processing layer.

8.10.2 Mathematical Formulation

Let be the rate at which messages are ingested into the data flow layer and the rate at which the processing layer consumes them. Compute

  • If : ingestion can be absorbed as it arrives, and the data flow layer can be a simple in-memory message queue with no special requirements.
  • If : messages accumulate. The backlog grows at per unit time, and over a refresh window of duration the queue must hold

messages. Then choose: scale the processing layer horizontally so its capacity reaches , or switch the writing mechanism to batches — the choice depends on how big the backlog is and whether processing capacity is the real constraint.

Key concept — the ratio is the diagnosis, the backlog is the prescription. Define the two rates on first use: (subscript i for ingestion) is the rate at which messages are injected into the data flow layer — the inflow; (subscript p for processing) is the rate at which the processing tier consumes them — the outflow.

  • Ratio : the outflow keeps up with the inflow; nothing piles up, so a simple in-memory message queue is enough.
  • Ratio : the inflow beats the outflow; the queue accumulates messages per unit time, so over a refresh window the backlog held is . Either raise the outflow (scale the processing layer until its capacity reaches ) or change the writing scheme (batches).

The refresh rate deserves a definition: it is the rate at which the data flow layer is cleaned up, or the rate at which the system starts the process again — you run the application for some time (say ten minutes), stop, and start again. Over a 30-minute refresh window you accumulate all incoming messages, so the queue must be sized for the whole window, not for one second.

8.10.3 Example: Ratio Below One

First example: . That means — ingestion is 99 percent of the processing rate, so processing is on par with ingestion and can handle the load. In this case the data flow tier can be dropped to a simple in-memory message queue with no special requirements.

Worked example — ratio 0.99. Suppose the processing tier handles 100 messages per second and ingestion runs at 99 per second. The processing tier is 1 percent faster than the inflow, so every message is consumed almost immediately after arrival; nothing accumulates. Conclusion: the data flow layer is a simple in-memory message queue, no special requirements. Sense-check: the ratio being below 1 is exactly the bathtub condition where the drain beats the tap — the tub stays empty.

8.10.4 Example: Ratio of Twelve

Second example: MB per hour, MB per hour. The ratio is 12: by the time one message is processed, twelve messages have been ingested — eleven messages are waiting to be stored. If the rates are per hour, eleven messages an hour is nothing; a simple message queue handles it. But notice what happens if the same ratio runs per minute or per second: eleven messages per minute means the data flow layer fills up quickly. You cannot just use an in-memory data store — direct writing will not work — and the fix is to scale up the processing layer, not the queue.

Worked example — ratio of twelve. Ingestion is 120 MB per hour, processing is 10 MB per hour: . Every hour, 120 MB arrive and 10 MB are processed — 11 messages an hour wait in the queue, which is nothing; a simple message queue handles it. Sense-check the units: the same ratio at per-second rates (120 MB/s versus 10 MB/s) means 110 MB of backlog per second — the data flow layer fills in minutes. Conclusion: the rate unit changes the verdict. At high rates, direct in-memory writing does not work and the processing layer must be scaled up — the queue is not the fix, the outflow is.

8.10.5 Worked Problem: 10 MB/s against 1 MB/s with a 30-Minute Refresh

The main worked problem: a streaming architecture with ingestion rate MB per second, processing speed MB per second, and a refresh rate of every 30 minutes. Suggest a suitable message writing mechanism.

Worked problem — 10 MB/s in, 1 MB/s out, 30-minute refresh.

Step 1 — the ratio. , so is ten times .

Step 2 — the backlog per unit time. By the time the processing layer delivers one message, nine messages are sitting in the queue. At the end of one second, nine messages are left out. In this session's arithmetic each 1 MB message counts as one message, so the backlog is 9 messages per second:

Step 3 — the backlog over the refresh window. At the end of 60 seconds: messages left out. Over the 30-minute refresh: messages the data flow layer must hold:

Step 4 — the options. Could you just increase the capacity of the data flow layer to hold 16,200 messages? The instructor's answer is no — that is the wrong lever. What you need is to increase the processing speed so the backlog stays manageable: roughly 100 to 1000 times faster. You can do that by creating a cluster of processing nodes — a Spark cluster, say 1000 nodes. The moment you create the cluster, the messages get delegated across the cluster and only a finite number remains in the queue.

Step 5 — the real-world sanity check. Holding 16,000 messages is, honestly, not a big deal for a system to hold. But there is latency associated with getting messages out of the queue, and that latency is what you want to avoid — so horizontal scaling of the processing layer is the right call. Final answer: horizontal scaling of the processing tier (a processing cluster), because the backlog is large and processing capacity is the constraint.

8.10.6 Horizontal Scaling versus Batching

The instructor then showed the second lever: batching. If the backlog estimate had come out small — he used 162 messages as the hypothetical — you would not scale anything; you would change the writing mechanism to batch processing, sending messages in batches of ten instead of event-by-event.

But there is a condition that rules batching out. If the processing capacity itself is not there — you start with one single producer, one single processor — then the notion of sending batches is completely ruled out, because there is no capacity waiting for the batch. Batching is a way to amortize existing processing capacity; it cannot create capacity that does not exist. That is the trap to avoid in the exam answer: choose horizontal scaling when the ratio is large and capacity is the constraint, choose batching only when capacity exists and the backlog is small.

Situation Writing mechanism
Simple in-memory message queue
, backlog large, processing capacity the constraint Horizontal scaling — cluster of processing nodes (e.g., 1000-node Spark cluster for the 10:1, 30-minute case)
, backlog small, processing capacity already exists Batch writing — messages sent in groups (e.g., batches of ten) instead of one by one

Pitfall — batching cannot manufacture capacity. The trap in the exam answer: with one single producer and one single processor, there is no capacity waiting to absorb a batch, so batching is completely ruled out. Batching only amortizes capacity that already exists; it cannot create it. Match the lever to the constraint: big backlog with a capacity constraint → scale horizontally; small backlog with existing capacity → batch.

Exam note: The message writing mechanism is in the midterm syllabus, and these rate-versus-backlog estimates are the shape the numerical part of the question takes. The instructor's closing summary of the whole session: focus on message delivery semantics problems and on how you design the architecture — that should be sufficient preparation.

8.10.7 Student Questions and Answers

Q: What exactly is the refresh rate?

A: The refresh rate is the rate at which you are cleaning up the data flow layer, or the rate at which you are starting the process again. You run the application for some time — say ten minutes — then stop and start again. So with a 30-minute refresh you are going to accumulate all the incoming messages in the message queue for those 30 minutes.

Q: In this example, there can be multiple solutions — increase processing speed, or batch the messages. Is any one of them acceptable?

A: Yes — for a single problem there can be more than one solution, and that is acceptable. But you need to strictly understand the problem and write accordingly. The argument must hold up and be acceptable for the problem as stated. With a backlog this large and processing capacity the constraint, horizontal scaling is the answer; batching only works when the backlog is small and capacity exists — with one single producer, batching is completely ruled out.

Q: Realistically, holding 16,000 messages is not a big deal — so why scale at all?

A: True, holding them is not a big deal. But there will be latency associated with getting these messages out of the queue, and that latency is what you want to avoid — so you avoid it by horizontal scaling.

Recap: Message writing mechanisms reduce to one ratio: means a simple in-memory queue; means computing the backlog over the refresh window and choosing the lever — horizontal scaling of the processing layer when the backlog is large, batching only when capacity exists. That closes the concepts; the paper's appendix summaries follow.

Real-world connection: this is the same arithmetic used to size real streaming deployments. When a team deploys Kafka to move events into Spark or Flink, they compare ingest throughput against processing throughput, set the refresh/checkpoint window, and decide between scaling the processor cluster and batching writes. Systems that skip this step find out the hard way — a queue that fills until write latency spikes, exactly the latency the worked problem wanted to avoid.

Exam Guidance Summary

  • Session shape: a problem-solving session built around a sample question paper. Expect one scenario-based architecture design question and one message design question, in the same style.
  • Architecture question marks: explaining the various components of the architecture carries 6 marks; non-functional requirements evaluation carries 3 marks; message management (delivery semantics) carries 3 marks.
  • How to write the architecture answer: decide batch vs stream first, then Lambda vs Kappa. Underline the activities in the problem statement and map only those to components. Write each component as a subheading with use-case-specific content, never the generic story. If a requirement is unclear, state an assumption. If the question says draw, draw.
  • Non-functional requirements: the three to write about are low latency, high availability, and horizontal scalability — the three covered in class. For each, write what it means for the given use case (volume-driven cluster sizing, the two latencies in batch layer and streaming path, redundancy for availability).
  • Message delivery semantics: answer the three questions — business impact of losing a message, data tolerance, long-term storage requirement — and justify the choice from them. One semantics per architecture, never one for batch and one for stream. Exactly-once and at-least-once with deduplication are both acceptable in the banking case if justified; the education case is at-most-once because messages are slow and loss is harmless.
  • Numerical problems: number of partitions , with units converted (GB per minute to MB per second, accepting ); storage ; message writing mechanism via the ratio with backlog , choosing horizontal scaling of the processing layer (cluster of nodes, e.g. 10 nodes for a 10:1 ratio, 1000 nodes for the 30-minute case) or batching (groups of ten) only when processing capacity exists.
  • Exam answer shape: each part of the paper rewards the reasoning, not the label — the mapping of activities to components, the justification behind the delivery semantic, and the unit-clean arithmetic behind each number. Write the reasoning in full and the marks follow the substance.
  • What to focus on: message delivery semantics problems and architecture design — that is sufficient preparation. The shared presentations and the notes are enough; the earlier sessions that repeated the same scalable-data-systems content will be consolidated into one presentation placed on the course portal.
  • Logistics: the mid-semester exam is an evening session next week; there is no class next week. The quiz is published and has no makeup component — complete it in time.

Key Industry Applications

  • Banking alerts and fraud detection: credit card and debit card transaction alerts are processed in real time as messages are generated; fraud detection must be real time, at the moment the message is generated — the stream side of a Lambda architecture.
  • Bank offer engine: insights from card-related spending history drive loan offers — batch analytics over historical transactions, delivered as batch views (database views over stored batch data).
  • Kafka partitioning at scale: a single logical topic is split into partitions, each an independent machine in the cluster, with offset-based append and read — this is how one logical stream scales across machines in production.
  • Broker as coordinator: the broker routes messages to topics and partitions, appends at the end of offsets, and tracks consumer read positions; offset state may live in supporting systems such as a YARN resource manager.
  • Cluster sizing from volume: multiple brokers and consumer clusters are recommended from the volume of customers — the same numbers drive horizontal scalability and availability decisions.
  • Secure tier connectivity: connections between collection tier, data flow layer, and processing tier are secured (TLS/SSL) and established only after authorization, with the tier-to-tier links considered as fault tolerance touch points.

The through-line across all six applications: the same vocabulary tested in the exam — batch versus stream, Lambda components, partitions and offsets, delivery semantics, rate-based sizing, and secured links — is the vocabulary used to build and operate production big data systems today.

SPA Lecture 08 notes · Mid-Semester Problem Solving: Architecture, Message Design, and Kafka Partition Estimation

Stream Processing and Analytics· postgraduate· 2026-08-07

Sections Breakdown

18.1 How to Approach a Scenario-Based Architecture Question

The batch-or-stream decision, Lambda versus Kappa, underlining activities, and the answer-writing method.

28.2 Worked Case Study: Smart Device Banking System

Banking scenario mapped to a Lambda architecture: stream alerts and fraud detection, batch loan insights.

38.3 Non-Functional Requirements Evaluation

Low latency (two latencies), high availability, and horizontal scalability for the architecture.

48.4 Message Delivery Semantics

The three justification questions, exactly-once versus at-least-once, one semantics per architecture.

58.5 Worked Case Study: Online Education System

Progress events, daily scheduled batches, Lambda without the streaming layer, at-most-once delivery.

68.6 Kafka Topics, Partitions, and Offsets

Topic as subject line, partition as per-machine segment, offset as array index, broker as coordinator.

78.7 Estimating the Number of Partitions

Partition count formula N = max(Tt/Tp, Tt/Tc) with unit conversion and worked examples.

88.8 Storage Requirements for the Partitioned System

Storage = N x n x m and why processing speed never removes the need for partitions.

98.9 Security in the Generalized Architecture

Identification and authorization on tier-to-tier links, TLS/SSL, and fault-tolerant touch points.

108.10 Message Writing Mechanisms: Ingestion Rate versus Processing Rate

The ri/rp ratio, backlog over the refresh window, horizontal scaling versus batching.

11Exam Guidance Summary

Marks split, answer shapes, and preparation focus for the mid-semester paper.

12Key Industry Applications

How the exam vocabulary maps onto production big-data systems.

Postgraduate students in Stream Processing and Analytics

Exam Revision Notes

Below is the distilled, exam-ready core. Every entry comes from the full explanation above. Use this section for rapid review; return to the main notes when a point needs more context.

How to Approach a Scenario-Based Architecture Question

Must-know: Decide batch vs stream first, then Lambda vs Kappa. Underline the activities in the problem statement and map only those to components; write each component as a subheading with use-case-specific content, never the generic story.

⚠️ Top pitfall: Inventing use cases not in the problem, or writing the generic tier story instead of what the tier does for this use case.

Self-check: When do you choose Kappa over Lambda? (Only when the use case is stream-only.)

Connects to: Worked Case Study: Smart Device Banking System; Worked Case Study: Online Education System

Worked Case Study: Smart Device Banking System

Must-know: Banking case: alerts and fraud detection are stream (process at the moment the message is generated); historical spending insights, loan offers, and loan product tracking are batch. Both regimes means Lambda.

⚠️ Top pitfall: Drawing the producer as a separate box in the pub/sub model — the producer is part of the collection tier, the broker and its queue live in the data flow layer, the consumer is the analysis tier.

Self-check: Is the batch view the same as a database view? (Yes — it is a snapshot of the analysis stored in a database and generated from stored batch layer data.)

Connects to: How to Approach a Scenario-Based Architecture Question; Message Delivery Semantics

Non-Functional Requirements Evaluation

Must-know: The three non-functional requirements are low latency, high availability, and horizontal scalability; each gets a subheading saying what the architecture provides for this use case.

⚠️ Top pitfall: Declaring latency is not required because loan data is stored anyway — latency appears in the batch layer's store/retrieve and in the speeds at which Kafka serves and ingests, and the cluster is sized by volume.

Self-check: Why are availability and scalability described as siblings? (The volume argument that drives cluster sizing is the same argument that buys failover.)

Connects to: Worked Case Study: Smart Device Banking System

Message Delivery Semantics

Must-know: Answer the three questions (business impact of loss, tolerable data worth, long-term storage) and justify the semantics from them; one delivery semantics per architecture, never one for batch and one for stream.

⚠️ Top pitfall: Naming exactly-once without justification, or proposing different semantics for the batch and stream layers of one architecture.

Self-check: Why is exactly-once expensive? (It must be ensured from both ends, producer and consumer, and the case gives no message rates to justify the cost.)

Connects to: Worked Case Study: Online Education System; Worked Case Study: Smart Device Banking System

Worked Case Study: Online Education System

Must-know: Certificates are not events — progress completions are. Daily tracking means scheduled batches, so the architecture is Lambda without the streaming layer, and the delivery semantic is at-most-once because messages arrive slowly and loss has almost no impact.

⚠️ Top pitfall: Choosing Kappa because the workload feels modern — Kappa is stream-only and there is no real-time requirement at daily granularity.

Self-check: Why is at-most-once right for the education system? (The hard semantics exist for high message volume; here you have plenty of time to process, so loss is harmless.)

Connects to: How to Approach a Scenario-Based Architecture Question; Message Delivery Semantics

Kafka Topics, Partitions, and Offsets

Must-know: The broker, not the producer, puts the label and routes messages to topics and partitions; the number of partitions is a design decision you specify, and the broker tracks each consumer's read position via offsets (state may live in supporting systems like YARN).

⚠️ Top pitfall: Believing the producer labels its messages, or that the broker can decide the partition count at runtime — the count must be mentioned in the configuration.

Self-check: Who decides which topic a message belongs to? (The broker.)

Connects to: Estimating the Number of Partitions; Worked Case Study: Smart Device Banking System

Estimating the Number of Partitions

Must-know: N = max(Tt/Tp, Tt/Tc): Tt/Tp is the number of producers needed, Tt/Tc the number of consumers needed, and partitions must satisfy both, so take the larger ratio. Convert units before dividing (1 GB = 10^3 MB).

⚠️ Top pitfall: Checking the decimal in the last division — 400 divided by 0.5 is 800, not 8000.

Self-check: For Tt = 10 GB/min and Tp = 10 MB/s, how many partitions? (About 16.67.)

Connects to: Kafka Topics, Partitions, and Offsets; Storage Requirements for the Partitioned System

Storage Requirements for the Partitioned System

Must-know: Storage = N × n × m: N partitions, each storing n lightweight messages of m KB; the partition is the array and n its capacity, so n × m is storage per partition.

⚠️ Top pitfall: Concluding storage is unneeded because processing is faster than production — messages must live in the partitions regardless of how fast they are consumed.

Self-check: For N = 800, what is the storage requirement? (800 × n × m KB.)

Connects to: Estimating the Number of Partitions; Kafka Topics, Partitions, and Offsets

Security in the Generalized Architecture

Must-know: Security means identification and authorization: the collection tier and the data flow layer connect via a secured connection only after authorization, and the analysis tier connects the same way; TLS or SSL is the expected vocabulary.

⚠️ Top pitfall: Treating security as a single firewall at the edge instead of walking the tier-to-tier touch points with fault tolerance aspects.

Self-check: What protocols does the answer name for securing tier connections? (TLS or SSL.)

Connects to: Worked Case Study: Smart Device Banking System

Message Writing Mechanisms: Ingestion Rate versus Processing Rate

Must-know: Always compute ri/rp first. If ≤ 1, a simple in-memory message queue. If > 1, backlog = (ri - rp) × ΔT over the refresh window; scale the processing layer horizontally when the backlog is large and capacity is the constraint, batch only when capacity exists and the backlog is small.

⚠️ Top pitfall: Choosing batching with a single producer and single processor — batching amortizes existing capacity and cannot create it.

Self-check: For ri = 10 MB/s, rp = 1 MB/s and a 30-minute refresh, what backlog must the queue hold? (16,200 messages.)

Connects to: Estimating the Number of Partitions; Worked Case Study: Smart Device Banking System

Exam Guidance Summary

Must-know: Expect one scenario-based architecture question and one message design question; preparation focus is message delivery semantics and architecture design. The quiz is published with no makeup.

⚠️ Top pitfall: Preparing only the formulas without the architecture and semantics reasoning — substance over point count is what the marks reward.

Self-check: How are the marks split on the architecture question? (6 components, 3 non-functional, 3 message management.)

Connects to: How to Approach a Scenario-Based Architecture Question; Estimating the Number of Partitions; Message Writing Mechanisms: Ingestion Rate versus Processing Rate

Key Industry Applications

Must-know: The exam vocabulary is the production vocabulary: batch vs stream, Lambda components, partitions and offsets, delivery semantics, rate-based sizing, and secured tier links.

Self-check: Where does offset state live in production? (Supporting systems, such as a YARN resource manager.)

Connects to: Kafka Topics, Partitions, and Offsets; Non-Functional Requirements Evaluation

Was this lecture useful?

Loading comments…
🤖

BitsNotes AI Assistant

Subject Notes Assistant

Configure AI Chat

Choose how to access the chatbot
Have your own API key?

Switch to "Bring Your Own Key" tab above for unlimited access with any OpenAI-compatible provider.

🔑 Enter API key above to fetch live models from provider, or enter model name manually.
OpenAI-Compatible API Support

Choose any provider preset (Gemini, DeepSeek, Kimi, GLM, MiniMax, Qwen, OpenAI, Groq, Ollama, etc.) or enter a custom endpoint URL.

Security & Privacy First

Your API key is sent directly from your browser to your specified provider. BitsNotes servers never store or see your key.