WEBVTT

1
00:00:06.120 --> 00:00:06.953
<v ->All right.</v>

2
00:00:06.953 --> 00:00:08.030 line:15% 
Let's unleash today's Redis.

3
00:00:08.030 --> 00:00:10.460 line:15% 
I'm Frank Kane, your instructor with Sundog Education.

4
00:00:10.460 --> 00:00:11.760 line:15% 
And I'm very excited to tell you

5
00:00:11.760 --> 00:00:14.180 line:15% 
about how Redis has evolved in recent years.

6
00:00:14.180 --> 00:00:15.610 line:15% 
It's pretty, pretty interesting.

7
00:00:15.610 --> 00:00:17.430 line:15% 
You've probably thought of Redis as just a cache,

8
00:00:17.430 --> 00:00:19.520 line:15% 
but it's really become a whole lot more

9
00:00:20.357 --> 00:00:21.190 line:15% 
and it could actually take the place

10
00:00:21.190 --> 00:00:24.250 line:15% 
of much larger systems all under one unified API,

11
00:00:24.250 --> 00:00:25.620 line:15% 
which is pretty darn cool.

12
00:00:25.620 --> 00:00:27.610 line:15% 
So let's dive in and talk about how Redis cloud

13
00:00:27.610 --> 00:00:29.600 line:15% 
and Redis modules can be used

14
00:00:29.600 --> 00:00:32.940 line:15% 
to create entire systems and not just a cache.

15
00:00:32.940 --> 00:00:35.150
Now, historically Redis was just used

16
00:00:35.150 --> 00:00:36.460
as a cache most often, right?

17
00:00:36.460 --> 00:00:38.790
That's probably how you think of Redis today.

18
00:00:38.790 --> 00:00:40.780
So just to recap that legacy usage,

19
00:00:40.780 --> 00:00:42.870
which Redis is still really good at,

20
00:00:42.870 --> 00:00:44.780
let's say you have a fleet of application servers

21
00:00:44.780 --> 00:00:46.030
out there serving your website

22
00:00:46.030 --> 00:00:48.440
or your application, whatever it might be.

23
00:00:48.440 --> 00:00:49.974
Usually those application servers

24
00:00:49.974 --> 00:00:52.520
need to hit a database somewhere, right?

25
00:00:52.520 --> 00:00:54.810
It's gonna be storing some sort of persistent state

26
00:00:54.810 --> 00:00:56.640
or maybe some data that you need to access

27
00:00:56.640 --> 00:00:58.100
for your end users.

28
00:00:58.100 --> 00:01:00.510
And the problem here is that that can be a bottleneck.

29
00:01:00.510 --> 00:01:02.020
So if you're throwing all the traffic

30
00:01:02.020 --> 00:01:03.790
that's hitting those front end servers

31
00:01:03.790 --> 00:01:06.410
directly at your database, things can choke.

32
00:01:06.410 --> 00:01:08.480
You know, those databases need to hit the disc sometimes.

33
00:01:08.480 --> 00:01:10.200
And often there's complexity there

34
00:01:10.200 --> 00:01:11.640
if you're gonna have a distributed database

35
00:01:11.640 --> 00:01:13.550
like a big, node SQL solution.

36
00:01:13.550 --> 00:01:15.800
So historically the way we deal with that

37
00:01:15.800 --> 00:01:17.770
is to introduce a caching layer

38
00:01:17.770 --> 00:01:20.120
in between your application servers and the database.

39
00:01:20.120 --> 00:01:21.323
For example, Redis.

40
00:01:22.700 --> 00:01:23.930
So what we can do here

41
00:01:23.930 --> 00:01:25.970
is say that we're gonna hit that cache

42
00:01:25.970 --> 00:01:28.440
that's in memory and distributed in its own way.

43
00:01:28.440 --> 00:01:30.120
And if the data's not in the cache,

44
00:01:30.120 --> 00:01:31.410
then we'll hit the database.

