Latest / CyberSecurity Summary / Building Real-Time Analytics Systems: From Events to Insights with Apache Kafka and Apache Pinot
Transcript
- 0:00Speaker 1: Okay, so you're trying to get a real grip on
- 0:01Speaker 1: something complex, right, and you want it fast, but without
- 0:05Speaker 1: getting totally buried in jargon and detail.
- 0:08Speaker 2: Yeah, information overload is real.
- 0:10Speaker 1: Exactly, So think of this as your shortcut. We're diving
- 0:13Speaker 1: deep into real time analytics today, trying to give you
- 0:17Speaker 1: that core understanding, you know, without all the noise.
- 0:20Speaker 2: And we're basing this on the book Building real Time
- 0:23Speaker 2: Analytics Systems. It just came out September twenty twenty three, first.
- 0:27Speaker 1: Edition, right, and the book's goal seems pretty practical, just
- 0:31Speaker 1: helping you, the listener, get your job done if you're
- 0:33Speaker 1: working in this space.
- 0:34Speaker 2: Pretty much, it cuts through the theory to the how
- 0:37Speaker 2: to now.
- 0:38Speaker 1: Think back maybe early two thousands data analytics. It's often
- 0:43Speaker 1: felt like something you did after everything else happened, you know,
- 0:46Speaker 1: batch process.
- 0:47Speaker 2: Oh definitely, reports would tell you what happened yesterday or
- 0:49Speaker 2: last week hindsight basically.
- 0:51Speaker 1: But things have really shifted, haven't they. There's this like
- 0:54Speaker 1: massive appetite now for knowing things the moment they happen
- 0:58Speaker 1: real time.
- 0:59Speaker 2: Absolutely. The book uses fraud detection as a great example. Yeah,
- 1:02Speaker 2: finding out about fraud hours later?
- 1:04Speaker 1: Uh uh, too late? Right, the money's probably done exactly.
- 1:07Speaker 2: The real wind is spotting it now, flagging it, maybe
- 1:10Speaker 2: blocking it instantly. That immediacy is key. It's not just
- 1:14Speaker 2: nice to have anymore often, it's well essential.
- 1:18Speaker 1: And that brings us to this idea of streaming. It's
- 1:21Speaker 1: not about waiting for a whole file to finish downloading
- 1:24Speaker 1: or collecting.
- 1:25Speaker 2: No, not at all. Think of it more like a
- 1:28Speaker 2: continuous flow, a river of data that just keeps coming.
- 1:32Speaker 2: It never really ends.
- 1:33Speaker 1: And the crucial part is you can dip into that
- 1:35Speaker 1: river and act on what you see right then and there.
- 1:38Speaker 2: Precisely. A data stream fundamentally is just a series of
- 1:42Speaker 2: data points ordered by time. Each one represents some kind
- 1:45Speaker 2: of event or a change.
- 1:46Speaker 1: Like what give us an example, well, like.
- 1:48Speaker 2: Every single purchase on an e commerce site, or every
- 1:52Speaker 2: reading from an IoT sensor, maybe temperature of pressure. It's
- 1:55Speaker 2: like a constant pulsive information.
- 1:56Speaker 1: Okay, okay, And here's a point the book really stresses,
- 1:58Speaker 1: which I found fascinating. Events have a shelf.
- 2:01Speaker 2: Life, a very short one.
- 2:04Speaker 1: Sometimes their value can just like plummet super fast. Think
- 2:07Speaker 1: about an online shopping cart someone just abandon right if.
- 2:10Speaker 2: You can ping them with an SMS or an email.
- 2:13Speaker 2: Maybe with a little discount voucher, Like.
- 2:15Speaker 1: Immediately you might get that sale back.
- 2:17Speaker 2: You've got a decent shot. Yeah, but wait, even just
- 2:19Speaker 2: a couple of hours, they've moved.
- 2:20Speaker 1: On, bought somewhere else, or just changed their mind exactly.
- 2:24Speaker 2: The timing that immediate reaction makes all the difference, and
- 2:28Speaker 2: that is the heart of real time analytics or RTA.
- 2:32Speaker 2: It's all about squeezing value from those events basically as
- 2:35Speaker 2: soon as they happen.
- 2:36Speaker 1: The book mentions soft real time. What's that about. Does
- 2:39Speaker 1: that mean it's not quite real time?
- 2:41Speaker 2: Well, yeah, kind of. It just acknowledges that, you know,
- 2:43Speaker 2: perfection is hard. There might be tiny delays milliseconds maybe
- 2:48Speaker 2: seconds because of network latency or system hiccups. It's not instantaneous,
- 2:52Speaker 2: but it's very very close.
- 2:53Speaker 1: Okay, so practical real time. The big difference is compared
- 2:57Speaker 1: to batch processing right batches.
- 2:59Speaker 2: Where you collect data over time maybe an hour, maybe
- 3:02Speaker 2: a day, put it in a big chunk, and then
- 3:04Speaker 2: analyze it.
- 3:05Speaker 1: We used to set up these artificial deadlines. Didn't we
- 3:08Speaker 1: run the report at midnight for yesterday's data.
- 3:11Speaker 2: Yeah, those time boundaries. The problem is your analysis is
- 3:14Speaker 2: always looking backwards, you're getting insights about what was happening.
- 3:17Speaker 1: Which might be stale news by the time you get
- 3:19Speaker 1: it totally.
- 3:21Speaker 2: RTA aims to give you a view of the present,
- 3:23Speaker 2: so your decisions are actually relevant to now.
- 3:25Speaker 1: So our mission for this deep dive drawing from the
- 3:28Speaker 1: book is to really get into those core concepts and
- 3:31Speaker 1: importantly the benefits. What do you actually gain from this?
- 3:35Speaker 2: Let's talk benefits. Then. Speed is obviously a big one.
- 3:39Speaker 2: The book argues it's often a decisive factor. Market leaders
- 3:43Speaker 2: tend to be faster.
- 3:44Speaker 1: Faster at understanding, faster at reacting.
- 3:47Speaker 2: Exactly, and RTA helps achieve that. For one thing, it
- 3:50Speaker 2: can actually open up totally new revenue streams now. So well,
- 3:54Speaker 2: think about turning your real time data itself into a
- 3:56Speaker 2: product offering your end users. Maybe customers the ability to
- 4:00Speaker 2: query data with analytical capabilities almost live. They'd likely pay
- 4:05Speaker 2: for that kind of access.
- 4:06Speaker 1: Ah, interesting, So the insight itself becomes a premium service.
- 4:09Speaker 1: That makes sense. It's not just about making more money, though,
- 4:12Speaker 1: is it. The book talks infrastructure costs too.
- 4:15Speaker 2: Yes, that's a really important one. Traditional BATGE systems often
- 4:18Speaker 2: tie storage and compute together very tightly.
- 4:21Speaker 1: Meaning if your data grows.
- 4:23Speaker 2: Your costs for both storage and the processing power needed
- 4:26Speaker 2: can just explode, often exponentially ouch. But with RTA, you're
- 4:30Speaker 2: processing data more incrementally as it arrives. It sort of
- 4:34Speaker 2: breaks that tight coupling. You don't necessarily need to store
- 4:37Speaker 2: everything forever just to process it later in huge.
- 4:40Speaker 1: Batches, so you avoid building those massive, expensive legacy systems
- 4:44Speaker 1: just for batch jobs.
- 4:45Speaker 2: Potentially, yes, significant cost savings are possible there. You're handling
- 4:49Speaker 2: smaller streams continuously.
- 4:51Speaker 1: Like managing a steady creek instead of building dams for
- 4:55Speaker 1: unpredictable floods. And what about us, the customers? How does
- 4:59Speaker 1: this improve customer experience?
- 5:00Speaker 2: Well, think about customer support. Traditionally it's reactive, Right, you
- 5:04Speaker 2: have a problem, you call their email, They investigate.
- 5:07Speaker 1: And maybe fix it eventually.
- 5:09Speaker 2: Maybe. With RTA, companies can constantly monitor streams of data
- 5:13Speaker 2: usage patterns. ERA logus sensor data looking for anomalies or
- 5:17Speaker 2: signs of trouble.
- 5:18Speaker 1: Ah, so they can spot problems before I even notice them.
- 5:21Speaker 2: That's the goal. They can potentially identify and even resolve
- 5:24Speaker 2: issues proactively automatically, maybe reroute traffic, restart a service, or
- 5:29Speaker 2: even reach out to you before it becomes a major headache.
- 5:32Speaker 1: That sounds much better, moving from reactive firefighting to proactive.
- 5:36Speaker 2: Care exactly, it leads to much higher customer satisfaction. It
- 5:41Speaker 2: feels like the company is actually looking out for you.
- 5:43Speaker 1: Okay, So RTA sounds powerful but also complex. The book
- 5:49Speaker 1: introduces this term the real time analytics ecosystem or stack.
- 5:55Speaker 1: What is that? In simple terms?
- 5:56Speaker 2: Yeah, you'll hear ecosystem, stack, streaming stack. The basic mean
- 6:00Speaker 2: the same thing. It's the whole collection of tools, technologies,
- 6:04Speaker 2: and the processes you use to get from those raw,
- 6:06Speaker 2: unending streams.
- 6:07Speaker 1: Of data to actual insights you can use.
- 6:09Speaker 2: Precisely, it's the entire pipeline, all the components working together.
- 6:13Speaker 1: And why is understanding that whole picture important?
- 6:15Speaker 2: Well, if you're an architect designing these systems, or developer
- 6:19Speaker 2: building the apps, or even an operator keeping it all running,
- 6:22Speaker 2: you need to understand how the pieces fit together.
- 6:24Speaker 1: To make the right choices about tools and how they connect.
- 6:27Speaker 2: Absolutely, it helps you build systems that are robust, scalable,
- 6:30Speaker 2: and actually deliver those real time insights effectively.
- 6:33Speaker 1: Okay. Now, before diving into the modern stack, the book
- 6:37Speaker 1: briefly mentions something called the Lambda architecture. Sounds a bit
- 6:41Speaker 1: I don't know dated.
- 6:43Speaker 2: It is a bit older. Yeah.
- 6:44Speaker 1: Yeah.
- 6:44Speaker 2: It was kind of an early attempt to deal with
- 6:47Speaker 2: having both real time needs and needing accurate historical analysis
- 6:52Speaker 2: on huge data.
- 6:53Speaker 1: Sets, trying to do both at once sort of.
- 6:56Speaker 2: It had three layers, a big, slow batch layer for
- 7:00Speaker 2: processing all the historical data accurately, a fast speed layer
- 7:04Speaker 2: for handling the incoming real time streams providing quick, maybe
- 7:08Speaker 2: slightly less perfect answers. And the third layer a serving
- 7:10Speaker 2: layer that would try to merge the results from both
- 7:12Speaker 2: the batch and speed layers when you actually queried the system.
- 7:15Speaker 1: Okay, so it tried to give you fast answers and
- 7:17Speaker 1: eventually correct complete answers. What was the upside?
- 7:20Speaker 2: The main benefit was that your original raw data was
- 7:23Speaker 2: kept safe and sound in the batch layer, so if
- 7:26Speaker 2: you messed up your processing logic or wanted to try
- 7:28Speaker 2: a new analysis.
- 7:29Speaker 1: You could always go back and rerun it on the
- 7:30Speaker 1: original data exactly. Data I mutability was a plus, But
- 7:36Speaker 1: I sense a butt coming. The book implies it wasn't
- 7:39Speaker 1: the perfect solution. What were the drawbacks?
- 7:42Speaker 2: There were quite a few. Actually, First, it was complex.
- 7:45Speaker 2: You essentially had to build and maintain two separate data pipelines,
- 7:49Speaker 2: Batch and speed. That's a lot of engineering.
- 7:52Speaker 1: Effort, double the work, potentially double the problem pretty much.
- 7:55Speaker 2: Also, many early stream processors relied heavily on the JVM,
- 7:59Speaker 2: the Java Virtual Mass, which was fine if you were
- 8:01Speaker 2: a Java shop, but maybe less ideal otherwise.
- 8:04Speaker 1: Fender lock in or skill set mismatch.
- 8:07Speaker 2: Yeah, and maybe the biggest headache was often having to
- 8:10Speaker 2: write and maintain the same or very similar processing logic
- 8:14Speaker 2: in both the batch and the speed layers.
- 8:16Speaker 1: Duplication. That sounds like a nightmare for consistency and updates,
- 8:19Speaker 1: it really was.
- 8:20Speaker 2: Keeping them perfectly in sync was hard, leading to potential
- 8:23Speaker 2: inconsistencies in the final results. So yeah, lots of overhead
- 8:27Speaker 2: and complexity.
- 8:27Speaker 1: Okay, so LAMB deserved a purpose, But we've move on.
- 8:30Speaker 1: What does a more modern real time analytics stack look like?
- 8:34Speaker 1: What are the essential pieces?
- 8:36Speaker 2: Right? The contemporary approach is generally more streamlined. It typically
- 8:39Speaker 2: starts with event producers.
- 8:40Speaker 1: The things generating the data in the first place.
- 8:42Speaker 2: Exactly, systems that detect something happen to state change and
- 8:46Speaker 2: fire off an event. Like an order management system sees
- 8:50Speaker 2: a new order and generates an order received event, and that.
- 8:52Speaker 1: Event contains the details like order ID, customer info items.
- 8:57Speaker 2: All the relevant data and A key thing here mentioned
- 9:00Speaker 2: in the book is you really need to benchmark your
- 9:03Speaker 2: producers make sure they can actually handle the volume and
- 9:07Speaker 2: speed of events you expect without becoming a bottleneck. Scalability
- 9:12Speaker 2: and latency are critical right from the start.
- 9:14Speaker 1: Okay, makes sense, The source needs to keep up. Where
- 9:16Speaker 1: do those events go next?
- 9:18Speaker 2: They flow into the event streaming platform. This is like
- 9:20Speaker 2: the central highway or message bus for all your events.
- 9:23Speaker 2: The backbone, yeah, exactly. Its job is to ingest potentially
- 9:27Speaker 2: huge volumes of events, store them reliably, usually for some
- 9:31Speaker 2: configurable period, and deliver them to whatever needs to consume them.
- 9:34Speaker 2: A patch Kafka is probably the most well known example here.
- 9:36Speaker 1: Right, Kofka comes up a lot. What makes a good
- 9:39Speaker 1: streaming platform?
- 9:41Speaker 2: Key things are scalability, Can it handle growth? Fault tolerance?
- 9:45Speaker 2: Does it lose data if a server fails? High throughput?
- 9:49Speaker 2: Can it handle a massive continuous flow and low latency?
- 9:53Speaker 2: How quickly does data get through? Got it?
- 9:56Speaker 1: So? Data producers feed events onto this Sofka like highway?
- 10:02Speaker 2: Then what then? You typically have a stream processing platform
- 10:05Speaker 2: This is where the real time analysis starts happening.
- 10:07Speaker 1: This is where the magic happens, well.
- 10:08Speaker 2: Some of it. This is where you take those raw
- 10:10Speaker 2: event streams and transform them, maybe enrich them by joining
- 10:13Speaker 2: them with other data streams or static data filter them,
- 10:17Speaker 2: aggregate them, run calculations. Basically turn raw data into intermediate insights.
- 10:22Speaker 1: Can you give examples of tools here?
- 10:24Speaker 2: Sure. Popular ones include a Patche flink, which is a
- 10:26Speaker 2: powerful stream processing framework. There's also a Patche Spark streaming,
- 10:30Speaker 2: which extends the Spark batch engine for streaming, and Kaffka streams,
- 10:34Speaker 2: which is a library that lets you build stream processing
- 10:36Speaker 2: apps directly on top of Kafka.
- 10:38Speaker 1: What are the important features for these stream processors?
- 10:41Speaker 2: You need things like good state management because your analysis
- 10:44Speaker 2: often depends on past events when doing capabilities for doing
- 10:48Speaker 2: calculations over specific time periods like the last five minutes.
- 10:52Speaker 2: Fault tolerance obviously so processing doesn't stop if something breaks,
- 10:56Speaker 2: and support for different data formats okay.
- 11:00Speaker 1: Using happens insights are generated, how do we actually use
- 11:03Speaker 1: them or see them?
- 11:04Speaker 2: That's the final piece, usually the serving layer. This is
- 11:08Speaker 2: the system that stores the results of your real time
- 11:10Speaker 2: processing and makes them available for querying fast.
- 11:13Speaker 1: This is what applications or dashboards actually talk to exactly.
- 11:17Speaker 2: It's the primary access point. Now, this serving layer could
- 11:20Speaker 2: be a few different types of systems like what It
- 11:23Speaker 2: could be a fast key value store think Mango dB,
- 11:26Speaker 2: maybe elastic search or rettis. These are great if you
- 11:29Speaker 2: primarily need to look up results based on a specific key,
- 11:32Speaker 2: like getting the current status for a particular user.
- 11:35Speaker 1: ID quick lookups. What's the alternative?
- 11:37Speaker 2: The alternative, especially for more complex analytics, is a real
- 11:41Speaker 2: time ol APP database. Ol app stands for online analytical processing.
- 11:45Speaker 1: Ah okay designed for analysis right.
- 11:48Speaker 2: Tools like a Pacupine, Apache, Druid, rock Set, or ClickHouse
- 11:52Speaker 2: fall into this category. They are built for slicing and
- 11:55Speaker 2: dicing data, running aggregations, filtering across lots of dimensions, much
- 12:00Speaker 2: more complex queries than just a key lookup.
- 12:02Speaker 1: So if I want to see, say, sales trends by
- 12:04Speaker 1: region and product category for the last hour, I'd want
- 12:07Speaker 1: an ol APP database.
- 12:09Speaker 2: Generally, Yes, that's where they shine. The crucial thing for
- 12:12Speaker 2: any serving layer in this context is speed. You need
- 12:16Speaker 2: really fast data ingestion. The results from the stream processor
- 12:19Speaker 2: need to show up almost instantly, and query latency needs
- 12:23Speaker 2: to be low often in the.
- 12:24Speaker 1: Millisecond well, well seconds again.
- 12:25Speaker 2: Wow yeah, and it also needs to handle high concurrency,
- 12:28Speaker 2: potentially thousands or even hundreds of thousands of queries per
- 12:30Speaker 2: second depending on the application.
- 12:32Speaker 1: That's incredible scale. How do you choose between key value
- 12:34Speaker 1: and real time ol app beyond just the query type?
- 12:38Speaker 2: Well, query type is the main driver, but you also
- 12:41Speaker 2: look at how data gets in. Does it support direct
- 12:44Speaker 2: streaming ingestion from COFKA or flink or do you need
- 12:48Speaker 2: an extra step? How fast is that ingestion? Really? Can
- 12:51Speaker 2: it handle your expected data volume and rate? Does it
- 12:54Speaker 2: need complex indexing or pre aggregation to meet your query
- 12:57Speaker 2: speed goals? Lots to consider, definitely, and the book makes
- 13:00Speaker 2: a very sensible point. Don't just trust the marketing hype.
- 13:04Speaker 2: Do your own benchmarking with your own data and query patterns.
- 13:07Speaker 2: See what actually works best for your specific needs.
- 13:10Speaker 1: Test it yourself. Always good advice. Okay, so we have producers,
- 13:13Speaker 1: the streaming platform, the process, or the serving layer. How
- 13:17Speaker 1: do people like actual users see this stuff?
- 13:19Speaker 2: Ah, the front end? Good point. If your users are
- 13:22Speaker 2: internal like data analysts or engineers, maybe they querry the
- 13:25Speaker 2: serving layer directly using SQL or an.
- 13:27Speaker 1: API okay, But for less technical users or external customer.
- 13:31Speaker 2: Then you'll likely need a user interface a front end,
- 13:34Speaker 2: and you've got a few options here.
- 13:36Speaker 1: What are they?
- 13:36Speaker 2: You could go fully custom build your own web application
- 13:39Speaker 2: using standard tools like react as Angular viewjas gives you
- 13:44Speaker 2: total control over the look, feel, and functionality.
- 13:47Speaker 1: The Highffert high control option. What else?
- 13:49Speaker 2: Then there are low code frameworks, things like Streamlet or plotly,
- 13:52Speaker 2: dash or popular especially in the Python world. They let
- 13:55Speaker 2: you build interactive dashboards and web apps with much less
- 13:59Speaker 2: front end coding effort.
- 14:00Speaker 1: Faster development, maybe, less customization generally yes.
- 14:04Speaker 2: And the third category is data visualization tools they ca Apache, Superset, redash, Grfauna.
- 14:10Speaker 2: These often provide drag and drop interfaces to build dashboards
- 14:13Speaker 2: directly on top of your data sources, often with no
- 14:16Speaker 2: coding required at all.
- 14:17Speaker 1: The quickest way to get a dashboard up.
- 14:19Speaker 2: Often yes, So how you choose depends on a few things.
- 14:22Speaker 2: What's the front end coding skill level of your team,
- 14:25Speaker 2: how much time do you realistically have, and who are
- 14:28Speaker 2: the user's internal experts or external customers needing a polished experience.
- 14:32Speaker 1: A spectrum of choices matching needs and resources makes sense
- 14:36Speaker 1: now the book also notes that sometimes the lines between
- 14:39Speaker 1: these components get fuzzy.
- 14:40Speaker 2: Yeah, technology evolves and tools sometimes wear multiple hats. Apache
- 14:44Speaker 2: Pulsar is a good examples, mainly an event streaming platform
- 14:48Speaker 2: like Kafka, but it also has built in capabilities called
- 14:52Speaker 2: Pulsar functions that let you do some lightweight stream processing
- 14:56Speaker 2: directly within Pulsar itself.
- 14:57Speaker 1: Ah, so the streaming platform is doing some processing tasks exactly.
- 15:01Speaker 2: It blurs the line a bit between the streaming platform
- 15:04Speaker 2: and the stream processing platform. It just shows that these
- 15:07Speaker 2: categories aren't always rigid silos. The landscape is pretty dynamic.
- 15:11Speaker 1: Okay, that's a great tour through the stack. So wrapping
- 15:14Speaker 1: up this main section, what's the big takeaway from the
- 15:17Speaker 1: book about building these systems?
- 15:18Speaker 2: I think the fundamental message is that embracing real time
- 15:22Speaker 2: analytics isn't just a technical upgrade. It's a strategic move
- 15:26Speaker 2: that can give you a serious competitive.
- 15:28Speaker 1: Edge by making you faster, more informed.
- 15:31Speaker 2: And ultimately making more accurate, relevant decisions because you're acting
- 15:35Speaker 2: on what's happening now, not what happened yesterday.
- 15:38Speaker 1: Fantastic, and this deep dive has been really an introduction.
- 15:42Speaker 1: We've touched on the core ideas, the benefits those key
- 15:45Speaker 1: building blocks of the RTA stack all pulled from the
- 15:48Speaker 1: insights in building real time analytics systems.
- 15:51Speaker 2: Absolutely, it just scratches the surface, but hopefully gives you
- 15:53Speaker 2: a solid foundation.
- 15:55Speaker 1: So a final thought for you, the listener to chew on,
- 15:58Speaker 1: think about your own work, your own organization. Where could
- 16:02Speaker 1: real time analytics unlock something new, maybe a new data
- 16:06Speaker 1: product or a way to significantly improve a process you
- 16:09Speaker 1: already have.
- 16:10Speaker 2: Yeah, ask yourself, what's the current shelf life of your data?
- 16:14Speaker 2: Is its value decaying rapidly? What can you gain by
- 16:17Speaker 2: acting on it immediately? And maybe think about that stack.
- 16:20Speaker 2: We discussed producers, streaming, processing, serving front end. Which piece
- 16:25Speaker 2: might offer the biggest immediate win for your specific situation?
- 16:29Speaker 1: Something to definitely consider. Where could that immediate incite make
- 16:32Speaker 1: the biggest difference