﻿WEBVTT

1
00:00:01.424 --> 00:00:02.768
<v ->What's the big deal about Kafka</v>

2
00:00:02.768 --> 00:00:04.253
and what sorts of problems does it solve?

3
00:00:05.121 --> 00:00:06.720
Let's learn how Kafka streams massive data sets

4
00:00:06.720 --> 00:00:09.190
and explore some real world use cases of Kafka

5
00:00:10.275 --> 00:00:11.108
in action right now.

6
00:00:12.435 --> 00:00:15.102
(upbeat music)

7
00:00:16.248 --> 00:00:17.603
Hi, I am Frank Kane from Sundog Education.

8
00:00:18.635 --> 00:00:20.460
I spent nine years building distributed systems at Amazon

9
00:00:20.460 --> 00:00:21.910
and now I'm teaching hundreds

10
00:00:22.835 --> 00:00:24.682
of thousands of people around the world

11
00:00:24.682 --> 00:00:26.532
how to manage massive data sets.

12
00:00:26.532 --> 00:00:28.872
In this video, we're introducing Kafka

13
00:00:28.872 --> 00:00:30.720
and how it reliably streams data between your servers,

14
00:00:30.720 --> 00:00:32.940
applications and databases.

15
00:00:32.940 --> 00:00:33.963
To make it real,

16
00:00:34.931 --> 00:00:37.560
we'll talk about several use cases of Kafka in action

17
00:00:38.988 --> 00:00:40.643
and understand how Kafka solves real world problems,

18
00:00:41.494 --> 00:00:43.103
anti couples, the systems in your organization.

19
00:00:43.989 --> 00:00:47.005
This is just the first of a series of videos on Kafka.

20
00:00:47.005 --> 00:00:49.680
Subsequent videos will walk you through hands-on exercises

21
00:00:50.632 --> 00:00:52.523
of using Kafka with a variety of other platforms.

22
00:00:53.829 --> 00:00:55.397
Since setting up a Kafka cluster

23
00:00:55.397 --> 00:00:58.035
of your own can be a complex and expensive proposition,

24
00:00:58.035 --> 00:00:59.970
we're going to use a service called Upstash,

25
00:00:59.970 --> 00:01:02.590
which is a serverless cloud-based Kafka service

26
00:01:03.635 --> 00:01:05.100
with a generous free tier we can use.

27
00:01:05.100 --> 00:01:06.960
So stick around to the end of this video

28
00:01:06.960 --> 00:01:09.060
and I'll walk you through setting up a Kafka cluster

29
00:01:09.060 --> 00:01:10.860
using Upstash for free.

30
00:01:10.860 --> 00:01:13.860
You'll need that for the other videos in this series.

31
00:01:13.860 --> 00:01:17.010
So let's dive in and learn about streaming data, Kafka

32
00:01:17.010 --> 00:01:19.833
and the problems Kafka and Upstash can solve.

33
00:01:24.930 --> 00:01:27.240
Let's dive into the world of Kafka and Upstash

34
00:01:27.240 --> 00:01:28.490
and streaming in general.

35
00:01:29.352 --> 00:01:31.350
Again, I am Frank Kane with SunDog Education,

36
00:01:31.350 --> 00:01:32.790
and let's dive in just talking about

37
00:01:32.790 --> 00:01:34.290
streaming in general, shall we?

38
00:01:34.290 --> 00:01:35.880
So what is streaming, what's it all about?

39
00:01:35.880 --> 00:01:37.380
What are we trying to do here?

40
00:01:37.380 --> 00:01:39.540
Well, streaming basically answers the question

41
00:01:39.540 --> 00:01:41.430
of how does data get into your cluster,

42
00:01:41.430 --> 00:01:43.350
especially if it's a massive amount of data

43
00:01:43.350 --> 00:01:45.000
that's just coming all the time

44
00:01:45.000 --> 00:01:46.477
and being generated all the time.

45
00:01:46.477 --> 00:01:49.860
And by a cluster, I mean potentially many different systems.

46
00:01:49.860 --> 00:01:50.943
That could be a database cluster,

47
00:01:50.943 --> 00:01:53.130
it could be a analytics cluster,

48
00:01:53.130 --> 00:01:55.020
it could be a cluster of computers

49
00:01:55.020 --> 00:01:58.080
that are processing the data like Apache Spark or something.

50
00:01:58.080 --> 00:01:59.580
Some examples of big data

51
00:01:59.580 --> 00:02:02.310
that might be streaming are log entries being generated

52
00:02:02.310 --> 00:02:04.230
by web applications or web servers

53
00:02:04.230 --> 00:02:05.970
or maybe even mobile apps.

54
00:02:05.970 --> 00:02:07.590
In the world of the internet of things,

55
00:02:07.590 --> 00:02:09.360
maybe it refers to sensor data

56
00:02:09.360 --> 00:02:11.940
that's continually being generated by sensors.

57
00:02:11.940 --> 00:02:14.490
Maybe they're detecting stresses on a bridge

58
00:02:14.490 --> 00:02:16.653
or manufacturing things, stuff like that.

59
00:02:16.653 --> 00:02:18.810
Or maybe you're monitoring stock trades

60
00:02:18.810 --> 00:02:20.640
that are coming in throughout the day continuously.

61
00:02:20.640 --> 00:02:23.306
So that would also be a example of streaming data.

62
00:02:23.306 --> 00:02:26.070
So streaming data systems allow you

63
00:02:26.070 --> 00:02:28.709
to publish this data in real time to a cluster of some sort

64
00:02:28.709 --> 00:02:32.520
for further storage or processing or analytics.

65
00:02:32.520 --> 00:02:35.250
And it can even process that data as it's received.

66
00:02:35.250 --> 00:02:37.260
So as raw data is being streamed

67
00:02:37.260 --> 00:02:39.330
into a new system along the way,

68
00:02:39.330 --> 00:02:42.360
you can apply processing it to it to cleanse the data,

69
00:02:42.360 --> 00:02:45.060
maybe change its format, make it a little bit more amenable

70
00:02:45.060 --> 00:02:47.040
to what you're trying to do with it.

71
00:02:47.040 --> 00:02:48.510
So whenever you're streaming data,

72
00:02:48.510 --> 00:02:50.550
there's basically two problems at a high level.

73
00:02:50.550 --> 00:02:53.047
One is how to get the data from all those different sources

74
00:02:53.047 --> 00:02:54.427
flowing into your cluster.

75
00:02:54.427 --> 00:02:58.556
And secondly, how do I process that data once it gets there?

76
00:02:58.556 --> 00:03:01.530
Well, Kafka solves those problems and then some.

77
00:03:01.530 --> 00:03:03.561
So we're talking about Apache Kafka here.

78
00:03:03.561 --> 00:03:05.970
Kafka is a general purpose

79
00:03:05.970 --> 00:03:07.787
publish subscribe messaging system.

80
00:03:07.787 --> 00:03:11.550
So that means that Kafka servers, you have an entire cluster

81
00:03:11.550 --> 00:03:13.830
of Kafka servers and they can sit there

82
00:03:13.830 --> 00:03:16.200
and receive messages from publishers

83
00:03:16.200 --> 00:03:17.970
for some period of time.

84
00:03:17.970 --> 00:03:19.740
And that data will then be published

