Learning Library

← Back to Library

Decoupling Cloud Applications with Kafka

Key Points

  • Real‑time experiences in modern cloud apps are delivered by Apache Kafka, an open‑source distributed streaming platform that continuously produces and consumes data streams.
  • Kafka’s clustered architecture provides high throughput, ordered record handling, strong data accuracy, replication, and fault‑tolerance, ensuring low‑latency performance at scale.
  • Traditional monolithic integrations (e.g., checkout → shipment) become cumbersome as applications grow, creating tight inter‑service dependencies and slowing development.
  • By streaming events (e.g., checkout events) that any service can subscribe to, Kafka cleanly decouples system components, eliminating complex point‑to‑point integrations.
  • This event‑driven, message‑based approach works both for retrofitting existing applications and for building cloud‑native services from the ground up.

Full Transcript

# Decoupling Cloud Applications with Kafka **Source:** [https://www.youtube.com/watch?v=aj9CDZm0Glc](https://www.youtube.com/watch?v=aj9CDZm0Glc) **Duration:** 00:09:16 ## Summary - Real‑time experiences in modern cloud apps are delivered by Apache Kafka, an open‑source distributed streaming platform that continuously produces and consumes data streams. - Kafka’s clustered architecture provides high throughput, ordered record handling, strong data accuracy, replication, and fault‑tolerance, ensuring low‑latency performance at scale. - Traditional monolithic integrations (e.g., checkout → shipment) become cumbersome as applications grow, creating tight inter‑service dependencies and slowing development. - By streaming events (e.g., checkout events) that any service can subscribe to, Kafka cleanly decouples system components, eliminating complex point‑to‑point integrations. - This event‑driven, message‑based approach works both for retrofitting existing applications and for building cloud‑native services from the ground up. ## Sections - [00:00:00](https://www.youtube.com/watch?v=aj9CDZm0Glc&t=0s) **Apache Kafka Enables Real‑Time Streaming** - Whitney Lee describes how Kafka’s distributed, fault‑tolerant, ordered streaming architecture delivers low‑latency, high‑volume data processing for modern cloud applications, contrasting it with legacy integration approaches. - [00:03:17](https://www.youtube.com/watch?v=aj9CDZm0Glc&t=197s) **Kafka Use Cases: Decoupling, Tracking, Analytics** - The speaker explains how Kafka streams events such as checkout actions, ride‑share driver locations, and user activity, allowing independent services to subscribe and react, thereby illustrating decoupled architecture, real‑time tracking, and analytics collection. - [00:06:34](https://www.youtube.com/watch?v=aj9CDZm0Glc&t=394s) **Kafka APIs Overview and Integration** - The passage outlines Kafka’s consumer, streams, and connector APIs, explaining how persistent topics are consumed, transformed in real time, and how reusable connectors simplify integrating external data sources. ## Full Transcript
0:00Users of modern day cloud applications expect a real-time experience. 0:05How is this achieved? 0:07My name is Whitney Lee, I'm a cloud developer here at IBM. 0:11Apache Kafka is an open source, distributed streaming platform 0:16that allows for the development of real-time event-driven applications. 0:21Specifically, it allows developers to make applications that continuously produce 0:28and consume streams of data records. 0:33Now, Kafka is distributed. 0:37It runs as a cluster that can span multiple servers or even multiple data centers. 0:43The records that are produced are replicated and partitioned in such a way 0:49that allows for a high volume of users to use the application simultaneously 0:55without any perceptible lag in performance. 0:59So, with that, Apache Kafka is super fast. 1:04It also maintains a very high level of accuracy with the data records, 1:13- and Apache Kafka maintains the order of their occurrence, 1:24and, finally, because it's replicated, 1:27Apache Kafka is also resilient and fault-tolerant. 1:33So, these characteristics all together add up to an extremely powerful platform. 1:41Let's talk about some use-cases for this. 1:44Or, actually, before we do, let's talk about how applications used to be made 1:48before event streaming was on the scene. 1:52If the developer wanted to make a retail application, for example, 1:56they would might make a checkout, 2:00and then, with that checkout, when it happens, they want it to trigger a shipment. 2:07So, a user checks out and then the order gets shipped. 2:11They need to write an integration for that to happen, 2:14consider the shape of the data, 2:16the way the data is transported, and the format of the data, 2:19but it's only one integration, so it's not a huge deal. 2:22But, as the application grows, maybe we want to add 2:26an automated email receipt when a checkout happens, 2:30or maybe we want to add an update to the inventory 2:34when a checkout happens. 2:36As front and back end services get added, and the application grows, 2:42more and more integrations need to get built and it can get very messy. 2:46Not only that, but the teams in charge of each of the services 2:50are now reliant upon each other before they can make any changes 2:53and development is slow. 2:56So, one great use case for Apache Kafka is decoupling system dependencies. 3:05So, with Apache Kafka, all the hard integrations go away 3:12and, instead, what we do is the checkout will stream events. 3:17So, every time a checkout happens, that will get streamed, 3:21and the checkout is not concerned with who's listening to that stream. 3:25It's broadcasting those events. 3:27Then the other services - email, shipment, inventory, 3:30they subscribe to that stream, they choose to listen to that one, 3:34and then they get the information they need and it triggers them to act accordingly. 3:39So, this is how Kafka can decouple your system dependencies 3:43and it is also a good use-case for how Kafka can be used for messaging. 3:50So, even if this application was built from the ground up 3:53as a cloud-native application, it could still be built in this way, 3:57and use messaging to move the checkout experience along. 4:05Another use case for Apache Kafka could be location tracking. 4:14An example of this might be a ride share service. 4:19So, a driver in a ride share service using the application 4:24would turn on their app and maybe every, let's say, every second 4:29a new event would get admitted with their current location. 4:33This can be used by the application on a smaller scale, 4:36say, to let an individual user know how close their particular ride is 4:41or on a large scale, to calculate surge pricing, 4:44to show a user a map before they choose which ride they want. 4:50Another way to use Apache Kafka, another use-case 4:55would be data gathering. 5:00This can be used 5:04in a simple way just to collect analytics, to optimize your website, 5:09or it can be used more in a more complex way 5:11with a a music streaming service, for example. 5:14Where one user, every song they listen to can be a stream of records, 5:19and your application could use that stream 5:22to give real-time recommendations to that user. 5:25Or, it can take the data records from all the users, 5:30aggregate them, and then come up with a list of an artist's top songs. 5:35So, this is in no way exhaustive, 5:37but these are some very interesting use-cases 5:40to show how powerful Kafka is and ways things that you can do with it, 5:45but let's give an overview of how Kafka works. 5:49Kafka is built on four core APIs. 5:54The first one is the "producer" API. 6:00The producer API 6:04allows your application to produce, to make, these streams of data. 6:09So, it creates the records and produces them to topics. 6:16A "topic" is an ordered list of events. 6:20Now the topic can persist to disk - 6:24that's where it can be saved for just a matter of minutes if it's going to be consumed immediately 6:30or you can have it saved for hours, days, or even forever. 6:34As long as you have enough storage space that the topics are persisted to physical storage. 6:41Then we have the consumer API. 6:47The consumer API subscribes to one or more topics 6:54and listens and ingests that data. 6:58It can subscribe to topics in real time 7:01or it can consume those old data records that are saved to the topic. 7:08Now producers can produce directly to consumers 7:12and that works for a simple Kafka application where the data doesn't change, 7:17but to transform that data, what we need is the streams API. 7:25The streams API is very powerful. 7:30It leverages the producer and the consumer APIs. 7:35So, it will consume from a topic or topics 7:40and then it will analyze, aggregate, or otherwise transform the data 7:48in real time, and then produce the resulting streams 7:54to a topic - either the same topics or to new topics. 8:00This is really at the core of what makes Kafka so amazing, and what powers 8:06the more complex use-cases like the location tracking or the data gathering. 8:11Finally, we have the connector API. 8:18The connector API enables developers to write connectors, 8:23which are reusable producers and consumers. 8:26So, in a Kafka cluster many developers 8:29might need to integrate the same type of data source, 8:32like a MongoDB, for example. 8:34Well, not every single developer should have to write that integration, 8:38what the connector API allows 8:40is for that integration to get written once, the code is there, 8:44and then all the developer needs to do is configure it 8:46in order to get that data source into their cluster. 8:50So, modern day cloud application users expect a real-time experience 8:56and Kafka is what's behind that technology. 8:59Thank you! If you have questions please drop us a line below. 9:03If you want to see more videos like this in the future 9:06please like and subscribe 9:07and don't forget: 9:08you can grow your skills and earn a badge with IBM Cloud Labs 9:13which are free, browser-based interactive Kubernetes labs.