45
00:01:31.410 --> 00:01:32.400
But if it is in the cache,

46
00:01:32.400 --> 00:01:34.100
we're not gonna go any further.

47
00:01:34.100 --> 00:01:35.130
And the advantage of this

48
00:01:35.130 --> 00:01:37.260
is not just that that cache is really, really fast

49
00:01:37.260 --> 00:01:38.610
compared to the database,

50
00:01:38.610 --> 00:01:40.610
but also that you can scale that caching layer

51
00:01:40.610 --> 00:01:43.158
independently from the database itself.

52
00:01:43.158 --> 00:01:45.276
And that can be a lot more efficient

53
00:01:45.276 --> 00:01:46.281
and save you some money.

54
00:01:46.281 --> 00:01:47.114
By using that caching layer,

55
00:01:47.114 --> 00:01:49.070
you can just store the most frequently accessed data

56
00:01:49.070 --> 00:01:50.960
in memory and only hit the database

57
00:01:50.960 --> 00:01:53.090
for infrequently accessed data

58
00:01:53.090 --> 00:01:55.320
or to write changes to that data.

59
00:01:55.320 --> 00:01:59.330
But what if I told you Redis can also persist its data

60
00:01:59.330 --> 00:02:00.590
and store structured data

61
00:02:00.590 --> 00:02:03.440
and let you query that data in real time as well.

62
00:02:03.440 --> 00:02:05.940
You actually need that separate database at all.

63
00:02:05.940 --> 00:02:07.940
Redis can be the database.

64
00:02:07.940 --> 00:02:09.880
And that's what I'm here to teach you about today.

65
00:02:09.880 --> 00:02:12.190
How Redis can actually take the place of much larger,

66
00:02:12.190 --> 00:02:13.730
more complex systems

67
00:02:13.730 --> 00:02:16.700
and do much of what you need all under one roof.

68
00:02:16.700 --> 00:02:18.110
Redis can act as your database

69
00:02:18.110 --> 00:02:19.480
with all the benefits of Redis

70
00:02:19.480 --> 00:02:21.650
in memory caching on top of it still,

71
00:02:21.650 --> 00:02:22.840
but there's no need to introduce

72
00:02:22.840 --> 00:02:26.090
a separate complex database that requires its own expertise

73
00:02:26.090 --> 00:02:27.670
and its own maintenance.

74
00:02:27.670 --> 00:02:29.230
Nor do you need to choose a solution

75
00:02:29.230 --> 00:02:31.620
that locks you into some specific cloud platform.

76
00:02:31.620 --> 00:02:33.900
So for example, if you were to build this system

77
00:02:33.900 --> 00:02:36.500
on top of Amazon's Dynamo DB,

78
00:02:36.500 --> 00:02:38.700
you'd find it very hard to ever switch outside

79
00:02:38.700 --> 00:02:40.500
of the Amazon web services ecosystem.

80
00:02:40.500 --> 00:02:43.690
It kind of locks you in to that cloud platform,

81
00:02:43.690 --> 00:02:45.960
but Redis runs on any cloud platform.

82
00:02:45.960 --> 00:02:46.793
It's all open source.

83
00:02:46.793 --> 00:02:48.750
It's available pretty much everywhere.

84
00:02:48.750 --> 00:02:50.860
So there's no cloud provider lock in

85
00:02:50.860 --> 00:02:53.610
by using Redis as your architecture choice.

86
00:02:53.610 --> 00:02:55.030
So that's yet another big advantage

87
00:02:55.030 --> 00:02:56.980
to using Redis where whenever you can

88
00:02:56.980 --> 00:02:59.373
in place of these other proprietary systems.

89
00:03:01.470 --> 00:03:03.050
Now, even the core Redis module

90
00:03:03.050 --> 00:03:04.570
can do more than you probably think.

91
00:03:04.570 --> 00:03:06.160
It's more than just in memory caching,