85
00:03:19.740 --> 00:03:21.450
to consumers of that data.

86
00:03:21.450 --> 00:03:24.960
It will stream that data across what's called a topic.

87
00:03:24.960 --> 00:03:27.270
So data that's being streamed into Kafka

88
00:03:27.270 --> 00:03:29.580
from publishers are organized into topics.

89
00:03:29.580 --> 00:03:32.070
Consumers can subscribe to those topics

90
00:03:32.070 --> 00:03:35.223
and receive data that are published into that topic name.

91
00:03:37.320 --> 00:03:39.420
We call those consumers in the world of Kafka.

92
00:03:39.420 --> 00:03:42.480
And a consumer, again, subscribes to one or more topics

93
00:03:42.480 --> 00:03:44.160
and will receive that data.

94
00:03:44.160 --> 00:03:45.450
It can be as it's published,

95
00:03:45.450 --> 00:03:48.210
but it can actually doesn't have to be in real time.

96
00:03:48.210 --> 00:03:49.690
So the cool thing about Kafka

97
00:03:50.600 --> 00:03:51.870
is that you can actually have multiple consumers

98
00:03:51.870 --> 00:03:54.210
that are consuming the data from that topic

99
00:03:54.210 --> 00:03:56.430
at different rates or at different times.

100
00:03:56.430 --> 00:03:58.470
So it's not the case like in some other systems

101
00:03:58.470 --> 00:04:00.090
where one's data is published,

102
00:04:00.090 --> 00:04:03.142
if your subscribers isn't sitting there waiting

103
00:04:03.142 --> 00:04:03.975
for it immediately, it's gonna go away.

104
00:04:03.975 --> 00:04:06.810
No, Kafka will hang onto that data for some period of time

105
00:04:06.810 --> 00:04:09.390
and actually store it so that if you have consumers

106
00:04:09.390 --> 00:04:10.770
that are only hitting it periodically

107
00:04:10.770 --> 00:04:13.440
or at different rates, they will all still be guaranteed

108
00:04:13.440 --> 00:04:15.240
to get that data back no matter

109
00:04:15.240 --> 00:04:17.280
how they did it or when they did it.

110
00:04:17.280 --> 00:04:19.710
So you can have different consumers that are subscribing

111
00:04:19.710 --> 00:04:22.560
to a topic all with their own unique positions in the stream

112
00:04:22.560 --> 00:04:25.020
that are maintained individually.

113
00:04:25.020 --> 00:04:27.270
How does this look architecturally?

114
00:04:27.270 --> 00:04:29.700
So at this big box in the middle is gonna be representing

115
00:04:29.700 --> 00:04:31.095
our entire Kafka cluster.

116
00:04:31.095 --> 00:04:33.270
And again, remember that can be many, many servers

117
00:04:33.270 --> 00:04:35.520
and we'll talk about how that scales in a moment.

118
00:04:35.520 --> 00:04:38.640
But conceptually, there's a Kafka cluster that receives

119
00:04:38.640 --> 00:04:41.100
and distributes all this data around.

120
00:04:41.100 --> 00:04:43.410
At the top we have one or more producers,

121
00:04:43.410 --> 00:04:45.270
and these could be different apps,

122
00:04:45.270 --> 00:04:46.470
they could be a bunch of different things,

123
00:04:46.470 --> 00:04:48.480
publishing data on different topics,

124
00:04:48.480 --> 00:04:51.060
but fundamentally they are feeding data into your cluster

125
00:04:51.060 --> 00:04:53.100
that you want to be distributed out to consumers.

126
00:04:53.100 --> 00:04:55.410
At the end of the day, those consumers here

127
00:04:55.410 --> 00:04:57.030
in the diagram are on the bottom.

128
00:04:57.030 --> 00:04:58.620
Again, various applications

129
00:04:58.620 --> 00:05:01.170
and there are many, many different ways of connecting Kafka

130
00:05:01.170 --> 00:05:03.000
to different types of systems.

131
00:05:03.000 --> 00:05:04.410
Throughout this series of videos,

132
00:05:04.410 --> 00:05:06.688
we're going to look at a wide variety of different systems

133
00:05:06.688 --> 00:05:08.748
that we can actually integrate Kafka into,

134
00:05:08.748 --> 00:05:12.510
using its very extensible frameworks.

135
00:05:12.510 --> 00:05:14.160
We're specifically going to be using a system

136
00:05:14.160 --> 00:05:15.480
called Upstash Kafka,

137
00:05:15.480 --> 00:05:17.250
and we'll talk about that more in a moment.

138
00:05:17.250 --> 00:05:20.430
But it gives you a rest interface as well as an SDK

139
00:05:20.430 --> 00:05:22.740
that makes it very easy to integrate that into a variety

140
00:05:22.740 --> 00:05:24.150
of different applications,

141
00:05:24.150 --> 00:05:26.640
both for publishing data into it as a producer

142
00:05:26.640 --> 00:05:30.720
and for consuming data from the Kafka cluster as a consumer.

143
00:05:30.720 --> 00:05:33.780
Now you can also extend Kafka in other different ways too.

144
00:05:33.780 --> 00:05:35.370
You can have what's called connectors.

145
00:05:35.370 --> 00:05:37.140
You see that off to the side here

146
00:05:37.140 --> 00:05:38.820
where the Kafka cluster can communicate

147
00:05:38.820 --> 00:05:40.530
with external databases.

148
00:05:40.530 --> 00:05:43.274
Say for example, your producers are just sending

149
00:05:43.274 --> 00:05:44.107
in a compact stream of data

150
00:05:44.107 --> 00:05:45.769
where you only have item identifiers

151
00:05:45.769 --> 00:05:48.270
for things that you're trying to sell, for example,

152
00:05:48.270 --> 00:05:49.710
maybe you have an external database

153
00:05:49.710 --> 00:05:52.380
that maps those identifiers to actual product names

154
00:05:52.380 --> 00:05:54.900
or other information about those items that you want

155
00:05:54.900 --> 00:05:56.730
to pass on to the consumers.

156
00:05:56.730 --> 00:05:58.260
Your database connector might be able to go out

157
00:05:58.260 --> 00:06:01.650
and retrieve that data while that data is being streamed.

158
00:06:01.650 --> 00:06:03.330
You can also write out to databases as well

159
00:06:03.330 --> 00:06:04.410
through those connectors as well.

160
00:06:04.410 --> 00:06:05.790
So if you look closely, you'll see

161
00:06:05.790 --> 00:06:08.448
that I have arrows going in both directions there.

162
00:06:08.448 --> 00:06:11.310
Off to the right, we have stream processors

163
00:06:11.310 --> 00:06:12.750
that are indicated as well.

164
00:06:12.750 --> 00:06:14.100
These are bi-directional things

165
00:06:14.100 --> 00:06:16.111
that we can just bolt onto Kafka, if you will,

166
00:06:16.111 --> 00:06:18.720
and they're able to process that data

167
00:06:18.720 --> 00:06:20.520
and transform it as it's received

168
00:06:20.520 --> 00:06:22.170
through these external applications.

169
00:06:22.170 --> 00:06:24.660
So an external stream processor can attach

170
00:06:24.660 --> 00:06:27.270
to a Kafka cluster, listen to one or more topics,

