Lecturer: Okay, so now let's do a little bit of dive
into how Redis is going to be seen for the SysOps exam.
And first of all, you need to know how to scale Redis.
So there are two modes for Redis,
there's a cluster mode disabled,
and the cluster mode enabled.
So in case of cluster mode disabled,
then we just have one node group
with a primary node and up to zero and five replica nodes.
So if you want to do horizontal scaling,
that means adding instances or removing instances
while it's as easy as adding and removing
read replicas from your node group,
and as you know, you can have a maximum of five replicas.
The other kind of scaling you can do for Redis
is going to be vertical scaling.
In this case, you're going to scale up or down
to larger or smaller node types, okay?
So that means you're going to change the instance type
behind your LST cache cluster.
And so to do so is going to be a one-click operation
in Redis as well.
But you need to know that internally
what's going to happen is that elastic cache
will create a new node group.
And then they will be a data replication
from the old node group to the new node group.
And then finally, once this replication has happened,
then there's going to be a DNS update
being done by LST cache service
so that it's transparent for your application
and they can connect to the new node group directly.
So that's for cluster mode disabled,
now for cluster mode enabled
it gets a little bit more complicated.
So there are two kinds of scaling,
the first one is online scaling
where your cluster is still up and running
during the scaling process,
that means there is no downtime
and you may get some degradation in performance,
but your Redis cluster is up and running.
And Offline Scaling, which is that,
you'll take your entire cluster offline.
So you will not be able to serve requests
during the scaling process, okay.
But then you can do more configuration changes
for example, node types or upgrading the engine version.
So if we have a look at horizontal scaling
for cluster mode enabled,
then you can do resharding,
that means scaling in and out
by adding and removing shards, okay.
So in cluster mode enabled,
remember we have multiple shards,
so we can horizontally scale by adding more shards,
or you can do shard rebalancing
to distribute the key space
among the shards as much as possible.
And this horizontal scaling is supported
for both online and offline modes, okay.
So you can keep it up or take it down
if you wanted to add horizontal scaling.
Now for vertical scaling,
which is to change the node types, okay.
To change the read/write capacity.
So you want to change to a larger or a smaller node type,
and this supports online scaling,
and again, this is a one-click thing,
and this is going to happen behind the scenes.
Okay, now for Redis metrics to monitor.
So we have a few metrics
that should make sense for a cache technology.
So the first one is eviction,
so this is the number of non expired items
that the cache evicted to allow space for new writes,
so that means that you have memory being overfilled.
So the solution is to choose an eviction policy
to evict expired item,
that means that for example,
you want to evict automatically
the least recently used items
to make sure that you don't have too many evictions,
or you want to have a larger node type,
for our example,
to you have more memory
or you want to scale out by adding more nodes, for example,
if you're using Redis in cluster mode enabled.
Then you want to monitor obviously the CPU utilization,
that means that if it's too high,
then you want to scale up to a larger node time,
or you want to scale out horizontally by adding more nodes
and Swap Usage should not exceed 50 megabytes,
and if so, if it does,
please make sure you look at your memory settings.
Then we have current connections,
so this is a number of current and active connections
to your Redis cluster,
and if it's too high,
then maybe your application is having some bad behavior
and initiating a connection every single time to Reddis
in that case, this is bad,
and have a look at the application behavior,
the database memory usage percentage,
which is a percentage of memory utilization,
and then network in and outs
and replication bytes or replication lag,
which is giving you some information
around the replication of the data
within your Redis cluster.
And so obviously you want the replication bytes to be high
and replication lag to be low,
so that there is no lag between the replica,
the re-replica and the main nodes, okay?
So that's it, that's all you need to know for Redis,
obviously hopefully everything
should be quite intuitive, okay.
But it's good to see it once.
And I will see you in the next lecture.