92
00:03:06.160 --> 00:03:07.790
although it's still really good at that.

93
00:03:07.790 --> 00:03:09.420
It can also handle streaming of data

94
00:03:09.420 --> 00:03:11.810
very much like Kafka or Kinesis,

95
00:03:11.810 --> 00:03:13.370
and it can also handle session management,

96
00:03:13.370 --> 00:03:14.320
and also pubsub,

97
00:03:14.320 --> 00:03:15.647
publish and subscribe messaging as well.

98
00:03:15.647 --> 00:03:17.320
And that's all built in,

99
00:03:17.320 --> 00:03:18.790
just as part of the core module,

100
00:03:18.790 --> 00:03:20.320
but where things get really interesting

101
00:03:20.320 --> 00:03:21.770
are with these Redis modules.

102
00:03:21.770 --> 00:03:22.783
These are add on modules

103
00:03:22.783 --> 00:03:25.130
so that you can clamp onto Redis very easily.

104
00:03:25.130 --> 00:03:27.580
It's just a matter of really saying you want them

105
00:03:28.420 --> 00:03:29.253
when you set things up.

106
00:03:29.253 --> 00:03:31.040
For example, there's RedisJSON.

107
00:03:31.040 --> 00:03:33.930
With that we can store structured JSON data within Redis.

108
00:03:33.930 --> 00:03:35.930
It's not just string based key value pairs.

109
00:03:35.930 --> 00:03:37.410
You can actually have structured data in there

110
00:03:37.410 --> 00:03:39.070
of different data types,

111
00:03:39.070 --> 00:03:40.450
and you don't need to maintain a separate

112
00:03:40.450 --> 00:03:41.680
node SQL database at all

113
00:03:41.680 --> 00:03:44.390
because RedisJSON is a distributed,

114
00:03:44.390 --> 00:03:46.770
horizontally distributed node SQL database

115
00:03:46.770 --> 00:03:48.470
in its own right.

116
00:03:48.470 --> 00:03:50.580
We also have RedisSearch available.

117
00:03:50.580 --> 00:03:53.940
That offers full text search and analytics capabilities

118
00:03:53.940 --> 00:03:55.890
along the same lines as Elasticsearch

119
00:03:55.890 --> 00:03:57.750
or Amazon Open Search.

120
00:03:57.750 --> 00:03:59.870
For most applications, this will do just fine

121
00:03:59.870 --> 00:04:02.220
and you don't need to go using these external solutions

122
00:04:02.220 --> 00:04:03.790
that require their own expertise

123
00:04:03.790 --> 00:04:05.393
and possible vendor lock in.

124
00:04:06.230 --> 00:04:08.210
We also have RedisTimeSeries.

125
00:04:08.210 --> 00:04:10.340
So if you need to store data that varies over time

126
00:04:10.340 --> 00:04:12.330
and aggregate and analyze that data

127
00:04:12.330 --> 00:04:14.040
over specific time periods,

128
00:04:14.040 --> 00:04:16.360
RedisTimeSeries can do that for you.

129
00:04:16.360 --> 00:04:18.370
So if we combine that with Redis insight,

130
00:04:18.370 --> 00:04:20.700
which is Red's visualization tool,

131
00:04:20.700 --> 00:04:21.940
we can actually take the place

132
00:04:21.940 --> 00:04:24.190
of something like Kibana and Elasticsearch.

133
00:04:24.190 --> 00:04:26.370
We can also integrate with third party visualization tools

134
00:04:26.370 --> 00:04:27.203
if we want to,

135
00:04:27.203 --> 00:04:28.800
but think about what we've talked about so far.

136
00:04:28.800 --> 00:04:31.313
We already have you know, structured storage,

137
00:04:32.554 --> 00:04:33.387
we have search,

138
00:04:33.387 --> 00:04:34.220
we have streaming solutions,

139
00:04:34.220 --> 00:04:36.020
and we have visualization solutions,