171
00:06:27.270 --> 00:06:30.660
and transform that data in real time before it's transmitted

172
00:06:30.660 --> 00:06:32.327
and pushed out to the consumers.

173
00:06:32.327 --> 00:06:35.100
And remember, again, there are many topics here.

174
00:06:35.100 --> 00:06:37.470
Many applications may be here going on at once.

175
00:06:37.470 --> 00:06:40.050
That one Kafka cluster can handle it all.

176
00:06:40.050 --> 00:06:42.235
It can handle data from multiple types of producers,

177
00:06:42.235 --> 00:06:44.176
multiple types of consumers,

178
00:06:44.176 --> 00:06:45.960
all broadcasting different types

179
00:06:45.960 --> 00:06:47.889
of information maybe on different topics.

180
00:06:47.889 --> 00:06:50.946
So let's dive inside that box in the middle,

181
00:06:50.946 --> 00:06:52.590
the actual Kafka cluster.

182
00:06:52.590 --> 00:06:54.264
How does Kafka actually scale?

183
00:06:54.264 --> 00:06:56.970
So in this diagram here, we're kind of showing

184
00:06:56.970 --> 00:06:59.781
how that cluster might be consisting of different servers

185
00:06:59.781 --> 00:07:01.320
and within those servers

186
00:07:01.320 --> 00:07:03.631
they might actually have different partitions as well.

187
00:07:03.631 --> 00:07:06.120
It might be running on different processes as well.

188
00:07:06.120 --> 00:07:08.070
So we're distributing the work

189
00:07:08.070 --> 00:07:10.890
of that cluster across different processes on each server

190
00:07:10.890 --> 00:07:12.900
and also on different partitions on each server

191
00:07:12.900 --> 00:07:14.520
for storing the data itself.

192
00:07:14.520 --> 00:07:16.500
And this is important for scalability.

193
00:07:16.500 --> 00:07:17.880
By having things broken up this way,

194
00:07:17.880 --> 00:07:20.160
it means we can do more stuff in parallel, right?

195
00:07:20.160 --> 00:07:22.740
By having our data stored in many different partitions,

196
00:07:22.740 --> 00:07:24.660
it makes it much more efficient to write

197
00:07:24.660 --> 00:07:26.527
or read from those individual partitions

198
00:07:26.527 --> 00:07:28.410
at the same time as other partitions.

199
00:07:28.410 --> 00:07:31.830
So it gives us more concurrency by splitting things up.

200
00:07:31.830 --> 00:07:33.000
Also, remember that's important

201
00:07:33.000 --> 00:07:35.280
from a resiliency standpoint as well.

202
00:07:35.280 --> 00:07:37.535
So as data's being published into my Kafka cluster,

203
00:07:37.535 --> 00:07:40.230
if I write that out to multiple partitions

204
00:07:40.230 --> 00:07:42.253
on different servers, if one server goes down,

205
00:07:42.253 --> 00:07:44.760
I don't actually lose that information,

206
00:07:44.760 --> 00:07:47.822
I have a backup copy of that on another server.

207
00:07:47.822 --> 00:07:49.260
So that's very important from a reliability

208
00:07:49.260 --> 00:07:51.109
and resiliency standpoint.

209
00:07:51.109 --> 00:07:54.156
Note too, that consumers can also be distributed.

210
00:07:54.156 --> 00:07:56.280
So you can actually split up your consumers

211
00:07:56.280 --> 00:07:57.810
into consumer groups.

212
00:07:57.810 --> 00:07:59.880
So if you want redundancy on the consumer side

213
00:07:59.880 --> 00:08:02.280
or you just wanna distribute it horizontally,

214
00:08:02.280 --> 00:08:03.600
you can do that too.

215
00:08:03.600 --> 00:08:05.370
So if I have a group of consumers,

216
00:08:05.370 --> 00:08:07.350
then messages to that consumer group

217
00:08:07.350 --> 00:08:09.990
will be distributed across all the consumers in that group.

218
00:08:09.990 --> 00:08:12.720
So that gives me a way of scaling out the consumption

219
00:08:12.720 --> 00:08:15.090
of those messages so that everything isn't being set

220
00:08:15.090 --> 00:08:17.400
to the same server over and over and over again.

221
00:08:17.400 --> 00:08:18.780
I can split things up

222
00:08:18.780 --> 00:08:21.150
so that different servers handles different subsets

223
00:08:21.150 --> 00:08:22.785
of the data being published.

224
00:08:22.785 --> 00:08:25.560
However, if I have consumers into different groups or two

225
00:08:25.560 --> 00:08:26.730
or more different groups,

226
00:08:26.730 --> 00:08:28.560
then each group will get their own copy

227
00:08:28.560 --> 00:08:29.580
of every message assuming

228
00:08:29.580 --> 00:08:31.680
that they're subscribed to the same topic.

229
00:08:31.680 --> 00:08:33.570
So imagine a world where consumer group A

230
00:08:33.570 --> 00:08:36.444
and consumer group B are subscribing to the same topic.

231
00:08:36.444 --> 00:08:38.610
Those different messages might be getting served

232
00:08:38.610 --> 00:08:40.470
from different partitions and different servers

233
00:08:40.470 --> 00:08:42.750
from the cluster itself, but at the end of the day,

234
00:08:42.750 --> 00:08:44.820
the consumers in a given group will all have

235
00:08:44.820 --> 00:08:46.080
those messages distributed

236
00:08:46.080 --> 00:08:47.842
throughout that group for a given topic.

237
00:08:47.842 --> 00:08:50.280
And consumers within two different groups

238
00:08:50.280 --> 00:08:53.040
will receive their own copies of those messages.

239
00:08:53.040 --> 00:08:55.290
So group A and group B in this document will get a copy

240
00:08:55.290 --> 00:08:58.300
of every message, but within each group those messages will

241
00:08:59.665 --> 00:09:02.416
be distributed against the consumers in that group.

242
00:09:02.416 --> 00:09:05.910
So that is a really brief crash course in how Kafka works

243
00:09:05.910 --> 00:09:07.110
and what it's all about.

244
00:09:07.110 --> 00:09:08.430
Let's dive into some use cases

245
00:09:08.430 --> 00:09:11.310
'cause it's more helpful to think about how things are used

246
00:09:11.310 --> 00:09:12.720
and kind of wrap your head around the sorts

247
00:09:12.720 --> 00:09:15.090
of problems this technology can solve.

248
00:09:15.090 --> 00:09:16.380
Basically, this is a tool

249
00:09:16.380 --> 00:09:18.090
in your technology tool chest, right?

250
00:09:18.090 --> 00:09:20.790
So what sorts of problems can I solve with it?

251
00:09:20.790 --> 00:09:22.731
What problems is this tool useful for?

252
00:09:22.731 --> 00:09:24.993
So let's dive into a few examples here.

253
00:09:24.993 --> 00:09:27.810
One might be website activity tracking.

254
00:09:27.810 --> 00:09:29.070
So this is a pretty common one.

255
00:09:29.070 --> 00:09:31.140
So imagine that you have a website

256
00:09:31.140 --> 00:09:32.953
and you're selling stuff maybe.

257
00:09:32.953 --> 00:09:36.210
So you wanna keep track of what people are clicking on,

258
00:09:36.210 --> 00:09:37.470
what they're searching for,

259
00:09:37.470 --> 00:09:39.090
maybe even detailed behavior data,

260
00:09:39.090 --> 00:09:40.230
like how they're scrolling

261
00:09:40.230 --> 00:09:43.292
or their form submissions on different forms on the website.

262
00:09:43.292 --> 00:09:44.656
I might be able to send that data

263
00:09:44.656 --> 00:09:47.130
to different topics in Kafka

264
00:09:47.130 --> 00:09:48.540
and publish that out in different ways.

265
00:09:48.540 --> 00:09:51.240
So for example, in this e-commerce example,

266
00:09:51.240 --> 00:09:53.371
maybe somebody's searching for a humidifier.

267
00:09:53.371 --> 00:09:55.950
So in this example I might have a Kafka topic

268
00:09:55.950 --> 00:09:59.220
called searches and maybe our web apps are producers

269
00:09:59.220 --> 00:10:01.350
that feed data into the searches topic

270
00:10:01.350 --> 00:10:03.030
of what people are searching for.

271
00:10:03.030 --> 00:10:05.055
So someone searches for humidifier,

272
00:10:05.055 --> 00:10:07.530
my Kafka producer publishes

273
00:10:07.530 --> 00:10:10.410
that data into the Kafka topic called searches.

274
00:10:10.410 --> 00:10:13.560
And then on the backend, maybe I have some backend process

275
00:10:13.560 --> 00:10:16.980
that's consuming that topic data and that could turn around

276
00:10:16.980 --> 00:10:18.911
and maybe update a table somewhere

277
00:10:18.911 --> 00:10:21.150
that the website reads from.

278
00:10:21.150 --> 00:10:22.860
So maybe that affects some sort of promotion

279
00:10:22.860 --> 00:10:25.078
that happens on the website on its homepage.

280
00:10:25.078 --> 00:10:28.020
So you can imagine a system here where somebody's searching

281
00:10:28.020 --> 00:10:30.390
for a humidifier, that information gets published

282
00:10:30.390 --> 00:10:32.561
to Kafka in a topic called searches.

283
00:10:32.561 --> 00:10:35.040
Anybody who's interested in what people are searching

284
00:10:35.040 --> 00:10:38.100
for can then subscribe to that topic as a consumer.

285
00:10:38.100 --> 00:10:39.510
So you can imagine one consumer,

286
00:10:39.510 --> 00:10:41.190
it might be one of many that says,

287
00:10:41.190 --> 00:10:43.110
hey, somebody searched for humidifier.

288
00:10:43.110 --> 00:10:45.060
I'm gonna feed this information to a database

289
00:10:45.060 --> 00:10:46.410
that my website actually draws

290
00:10:46.410 --> 00:10:48.810
from in deciding what to promote on the homepage

291
00:10:48.810 --> 00:10:51.420
to this person the next time they come back.

292
00:10:51.420 --> 00:10:53.640
Maybe that's a user promotions table somewhere

293
00:10:53.640 --> 00:10:55.380
that's used for that purpose.

294
00:10:55.380 --> 00:10:58.050
To make it real, this is what a sample message might look

295
00:10:58.050 --> 00:10:59.730
like when you're publishing that data.

296
00:10:59.730 --> 00:11:00.960
It's just structured data here.

297
00:11:00.960 --> 00:11:02.310
So it might have a user ID

298
00:11:02.310 --> 00:11:04.110
that can contains some uniquely

299
00:11:04.110 --> 00:11:05.670
identifiable user identifier.

300
00:11:05.670 --> 00:11:07.890
In this case, we're using their email address.

301
00:11:07.890 --> 00:11:08.723
In the real world,

302
00:11:08.723 --> 00:11:10.020
you probably want something a little bit more anonymous

303
00:11:10.020 --> 00:11:11.520
if you're gonna be sending this around,

304
00:11:11.520 --> 00:11:14.460
of course the page URL that they looked at,

305
00:11:14.460 --> 00:11:16.230
what they searched for on that page

306
00:11:16.230 --> 00:11:17.715
and the date timestamp

307
00:11:17.715 --> 00:11:19.792
of when they actually perform that search.

308
00:11:19.792 --> 00:11:21.420
It doesn't have to be this format,

309
00:11:21.420 --> 00:11:24.000
this is just an example to make it real for you.

310
00:11:24.000 --> 00:11:26.180
So to give you a higher level diagram

311
00:11:26.180 --> 00:11:28.427
of how this system might work that uses Kafka.

312
00:11:28.427 --> 00:11:32.128
Again, we have a a website, xyzshop.com.

313
00:11:32.128 --> 00:11:34.440
Its web backend has some sort of a function

314
00:11:34.440 --> 00:11:36.390
that gets called when somebody searches for something

315
00:11:36.390 --> 00:11:39.120
on that website that publishes a search event

316
00:11:39.120 --> 00:11:41.435
into Kafka under a topic called searches.

317
00:11:41.435 --> 00:11:43.770
And now one of many consumers

318
00:11:43.770 --> 00:11:46.448
of that information might be a user promotions job.

319
00:11:46.448 --> 00:11:48.909
So it is consuming data from the searches topic

320
00:11:48.909 --> 00:11:52.320
at its own pace and it takes that data and turns around

321
00:11:52.320 --> 00:11:54.570
and updates a promotions table.

322
00:11:54.570 --> 00:11:56.978
That's some external database probably distributed as well.

323
00:11:56.978 --> 00:11:59.427
And then the website's talking to that too.

324
00:11:59.427 --> 00:12:02.053
So it says, hey, user promotions table, you happen

325
00:12:02.053 --> 00:12:04.674
to know this person searched for a humidifier before.

326
00:12:04.674 --> 00:12:06.690
Let's show the ads for humidifiers

327
00:12:06.690 --> 00:12:09.240
on the homepage the next time they come back.

328
00:12:09.240 --> 00:12:10.170
So that's one example.

329
00:12:10.170 --> 00:12:11.902
Website activity tracking using Kafka.

330
00:12:11.902 --> 00:12:13.800
And note here that Kafka

331
00:12:13.800 --> 00:12:15.450
is decoupling everything here, right?

332
00:12:15.450 --> 00:12:18.990
So I'm publishing that search information into Kafka,

333
00:12:18.990 --> 00:12:20.880
but the backend systems that do stuff

334
00:12:20.880 --> 00:12:23.610
with that system are decoupled from the website itself.

335
00:12:23.610 --> 00:12:25.860
So I can build new systems that take advantage

336
00:12:25.860 --> 00:12:27.600
of that information without having

337
00:12:27.600 --> 00:12:29.736
to change the website itself.

338
00:12:29.736 --> 00:12:31.920
Another example is log aggregation.

339
00:12:31.920 --> 00:12:34.592
This is also a very common application of Kafka.

340
00:12:34.592 --> 00:12:37.411
Imagine you have a central place

341
00:12:37.411 --> 00:12:39.210
for putting your web apps logs

342
00:12:39.210 --> 00:12:40.440
that you wanna funnel everything into.

343
00:12:40.440 --> 00:12:42.990
So as your website is generating log data

344
00:12:42.990 --> 00:12:45.783
of what people are hitting and where they're coming from

345
00:12:45.783 --> 00:12:47.818
and all that, maybe I just dump all that into Apache Kafka.