140
00:04:36.020 --> 00:04:37.180
and time series solutions.

141
00:04:37.180 --> 00:04:38.870
So already we've replaced

142
00:04:38.870 --> 00:04:41.610
much of what the elastic stack can do,

143
00:04:41.610 --> 00:04:43.080
all within Redis itself.

144
00:04:43.080 --> 00:04:43.913
Pretty neat.

145
00:04:44.810 --> 00:04:46.360
There's also RedisAI.

146
00:04:46.360 --> 00:04:48.190
This module lets you run your inference engine

147
00:04:48.190 --> 00:04:49.760
for your machine learning models

148
00:04:49.760 --> 00:04:51.490
right where the data lives within Redis.

149
00:04:51.490 --> 00:04:53.480
So you can't get much faster than that, right?

150
00:04:53.480 --> 00:04:56.620
That can be an important part of an ML ops pipeline.

151
00:04:56.620 --> 00:04:57.820
We also have RedisGears.

152
00:04:58.810 --> 00:05:01.300
RedisGears allows you to incorporate snippets of code

153
00:05:01.300 --> 00:05:04.440
within your Redis system for real time data processing.

154
00:05:04.440 --> 00:05:07.250
So think of it as sort of like AWS Lambda,

155
00:05:07.250 --> 00:05:08.290
same general idea.

156
00:05:08.290 --> 00:05:10.810
Just exists there for writing bits of code

157
00:05:10.810 --> 00:05:13.340
to tie things together if you need to.

158
00:05:13.340 --> 00:05:14.690
And we also have RedisGraph

159
00:05:15.610 --> 00:05:18.000
that allows you to store your data in a graph structure.

160
00:05:18.000 --> 00:05:19.120
So we're talking about graph

161
00:05:19.120 --> 00:05:21.230
in the computer science data structure

162
00:05:21.230 --> 00:05:23.470
since there not you know charts and graphs,

163
00:05:23.470 --> 00:05:24.560
that sort of a thing.

164
00:05:24.560 --> 00:05:26.490
For example, if you have a social media network,

165
00:05:26.490 --> 00:05:28.820
you could use RedisGraph to represent that data,

166
00:05:28.820 --> 00:05:30.640
or some really cool applications are

167
00:05:30.640 --> 00:05:33.500
if you store e-commerce data in a graph form,

168
00:05:33.500 --> 00:05:36.210
you can use RedisGraph to very quickly generate

169
00:05:36.210 --> 00:05:38.290
real time personalized recommendations

170
00:05:38.290 --> 00:05:40.620
or things like people who bought this also bought

171
00:05:40.620 --> 00:05:41.690
with like one line of code.

172
00:05:41.690 --> 00:05:43.000
It's pretty neat stuff.

173
00:05:43.000 --> 00:05:45.340
That can take the place of things like Amazon Neptune

174
00:05:45.340 --> 00:05:50.230
or Neo4j for graph databases all within Redis itself.

175
00:05:50.230 --> 00:05:52.450
And finally we have RedisBloom

176
00:05:52.450 --> 00:05:56.020
that gives Redis support for probabilistic data structures,

177
00:05:56.020 --> 00:05:58.550
specifically the bloom and cuckoo filters

178
00:05:58.550 --> 00:06:01.955
at very large scale, again, integrated within Redis itself.

179
00:06:01.955 --> 00:06:03.570
So you can use that for things

180
00:06:03.570 --> 00:06:07.060
like building fast leaderboards or fraud mitigation,

181
00:06:07.060 --> 00:06:09.060
or limiting the exposures of ads

182
00:06:09.060 --> 00:06:11.993
to individual users very quickly at very large scale.

183
00:06:12.920 --> 00:06:16.760
So Redis has a builtin self-contained technology stack here

184
00:06:16.760 --> 00:06:17.630
that can take the place

185
00:06:17.630 --> 00:06:20.470
of much more complex web services architectures