346
00:12:47.818 --> 00:12:50.400
And the advantage of that, of using Kafka

347
00:12:50.400 --> 00:12:52.607
as an intermediary is that I can then publish that in turn

348
00:12:52.607 --> 00:12:54.853
to more than one system maybe.

349
00:12:54.853 --> 00:12:58.380
So within Kafka, maybe I'm processing that data in real time

350
00:12:58.380 --> 00:13:01.590
and if I see an outlier of some sorter, some important order

351
00:13:01.590 --> 00:13:04.470
that's coming through, maybe I want to inspect those logs

352
00:13:04.470 --> 00:13:05.770
as they're being produced,

353
00:13:06.604 --> 00:13:07.560
as they're being streamed into Kafka.

354
00:13:07.560 --> 00:13:10.320
And if I see something that's worthy of a notification,

355
00:13:10.320 --> 00:13:12.090
maybe I can talk directly to Slack

356
00:13:12.090 --> 00:13:14.670
and make that happen automatically so I can process

357
00:13:14.670 --> 00:13:17.070
that data as it comes in for alerts.

358
00:13:17.070 --> 00:13:20.040
Imagine, we have a tie of Kafka to Slack,

359
00:13:20.040 --> 00:13:22.050
which then sends alerts to different users

360
00:13:22.050 --> 00:13:23.940
in your organization as needed.

361
00:13:23.940 --> 00:13:25.560
You could also imagine simpler systems

362
00:13:25.560 --> 00:13:27.300
where it just fires off an SMS message

363
00:13:27.300 --> 00:13:28.140
or something like that.

364
00:13:28.140 --> 00:13:29.970
But I want to highlight the flexibility

365
00:13:29.970 --> 00:13:31.200
of what you can do here.

366
00:13:31.200 --> 00:13:32.730
And maybe even there's a closed loop there

367
00:13:32.730 --> 00:13:35.010
where once someone actually responds to that event

368
00:13:35.010 --> 00:13:37.440
that gets logged somewhere else at the end of the day.

369
00:13:37.440 --> 00:13:39.360
At the same time, maybe I'm publishing this data

370
00:13:39.360 --> 00:13:42.047
into Elasticsearch for real time analytics, right?

371
00:13:42.047 --> 00:13:45.720
So, perhaps as logs are received into Kafka

372
00:13:45.720 --> 00:13:46.710
from the producers

373
00:13:46.710 --> 00:13:49.170
and those producers can be individual web servers out there,

374
00:13:49.170 --> 00:13:50.430
there can be very, very many of them.

375
00:13:50.430 --> 00:13:52.350
There can be a whole fleet of them out there, right?

376
00:13:52.350 --> 00:13:53.842
Those logs all get pushed into Kafka.

377
00:13:53.842 --> 00:13:56.520
Kafka could then feed those into Elasticsearch.

378
00:13:56.520 --> 00:13:58.500
If Elasticsearch is set up as a consumer

379
00:13:58.500 --> 00:14:01.650
of those topics from Kafka, from Elasticsearch,

380
00:14:01.650 --> 00:14:03.870
I can use tools like Cabana to visualize

381
00:14:03.870 --> 00:14:06.840
that data in real time as it's received.

382
00:14:06.840 --> 00:14:08.010
So that might be a mechanism

383
00:14:08.010 --> 00:14:10.380
for actually monitoring in real time the performance

384
00:14:10.380 --> 00:14:12.660
of my website, the traffic of my website.

385
00:14:12.660 --> 00:14:15.240
You could basically build your own Google analytics system

386
00:14:15.240 --> 00:14:18.240
or something very close to it using a system like this.

387
00:14:18.240 --> 00:14:19.110
And the beauty of it again,

388
00:14:19.110 --> 00:14:20.700
is that it's very scalable, right?

389
00:14:20.700 --> 00:14:22.920
So by having a fleet of Kafka servers,

390
00:14:22.920 --> 00:14:24.964
I can scale that independently from my website

391
00:14:24.964 --> 00:14:28.560
and from the backend systems that's analyzing that data.

392
00:14:28.560 --> 00:14:30.870
So in this case, we might be moving this data

393
00:14:30.870 --> 00:14:32.790
to analysis tools for reporting,

394
00:14:32.790 --> 00:14:33.918
or we might be running more processes there as well

395
00:14:33.918 --> 00:14:37.511
to trigger even more alerts if we want to.

396
00:14:37.511 --> 00:14:41.128
And the key here is that by storing those logs in Kafka,

397
00:14:41.128 --> 00:14:42.990
it makes it very easy to switch out

398
00:14:42.990 --> 00:14:44.490
our analysis tools later on.

399
00:14:44.490 --> 00:14:47.340
So again, Kafka's decoupling the website itself

400
00:14:47.340 --> 00:14:49.170
from the backend analysis tools.

401
00:14:49.170 --> 00:14:51.270
If I wanna swap in another analysis tool,

402
00:14:51.270 --> 00:14:54.093
I just put it in the system, make it a new consumer

403
00:14:54.093 --> 00:14:55.620
of that data and it can go to town.

404
00:14:55.620 --> 00:14:58.634
I can even use both of those systems at the same time

405
00:14:58.634 --> 00:15:00.300
for a while if I wanna have sort of a smooth transition.

406
00:15:00.300 --> 00:15:03.060
So it gives you a lot of flexibility in how you manage

407
00:15:03.060 --> 00:15:05.343
that data and how you analyze it later on.

408
00:15:06.570 --> 00:15:08.520
Another example is content moderation.

409
00:15:08.520 --> 00:15:11.100
And we'll actually build something like this in later videos

410
00:15:11.100 --> 00:15:13.290
in this series to make it real.

411
00:15:13.290 --> 00:15:15.270
For example, product reviews, right?

412
00:15:15.270 --> 00:15:16.560
Someone types in a product review.

413
00:15:16.560 --> 00:15:18.788
We need to make sure that it's not fake,

414
00:15:18.788 --> 00:15:20.940
it's not coming from a bot, it's not some shilling thing

415
00:15:20.940 --> 00:15:22.814
and that it's appropriate,

416
00:15:22.814 --> 00:15:24.900
people aren't using naughty language or anything like that.

417
00:15:24.900 --> 00:15:26.970
Again, the power of Kafka is to decouple

418
00:15:26.970 --> 00:15:29.010
that from the web app itself.

419
00:15:29.010 --> 00:15:31.890
So in this diagram here, you can see how that might work.

420
00:15:31.890 --> 00:15:33.533
Some user submits a new review

421
00:15:33.533 --> 00:15:36.930
into the website, xyzstore.com.

422
00:15:36.930 --> 00:15:39.780
That gets dumped into Kafka, that gets published into Kafka

423
00:15:39.780 --> 00:15:41.280
as from a producer.

424
00:15:41.280 --> 00:15:44.760
Again, each server of my web application is a producer

425
00:15:44.760 --> 00:15:47.040
of this review data into Kafka.

426
00:15:47.040 --> 00:15:50.610
Kafka then might have a consumer that takes that new review

427
00:15:50.610 --> 00:15:53.640
and validates that content using some system.

428
00:15:53.640 --> 00:15:56.460
If it's approved, then we push that into a database,

429
00:15:56.460 --> 00:15:59.220
allowing the website to actually display that review.

430
00:15:59.220 --> 00:16:01.920
If not, then that review will be rejected and blocked.

431
00:16:01.920 --> 00:16:05.100
So again, here we have sort of a closed loop system here

432
00:16:05.100 --> 00:16:06.870
where people enter reviews.

433
00:16:06.870 --> 00:16:09.660
It's gonna be shipped off to Kafka from,

434
00:16:09.660 --> 00:16:12.270
as a producer will have a consumer of that data in Kafka

435
00:16:12.270 --> 00:16:14.610
that goes off and validates those reviews.

436
00:16:14.610 --> 00:16:16.770
If they're approved, they get published out such

437
00:16:16.770 --> 00:16:19.860
that the website will actually display them to other users.

438
00:16:19.860 --> 00:16:21.390
So in this particular use case,

439
00:16:21.390 --> 00:16:24.120
you might start the review in sort of a pending status

440
00:16:24.120 --> 00:16:26.460
and it would only be visible once it was approved, right?

441
00:16:26.460 --> 00:16:28.920
So you can imagine that immediately

442
00:16:28.920 --> 00:16:30.690
that is published to the database,

443
00:16:30.690 --> 00:16:31.740
but in a pending state

444
00:16:31.740 --> 00:16:33.600
so that only the author can look at it

445
00:16:33.600 --> 00:16:35.850
until it's actually approved later on.

446
00:16:35.850 --> 00:16:38.040
There's a lot of implementation details,

447
00:16:38.040 --> 00:16:39.330
but from the standpoint of Kafka,

448
00:16:39.330 --> 00:16:40.557
it's not really that important.

449
00:16:40.557 --> 00:16:43.023
The the key here though is that again,

450
00:16:43.023 --> 00:16:44.760
we have decoupled the moderation system from the web app.

451
00:16:44.760 --> 00:16:46.560
So this makes it a lot easier

452
00:16:46.560 --> 00:16:50.010
to swap out different moderation systems as time goes on.

453
00:16:50.010 --> 00:16:51.960
There are third party cloud services out there

454
00:16:51.960 --> 00:16:52.980
and we'll actually play around

455
00:16:52.980 --> 00:16:55.350
with one later in this course.

456
00:16:55.350 --> 00:16:57.450
And you know, services come and go,

457
00:16:57.450 --> 00:16:59.550
so you might wanna swap that out in the future

458
00:16:59.550 --> 00:17:01.885
by having everything in Kafka that makes

459
00:17:01.885 --> 00:17:02.753
that a lot easier to do.

460
00:17:03.672 --> 00:17:07.500
Another use case is website analytics, very similar

461
00:17:07.500 --> 00:17:08.970
to an activity tracking,

462
00:17:08.970 --> 00:17:10.650
but we're kind of doing something

463
00:17:10.650 --> 00:17:13.770
a little bit more complicated in this particular diagram.

464
00:17:13.770 --> 00:17:16.230
So in this case, we have users hitting our website.

465
00:17:16.230 --> 00:17:18.090
So every server of our website is going

466
00:17:18.090 --> 00:17:20.910
to be publishing data to Kafka as a producer.

467
00:17:20.910 --> 00:17:23.580
And we'll just kind of follow the arrow around here.

468
00:17:23.580 --> 00:17:24.750
So again, we can have

469
00:17:24.750 --> 00:17:26.700
more than one consumer on a topic, right?

470
00:17:26.700 --> 00:17:29.730
So in this case we're dumping data from Kafka directly

471
00:17:29.730 --> 00:17:31.310
into a data warehouse of some sort.

472
00:17:31.310 --> 00:17:34.200
So you know, maybe that's some big Oracle data warehouse

473
00:17:34.200 --> 00:17:37.290
or Amazon, Redshift, whatever it might be.

474
00:17:37.290 --> 00:17:39.960
And then in turn there might be reporting apps that work

475
00:17:39.960 --> 00:17:42.000
with that database like Tableau or something.

476
00:17:42.000 --> 00:17:45.690
So your business teams can query that data through Tableau

477
00:17:45.690 --> 00:17:48.120
or QuickSight or whatever tool they're familiar with

478
00:17:48.120 --> 00:17:49.860
from that database that's been populated

479
00:17:49.860 --> 00:17:53.490
from that analytic data that got published into Kafka.

480
00:17:53.490 --> 00:17:55.617
At the same time, maybe we have Apache Spark.

481
00:17:55.617 --> 00:17:58.830
So Spark has Spark streaming capabilities

482
00:17:58.830 --> 00:18:01.354
that can receive data from Kafka as well.

483
00:18:01.354 --> 00:18:04.890
Maybe Spark is doing real-time analytics on that data.

484
00:18:04.890 --> 00:18:07.410
It might even be publishing customization

485
00:18:07.410 --> 00:18:09.018
of the content back to the website.

486
00:18:09.018 --> 00:18:11.550
For example, maybe we're keeping track

487
00:18:11.550 --> 00:18:13.490
of the most popular pages on the site

488
00:18:13.490 --> 00:18:16.380
and publishing that as a top 10 list somewhere.

489
00:18:16.380 --> 00:18:19.200
We could do all that within Apache Spark just reading

490
00:18:19.200 --> 00:18:20.990
that data in in real time from Kafka.

491
00:18:20.990 --> 00:18:24.060
And maybe we're also analyzing that data, looking

492
00:18:24.060 --> 00:18:26.160
for anomalies or things that are wrong.

493
00:18:26.160 --> 00:18:28.710
Maybe the site went down, someone needs to be told about it,

494
00:18:28.710 --> 00:18:30.630
maybe latencies are getting too high.

495
00:18:30.630 --> 00:18:33.450
Again, Apache Spark could analyze that data in real time

496
00:18:33.450 --> 00:18:35.520
as it's being received from Kafka.

497
00:18:35.520 --> 00:18:37.467
And if it sees something that's anomalous,

498
00:18:37.467 --> 00:18:39.960
it can talk to Slack or whatever system you want

499
00:18:39.960 --> 00:18:41.550
and kick off an alert to somebody

500
00:18:41.550 --> 00:18:42.870
who can actually do something about it

501
00:18:42.870 --> 00:18:45.060
or might be interested in it.

502
00:18:45.060 --> 00:18:47.940
So remember, Kafka can allow real time processing

503
00:18:47.940 --> 00:18:50.910
on the same data by multiple consumers at the same time.

504
00:18:50.910 --> 00:18:53.761
It's very flexible and very scalable.

505
00:18:53.761 --> 00:18:55.682
Coming up in this video series,

506
00:18:55.682 --> 00:18:58.011
we're gonna be doing some hands-on activities.

507
00:18:58.011 --> 00:19:01.740
We're going to build a serverless URL shortener app,

508
00:19:01.740 --> 00:19:04.413
a content moderation system using some real services,

509
00:19:04.413 --> 00:19:07.030
a message streaming system using Twitter,

510
00:19:07.030 --> 00:19:09.810
will show you an example of streaming logs into Kafka

511
00:19:09.810 --> 00:19:10.980
from an actual mobile app

512
00:19:10.980 --> 00:19:13.230
that we're going to build using React native.

513
00:19:13.230 --> 00:19:15.870
And we'll also illustrate the use of webhooks

514
00:19:15.870 --> 00:19:18.150
by actually tying Stripe into Kafka