186
00:06:20.470 --> 00:06:22.700
all under the Redis umbrella.

187
00:06:22.700 --> 00:06:23.640
It's pretty exciting stuff.

188
00:06:23.640 --> 00:06:25.850
And I really had no idea Redis could do all this myself

189
00:06:25.850 --> 00:06:26.683
until recently.

190
00:06:26.683 --> 00:06:29.430
So I'm pretty excited to share this with you.

191
00:06:29.430 --> 00:06:30.750
So to make things even easier,

192
00:06:30.750 --> 00:06:33.870
Redis has recently consolidated its most popular modules

193
00:06:33.870 --> 00:06:36.680
into a product called Redis Stack.

194
00:06:36.680 --> 00:06:38.650
Now Redis Stack consists of three components.

195
00:06:38.650 --> 00:06:39.812
One is the Redis Stack Server,

196
00:06:39.812 --> 00:06:41.326
which is just a Redis instance

197
00:06:41.326 --> 00:06:44.090
that has all the most popular modules pre-installed

198
00:06:44.090 --> 00:06:46.640
so you don't have to worry about it anymore.

199
00:06:46.640 --> 00:06:48.580
There's also the Redis Stack Tools,

200
00:06:48.580 --> 00:06:50.080
which includes the Redis Insight,

201
00:06:50.080 --> 00:06:51.190
a visualization tool

202
00:06:51.190 --> 00:06:54.200
and a way to graphically interact with your Redis Stack.

203
00:06:54.200 --> 00:06:57.130
And finally the Redis Stack Client SDK,

204
00:06:57.130 --> 00:06:57.963
as you can see here,

205
00:06:57.963 --> 00:07:00.450
there are many SDKs from many different languages here.

206
00:07:00.450 --> 00:07:03.430
In this course we're gonna be using the SDK for Python

207
00:07:03.430 --> 00:07:06.230
using something called Redis OM, the object mapping library,

208
00:07:06.230 --> 00:07:09.790
but that's part of the Redis Stack Client SDK now.

209
00:07:09.790 --> 00:07:11.470
So going forward Redis is talking more

210
00:07:11.470 --> 00:07:14.740
about the Redis Stack and less about individual modules.

211
00:07:14.740 --> 00:07:16.320
The objective is to get all those modules

212
00:07:16.320 --> 00:07:17.275
into the stack over time.

213
00:07:17.275 --> 00:07:19.620
So we can stop thinking about the modules

214
00:07:19.620 --> 00:07:22.320
as individual entities are all just built in features

215
00:07:22.320 --> 00:07:23.723
of Redis Stack as a whole.

216
00:07:24.690 --> 00:07:26.290
Within this course we're gonna get hands on

217
00:07:26.290 --> 00:07:28.560
and actually build something with this stuff.

218
00:07:28.560 --> 00:07:30.060
So what we're gonna do is work

219
00:07:30.958 --> 00:07:32.374
with a public data model

220
00:07:32.374 --> 00:07:35.930
based on retail data from a UK based online gift store.

221
00:07:35.930 --> 00:07:37.320
So we have a real data set here

222
00:07:37.320 --> 00:07:39.500
that we got from the UCI repository.

223
00:07:39.500 --> 00:07:41.935
That's going to be containing a bunch of data

224
00:07:41.935 --> 00:07:43.396
about stuff people bought

225
00:07:43.396 --> 00:07:44.830
from this online gift store over time.

226
00:07:44.830 --> 00:07:46.560
We're gonna start by using RedisCore

227
00:07:46.560 --> 00:07:48.430
and we'll give you some quick examples

228
00:07:48.430 --> 00:07:49.890
of how you might use that for caching

229
00:07:49.890 --> 00:07:53.050
because well that's still a popular use of Redis,

230
00:07:53.050 --> 00:07:55.260
and we'll also demonstrate the use of streaming