515
00:19:18.150 --> 00:19:20.790
to receive events from Stripe about payment processing.

516
00:19:20.790 --> 00:19:23.490
So these are all some very real world activities

517
00:19:23.490 --> 00:19:25.320
using real world systems.

518
00:19:25.320 --> 00:19:26.500
And the beautiful thing

519
00:19:27.462 --> 00:19:28.350
is that these systems all have free tier.

520
00:19:28.350 --> 00:19:30.900
So we can actually play around with these systems for free

521
00:19:30.900 --> 00:19:32.790
and actually build something that you might use in the real

522
00:19:32.790 --> 00:19:35.100
world just at a smaller scale.

523
00:19:35.100 --> 00:19:37.020
Now you might be thinking to yourself,

524
00:19:37.020 --> 00:19:38.730
well how am I gonna build a Kafka cluster?

525
00:19:38.730 --> 00:19:40.860
I mean, those things are pretty big and expensive

526
00:19:40.860 --> 00:19:42.300
and hard to set up, aren't they?

527
00:19:42.300 --> 00:19:45.060
Well, we're gonna cheat, so we're gonna use a service called

528
00:19:45.060 --> 00:19:47.370
Upstash throughout this course.

529
00:19:47.370 --> 00:19:50.160
Upstash is a serverless Kafka solution

530
00:19:50.160 --> 00:19:51.780
and it's really serverless

531
00:19:51.780 --> 00:19:54.090
and it's got some really good properties to it

532
00:19:54.090 --> 00:19:56.610
that make it a good fit for what we're gonna be doing here.

533
00:19:56.610 --> 00:19:59.190
So first of all, they do have a free tier that you can use.

534
00:19:59.190 --> 00:20:01.437
So it's possible to use Upstash

535
00:20:01.437 --> 00:20:04.923
and use a Kafka cluster in the cloud free of charge,

536
00:20:04.923 --> 00:20:08.700
you know, for reasonable amounts of transactions, right?

537
00:20:08.700 --> 00:20:10.620
So if you're just playing around learning

538
00:20:10.620 --> 00:20:13.770
or developing a proof of concept, Upstash is a great tool

539
00:20:13.770 --> 00:20:17.247
for very quickly and very easily setting up a Kafka cluster

540
00:20:17.247 --> 00:20:19.290
and some topics and just playing around

541
00:20:19.290 --> 00:20:21.090
with it really in a matter of a couple

542
00:20:21.090 --> 00:20:22.290
of minutes you can be up and running

543
00:20:22.290 --> 00:20:23.520
with Kafka using Upstash,

544
00:20:23.520 --> 00:20:26.700
which is a whole lot easier than setting up a new cluster

545
00:20:26.700 --> 00:20:27.901
and a lot cheaper too.

546
00:20:27.901 --> 00:20:30.330
Now, Upstash also offers

547
00:20:30.330 --> 00:20:32.490
a serverless Redis solution as well,

548
00:20:32.490 --> 00:20:34.560
and we'll use that as well in some of these activities.

549
00:20:34.560 --> 00:20:36.513
So that gives us a convenient way of caching data

550
00:20:36.513 --> 00:20:38.883
or storing it in a database of sorts.

551
00:20:38.883 --> 00:20:41.550
And again, the benefit of Upstash

552
00:20:41.550 --> 00:20:43.230
is it's just so much easier than setting up

553
00:20:43.230 --> 00:20:44.220
your own Kafka cluster

554
00:20:44.220 --> 00:20:46.980
from scratch or your own Redis cluster from scratch.

555
00:20:46.980 --> 00:20:49.590
I mean they solve that problem for you.

556
00:20:49.590 --> 00:20:52.110
They have REST APIs and an SDK as well.

557
00:20:52.110 --> 00:20:55.050
So as we'll see, this integrates with a wide range

558
00:20:55.050 --> 00:20:56.110
of different technologies.

559
00:20:56.110 --> 00:20:57.865
Anything that can talk to Webhooks or rest

560
00:20:57.865 --> 00:21:00.811
or use an SDK from Java or JavaScript

561
00:21:00.811 --> 00:21:04.200
or pretty much any language you can think of

562
00:21:04.200 --> 00:21:07.050
can integrate very easily with Upstash, Kafka.

563
00:21:07.050 --> 00:21:08.640
Their free tier is pretty generous.

564
00:21:08.640 --> 00:21:11.280
As of this writing, it's 10,000 messages per day

565
00:21:11.280 --> 00:21:13.770
with 256 megabytes of retention as well.

566
00:21:13.770 --> 00:21:16.230
So for any experimentation you might wanna do,

567
00:21:16.230 --> 00:21:17.413
that's more than enough.

568
00:21:17.413 --> 00:21:19.455
The beautiful thing in production though,

569
00:21:19.455 --> 00:21:20.288
if you do take this

570
00:21:20.288 --> 00:21:22.095
into a production larger scale application,

571
00:21:22.095 --> 00:21:23.836
is that it is truly pay as you go.

572
00:21:23.836 --> 00:21:25.821
So it's just based on the number of messages

573
00:21:25.821 --> 00:21:27.930
and the storage space that you're using

574
00:21:27.930 --> 00:21:29.340
and there's even a price cap on that

575
00:21:29.340 --> 00:21:31.500
that they guarantee you won't exceed.

576
00:21:31.500 --> 00:21:33.420
If you want more information on their pricing plan

577
00:21:33.420 --> 00:21:37.260
for Upstash, visit docstartupstash.com/kafka.pricing

578
00:21:37.260 --> 00:21:38.460
for the details.

579
00:21:38.460 --> 00:21:39.900
But the thing that really sets us apart

580
00:21:39.900 --> 00:21:41.940
is that it is truly serverless.

581
00:21:41.940 --> 00:21:44.160
As they like to say in big data circles,

582
00:21:44.160 --> 00:21:46.230
the price truly scales to zero.

583
00:21:46.230 --> 00:21:48.450
You're not paying for server resources,

584
00:21:48.450 --> 00:21:50.250
you're just paying for your usage.

585
00:21:50.250 --> 00:21:51.930
If you're not actually using this cluster,

586
00:21:51.930 --> 00:21:53.370
you don't get charged for that time.

587
00:21:53.370 --> 00:21:55.482
So it is truly a serverless solution

588
00:21:55.482 --> 00:21:58.137
where you're only paying for the usage, the messages

589
00:21:58.137 --> 00:22:00.150
that you're actually sending through to it

590
00:22:00.150 --> 00:22:02.940
and the storage space that those messages consume.

591
00:22:02.940 --> 00:22:05.460
They also have enterprise plans available as well.

592
00:22:05.460 --> 00:22:06.840
So if you do need higher throughput

593
00:22:06.840 --> 00:22:08.985
or more stringent security, they can support that

594
00:22:08.985 --> 00:22:10.890
through their enterprise offerings as well.

595
00:22:10.890 --> 00:22:13.860
So I'm a big fan of Upstash and we're gonna use it a lot

596
00:22:13.860 --> 00:22:15.559
in these following video lectures

597
00:22:15.559 --> 00:22:17.640
and some hands-on activities to show you

598
00:22:17.640 --> 00:22:19.710
how to get up and running with Kafka very easily

599
00:22:19.710 --> 00:22:21.390
and very quickly.