231
00:07:55.260 --> 00:07:58.660
using RedisCore and how to pipe data from your servers

232
00:07:58.660 --> 00:08:01.500
to some other place using Redis alone.

233
00:08:01.500 --> 00:08:03.170
We'll also use RedisJSON.

234
00:08:03.170 --> 00:08:05.515
And again, we're gonna use that

235
00:08:05.515 --> 00:08:07.890
as sort of a node SQL distributed database of our own.

236
00:08:07.890 --> 00:08:10.940
So we'll use that to actually store our eCommerce data

237
00:08:10.940 --> 00:08:12.254
in JSON structured format

238
00:08:12.254 --> 00:08:14.680
with these little nested data structures and stuff,

239
00:08:14.680 --> 00:08:17.270
and show you how that works hands on.

240
00:08:17.270 --> 00:08:18.870
We'll also use RedisSearch under the hood

241
00:08:18.870 --> 00:08:20.590
to query at data

242
00:08:20.590 --> 00:08:21.780
and actually get results back from it

243
00:08:21.780 --> 00:08:23.650
in real time very quickly.

244
00:08:23.650 --> 00:08:25.740
We'll use RedisTimeSeries.

245
00:08:25.740 --> 00:08:27.300
The example we'll use there is

246
00:08:27.300 --> 00:08:31.010
by analyzing the order quantity data over time.

247
00:08:31.010 --> 00:08:34.420
So we'll be able to visualize again, using Redis Insight,

248
00:08:34.420 --> 00:08:35.810
real time charts and graphs

249
00:08:35.810 --> 00:08:37.773
of how those orders are changing over time

250
00:08:37.773 --> 00:08:38.873
using RedisTimeSeries.

251
00:08:40.275 --> 00:08:42.270
And finally, we'll use RedisGraph.

252
00:08:42.270 --> 00:08:43.103
Like I talked about,

253
00:08:43.103 --> 00:08:45.410
we can use that to make personalized product recommendations

254
00:08:45.410 --> 00:08:47.590
and you might be surprised at how good

255
00:08:47.590 --> 00:08:48.810
they end up actually being

256
00:08:48.810 --> 00:08:51.193
when we actually try this with real data.

257
00:08:51.193 --> 00:08:52.320
So with that, let's get you set up

258
00:08:52.320 --> 00:08:54.520
and we'll start playing hands on.

259
00:08:54.520 --> 00:08:57.080
We'll start off by setting up Python on your desktop system

260
00:08:57.080 --> 00:08:59.230
if you don't already have it installed, probably do.

261
00:08:59.230 --> 00:09:01.330
But if not, we have to talk about that.

262
00:09:01.330 --> 00:09:04.580
We'll then set you up with a free account for Redis Cloud.

263
00:09:04.580 --> 00:09:06.820
That doesn't cost you a penny to just play around with it.

264
00:09:06.820 --> 00:09:08.800
So we'll show you how to do that.

265
00:09:08.800 --> 00:09:10.400
Back on your desktop,

266
00:09:10.400 --> 00:09:12.710
we're going to install the Redis tools package,

267
00:09:12.710 --> 00:09:14.960
which will give us a command line interface to Redis.

268
00:09:14.960 --> 00:09:16.680
And also Redis OM,

269
00:09:16.680 --> 00:09:18.040
which we'll talk about more later on,

270
00:09:18.040 --> 00:09:20.460
but that's gonna give us the Python APIs

271
00:09:20.460 --> 00:09:23.620
that we need to communicate with our Redis Cloud instance.

272
00:09:23.620 --> 00:09:25.390
We'll also download the course's scripts

273
00:09:25.390 --> 00:09:27.100
and data while we're at it.

274
00:09:27.100 --> 00:09:29.510
And then we'll try out some simple cache operations

275
00:09:29.510 --> 00:09:31.180
just to convince ourselves that it all works.

276
00:09:31.180 --> 00:09:32.253
So let's dive in.