600
00:22:21.390 --> 00:22:23.070
So before we dive in, let's go ahead

601
00:22:23.070 --> 00:22:26.310
and walk you through setting up a cluster in Upstash Kafka.

602
00:22:26.310 --> 00:22:27.143
We're gonna need that

603
00:22:27.143 --> 00:22:29.220
for all of the following hands-on activities

604
00:22:29.220 --> 00:22:30.240
in this video series.

605
00:22:30.240 --> 00:22:31.890
So let's go get that outta the way.

606
00:22:31.890 --> 00:22:33.677
We're gonna create an account in Upstash

607
00:22:33.677 --> 00:22:37.320
and create your first Kafka cluster for free.

608
00:22:37.320 --> 00:22:39.840
So if you would like to follow along in the upcoming videos

609
00:22:39.840 --> 00:22:42.660
with hands-on activities using Kafka, head on over

610
00:22:42.660 --> 00:22:45.810
to upstash.com. And this is going to be a very easy way

611
00:22:45.810 --> 00:22:47.910
to spin up your own Kafka cluster

612
00:22:47.910 --> 00:22:49.590
and also a Redis cluster later on for some

613
00:22:49.590 --> 00:22:51.180
of these activities too.

614
00:22:51.180 --> 00:22:53.400
To get started, just click on the big friendly start free

615
00:22:53.400 --> 00:22:54.600
in 30 seconds button here.

616
00:22:54.600 --> 00:22:56.580
And if this UI changes in the future,

617
00:22:56.580 --> 00:22:59.190
you can also get there from the console link here.

618
00:22:59.190 --> 00:23:00.870
30 seconds might actually be conservative,

619
00:23:00.870 --> 00:23:02.310
it's really quick.

620
00:23:02.310 --> 00:23:03.480
So you'll see, you can sign in

621
00:23:03.480 --> 00:23:05.700
with your existing accounts if you have one with Amazon,

622
00:23:05.700 --> 00:23:07.020
GitHub, or Google,

623
00:23:07.020 --> 00:23:08.790
or you can create a new one if you prefer.

624
00:23:08.790 --> 00:23:10.170
I'm gonna sign in with Amazon

625
00:23:10.170 --> 00:23:12.090
and don't worry, it doesn't actually take your payment

626
00:23:12.090 --> 00:23:13.980
information from Amazon at this point.

627
00:23:13.980 --> 00:23:16.620
Later on, if you do need to upgrade from a free account,

628
00:23:16.620 --> 00:23:18.300
you can provide a credit card to do so.

629
00:23:18.300 --> 00:23:20.250
But again, the free tier is pretty generous

630
00:23:20.250 --> 00:23:23.310
and we'll definitely get you through this series of videos.

631
00:23:23.310 --> 00:23:25.560
So I'm just gonna sign into my Amazon account

632
00:23:27.367 --> 00:23:28.817
and grant Upstash permission.

633
00:23:31.950 --> 00:23:33.630
And here we are.

634
00:23:33.630 --> 00:23:36.196
So from here we're just gonna go up to Kafka

635
00:23:36.196 --> 00:23:38.964
and create a new cluster.

636
00:23:38.964 --> 00:23:42.329
Give this cluster a name, call it whatever you want.

637
00:23:42.329 --> 00:23:44.523
Test cluster, that's real creative, huh?

638
00:23:45.960 --> 00:23:48.150
And select the region that's closest to you.

639
00:23:48.150 --> 00:23:50.640
For me, that's gonna be in Virginia.

640
00:23:50.640 --> 00:23:52.170
And for what we're doing in this course,

641
00:23:52.170 --> 00:23:53.310
single zone is fine.

642
00:23:53.310 --> 00:23:54.630
We don't need a ton of redundancy

643
00:23:54.630 --> 00:23:56.400
or anything like that, we're just playing around.

644
00:23:56.400 --> 00:24:01.400
So create and we're done.

645
00:24:01.830 --> 00:24:04.590
And we're not actually gonna create a topic at this point.

646
00:24:04.590 --> 00:24:06.900
If you did want to create your first topic in Kafka,

647
00:24:06.900 --> 00:24:08.274
this is an easy way of doing it.

648
00:24:08.274 --> 00:24:09.990
We're gonna click on Do Later though,

649
00:24:09.990 --> 00:24:11.810
because I'm gonna set up a specific topic

650
00:24:11.810 --> 00:24:14.130
for specific exercises going forward.

651
00:24:14.130 --> 00:24:15.330
But if you wanted to,

652
00:24:15.330 --> 00:24:17.370
you could actually set up a topic here at the same time

653
00:24:17.370 --> 00:24:19.890
and you'd be done, you'd have your cluster set up,

654
00:24:19.890 --> 00:24:21.630
you'd have a topic sitting there waiting for people

655
00:24:21.630 --> 00:24:24.180
to produce stuff into it and consume stuff from it.

656
00:24:25.680 --> 00:24:26.513
And there we have it.

657
00:24:26.513 --> 00:24:29.010
And you can see I now have my test cluster set up

658
00:24:29.010 --> 00:24:30.840
in Kafka using Upstash.

659
00:24:30.840 --> 00:24:33.120
And here we have a list of all the credentials that I need

660
00:24:33.120 --> 00:24:36.630
to connect to that cluster, the endpoint name, the username

661
00:24:36.630 --> 00:24:38.490
and password, which I can copy off.

662
00:24:38.490 --> 00:24:41.190
And furthermore, it gives you very convenient code

663
00:24:41.190 --> 00:24:44.280
for actually connecting to it from Java or Node JS or Python

664
00:24:44.280 --> 00:24:47.400
or C Sharp or even CloudFlare workers.

665
00:24:47.400 --> 00:24:49.320
So how cool is that?

666
00:24:49.320 --> 00:24:51.330
It also gives you rest API credentials.

667
00:24:51.330 --> 00:24:53.400
So if you just wanna hit it using a restful interface,

668
00:24:53.400 --> 00:24:55.770
just using plain old HTTP, everything you need

669
00:24:55.770 --> 00:24:57.330
for that is here as well.

670
00:24:57.330 --> 00:25:00.030
And it also has a webhook, API that you can look at too.

671
00:25:00.030 --> 00:25:01.620
And if you are interested in seeing what the limits

672
00:25:01.620 --> 00:25:03.180
of your free subscription are,

673
00:25:03.180 --> 00:25:04.890
you can get a reminder of what that is here.

674
00:25:04.890 --> 00:25:07.200
Again, this is more than enough than we're going to need

675
00:25:07.200 --> 00:25:10.170
for the activities in this series of videos.

676
00:25:10.170 --> 00:25:12.300
And if you do wanna upgrade later on, just add a credit card

677
00:25:12.300 --> 00:25:13.440
and you can start using it

678
00:25:13.440 --> 00:25:15.022
for real in the production setting.

679
00:25:15.022 --> 00:25:15.990
Pretty cool stuff.

680
00:25:15.990 --> 00:25:18.180
So now that we have our Kafka cluster set

681
00:25:18.180 --> 00:25:20.430
up in the cloud in Upstash, let's go

682
00:25:20.430 --> 00:25:22.996
and play with it in our next activity.

683
00:25:22.996 --> 00:25:25.663
(upbeat music)

