SlideShare a Scribd company logo
+

Redis {beyond the basics}
Presented by
Steph ☺
+

Outline
■

Revisiting Redis

■

Keeping data safe
■
■

Replication

■

Replacing Failed Master

■

■

Persistence

Transaction

Reducing memory use
■
■

Intlist

■

■

Ziplist
Sharding

Scaling
+

Redis
■

In-memory remote database

■

Advanced key-value store

■

Data-structure server

■

Offers
■

High Performance

■

Replication

■

Unique data model
+

Snapshotting
{Persistence}
■

Data is taken as it exists and is written to the disk

■

Point-in-time copy of in-memory data

■

Backup & transfer to other server

■

Written to file in “dbfilename” stored in “dir”

■

Until next snapshot is taken, last snapshot can be lost if redis
crashes
+

Snapshotting
{Persistence}
Initiating Snapshots
■

bgsave

■

SAVE

■

Save lines save 60 10000

■

SHUTDOWN / TERM

■

SYNC
+

Snapshotting

■

How often to perform an automatic snapshot

■

Accept writes on failure

■

Snapshot compression

■

What to name the snapshot on the disk
+

Append Only File (AOF)
{Persistence}
■

Copies incoming write commands as it happens

■

Records data changes at the end of the backup file

■

Data set could be recovered with replaying AOF

■

“append only yes”

■

“appendfsyc always”

■

Limited by disk performance
+

Append Only File (AOF)

■

Option to use AOF

■

Occurrence of sync writes to disk

■

Option to sync during AOF compaction

■

Occurrence of AOF compaction
+

Replication
■

Method where other servers receive an updated copy of the
data as its being written

■

Replicas can service read queries

■

Single master database sends writes out to multiple slave
databases

■

Set operations can take seconds to finish
+

Replication
■

Configuring for replication
On master, ensure that the path and filename are writable
by redis process
■ Enable slaving : slaveof host port
■ In a running system, redis can be stopped slaving or
connect to a different master
■ New / Transfer connection: slaveof host port
■ Stop data update: SLAVEOF no one
■
+

Replication
{SLAVE to MASTER Connection}
+

Replication
{Redis Master-Slave Replica Tree}
+

Replacing Failed Master
{Scenario and Solution}
■

What will we do in case of system failure?

■

Scenario
■
■

Machine A loses network connectivity

■

■

Machine A – Redis Master, Machine B – Redis Slave
Machine C has Redis, but no copy of data

Solution A
■

Make a fresh snapshot using Machine B using SAVE

■

Copy snapshot to Machine C

■

Start Redis on Machine C

■

Tell Machine B to be a slave of Machine C
+

Replacing Failed Master
{Sequence of Commands}
+

Replacing Failed Master
{Scenario and Solution}
■

What will we do in case of system failure?

■

Solution B
■

Use Machine B (Slave) as Master

■

Create a new Slave (maybe Machine C)

■

Update client configuration to read/write to proper servers

■

(optional) update server configuration if restart is needed
+

Transactions
■

Begin transaction with MULTI

■

Execute commands with EXEC

■

Delayed execution with multi/exec can improve
performance
■

Holds off sending commands until all of them are known

■

When all of the commands are known, MULTI is sent by client
+

Transactions
■

Pipelining
■

Send multiple commands at once

■

Wait for all replies

■

Reduces number of network roundtrips that the client waits for
+

Reducing Memory Use
{Short Structures}
■

Method of reducing memory use

■

Ziplist – compact storage and unstructured representation of LISTs
HASHes and ZSETs

■

Intset – compact representation of SET

■

As structures grow beyond limits, they are converted back to their
original data structure type

■

Manipulating compact versions can become slow as they grow
+

Ziplist

■

Basic configuration for the 3 data types are similar

■

*-max-ziplist-value – max number of items to be encoded as ziplist

■

If limits are exceeded, redis will convert the list/hash/zset into non-ziplist
structure
+

ZIPLIST - LIST
+

Intset
+

Sharded Structures
■

Sharding – takes data, partitions it to smaller pieces and
sends data to different locations depending on which
partition the data is assigned to

■

Sharding LISTs – uses LUA scripting

■

Sharding ZSETs – zset operations on shards violate how
quickly zsets perform, sharding is not useful on zsets
+

Sharded Structures
■

Sharding HASHes
■

Method of partitioning data must be chosen

■

Hash’s keys can be used as source of info for sharding

■

To partition keys:
■

Calculate hash function on the key

■

Calculate number of shards needed depending on number of keys
we want to fit in one shard and the total number of keys

■

Resulting number of shards along with hash value will be used to
find out which shard we’ll use
+

Scaling
{read capacity}
■

In using small structures, make sure max ziplist is not too
large

■

Use structures that offer good performance for the types of
queries we want to perform

■

Compress large data sent to redis for caching to reduce
network reads and writes

■

Use pipelining and connection pooling
+

Scaling
{read capacity}
■

Increase total read throughput using read only slave servers
■
■

■

Always remember to WRITE TO THE MASTER
Writing on SLAVE will cause an error

Redis Sentinel
■

Mode where redis server binary doesn’t act like the typical one

■

Watches behavior and health of master(s) and slave(s)

■

Intended to offer automated failover
+

Scaling
{memory capacity}
■

Make sure to check all methods to reduce read data volume

■

Make sure larger pieces of unrelated functionality are moved to
different servers

■

Aggregate writes in local memory before writing to redis

■

Consider using locks or LUA when limitations such as
watch/multi/exec are encountered

■

When using AOF, keep in mind that the disk needs to keep up
with the volume we’re writing
+

Scaling
{write capability}
■

Presharding for growth
■

Run multiple redis servers on your machine (listen on diff. ports)

■

Use multiple redis database on your database server
+

Scaling
{complex queries}
■

Scenario : machines have enough memory to hold index, but we need to
execute more queries that server can handle

■

Use : SUNIONSTORE, SINTERSTORE, SDIFFSTORE, ZINTERSTORE,
and/or ZUNIONSTORE

■

Since we “read” from slave, set : slave-read-only no
+

Reference
■

Carlson, Josiah. (2013) Redis in Action. Shelter Island, NY: Manning
Publications
+

Thank You ☺

More Related Content

What's hot

Seastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for CephSeastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for CephScyllaDB
 
Erasure codes and storage tiers on gluster
Erasure codes and storage tiers on glusterErasure codes and storage tiers on gluster
Erasure codes and storage tiers on glusterRed_Hat_Storage
 
DB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory ModesDB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory ModesScyllaDB
 
Avoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleAvoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleScyllaDB
 
Challenges with Gluster and Persistent Memory with Dan Lambright
Challenges with Gluster and Persistent Memory with Dan LambrightChallenges with Gluster and Persistent Memory with Dan Lambright
Challenges with Gluster and Persistent Memory with Dan LambrightGluster.org
 
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...In-Memory Computing Summit
 
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...ScyllaDB
 
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Gluster.org
 
HBase at Flurry
HBase at FlurryHBase at Flurry
HBase at Flurryddlatham
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryMongoDB
 
Sharding: Past, Present and Future with Krutika Dhananjay
Sharding: Past, Present and Future with Krutika DhananjaySharding: Past, Present and Future with Krutika Dhananjay
Sharding: Past, Present and Future with Krutika DhananjayGluster.org
 
Realtime Indexing for Fast Queries on Massive Semi-Structured Data
Realtime Indexing for Fast Queries on Massive Semi-Structured DataRealtime Indexing for Fast Queries on Massive Semi-Structured Data
Realtime Indexing for Fast Queries on Massive Semi-Structured DataScyllaDB
 
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...MongoDB
 
InfluxDB Internals
InfluxDB InternalsInfluxDB Internals
InfluxDB InternalsInfluxData
 
BigTable PreReading
BigTable PreReadingBigTable PreReading
BigTable PreReadingeverestsun
 
Life as a GlusterFS Consultant with Ivan Rossi
Life as a GlusterFS Consultant with Ivan RossiLife as a GlusterFS Consultant with Ivan Rossi
Life as a GlusterFS Consultant with Ivan RossiGluster.org
 
Performance Analysis and Troubleshooting Methodologies for Databases
Performance Analysis and Troubleshooting Methodologies for DatabasesPerformance Analysis and Troubleshooting Methodologies for Databases
Performance Analysis and Troubleshooting Methodologies for DatabasesScyllaDB
 
Building an Efficient AI Training Platform at bilibili with Alluxio
Building an Efficient AI Training Platform at bilibili with AlluxioBuilding an Efficient AI Training Platform at bilibili with Alluxio
Building an Efficient AI Training Platform at bilibili with AlluxioAlluxio, Inc.
 
Speed Up Uber's Presto with Alluxio
Speed Up Uber's Presto with AlluxioSpeed Up Uber's Presto with Alluxio
Speed Up Uber's Presto with AlluxioAlluxio, Inc.
 

What's hot (19)

Seastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for CephSeastore: Next Generation Backing Store for Ceph
Seastore: Next Generation Backing Store for Ceph
 
Erasure codes and storage tiers on gluster
Erasure codes and storage tiers on glusterErasure codes and storage tiers on gluster
Erasure codes and storage tiers on gluster
 
DB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory ModesDB Latency Using DRAM + PMem in App Direct & Memory Modes
DB Latency Using DRAM + PMem in App Direct & Memory Modes
 
Avoiding Data Hotspots at Scale
Avoiding Data Hotspots at ScaleAvoiding Data Hotspots at Scale
Avoiding Data Hotspots at Scale
 
Challenges with Gluster and Persistent Memory with Dan Lambright
Challenges with Gluster and Persistent Memory with Dan LambrightChallenges with Gluster and Persistent Memory with Dan Lambright
Challenges with Gluster and Persistent Memory with Dan Lambright
 
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
IMC Summit 2016 Breakout - Andy Pavlo - What Non-Volatile Memory Means for th...
 
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
Vanquishing Latency Outliers in the Lightbits LightOS Software Defined Storag...
 
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
Performance bottlenecks for metadata workload in Gluster with Poornima Gurusi...
 
HBase at Flurry
HBase at FlurryHBase at Flurry
HBase at Flurry
 
Backup, Restore, and Disaster Recovery
Backup, Restore, and Disaster RecoveryBackup, Restore, and Disaster Recovery
Backup, Restore, and Disaster Recovery
 
Sharding: Past, Present and Future with Krutika Dhananjay
Sharding: Past, Present and Future with Krutika DhananjaySharding: Past, Present and Future with Krutika Dhananjay
Sharding: Past, Present and Future with Krutika Dhananjay
 
Realtime Indexing for Fast Queries on Massive Semi-Structured Data
Realtime Indexing for Fast Queries on Massive Semi-Structured DataRealtime Indexing for Fast Queries on Massive Semi-Structured Data
Realtime Indexing for Fast Queries on Massive Semi-Structured Data
 
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
MongoDB 101 & Beyond: Get Started in MongoDB 3.0, Preview 3.2 & Demo of Ops M...
 
InfluxDB Internals
InfluxDB InternalsInfluxDB Internals
InfluxDB Internals
 
BigTable PreReading
BigTable PreReadingBigTable PreReading
BigTable PreReading
 
Life as a GlusterFS Consultant with Ivan Rossi
Life as a GlusterFS Consultant with Ivan RossiLife as a GlusterFS Consultant with Ivan Rossi
Life as a GlusterFS Consultant with Ivan Rossi
 
Performance Analysis and Troubleshooting Methodologies for Databases
Performance Analysis and Troubleshooting Methodologies for DatabasesPerformance Analysis and Troubleshooting Methodologies for Databases
Performance Analysis and Troubleshooting Methodologies for Databases
 
Building an Efficient AI Training Platform at bilibili with Alluxio
Building an Efficient AI Training Platform at bilibili with AlluxioBuilding an Efficient AI Training Platform at bilibili with Alluxio
Building an Efficient AI Training Platform at bilibili with Alluxio
 
Speed Up Uber's Presto with Alluxio
Speed Up Uber's Presto with AlluxioSpeed Up Uber's Presto with Alluxio
Speed Up Uber's Presto with Alluxio
 

Viewers also liked

大型网站架构的发展
大型网站架构的发展大型网站架构的发展
大型网站架构的发展Hesey
 
GIMP 2.8 - Efeito foto rasgada
GIMP 2.8 - Efeito foto rasgadaGIMP 2.8 - Efeito foto rasgada
GIMP 2.8 - Efeito foto rasgadaLissandraFischer
 
The simplethebeautiful
The simplethebeautifulThe simplethebeautiful
The simplethebeautifulmysqlops
 
Oracle数据库分析函数详解
Oracle数据库分析函数详解Oracle数据库分析函数详解
Oracle数据库分析函数详解mysqlops
 
제7장223p 정의적특성평가의이해 4김정관
제7장223p 정의적특성평가의이해 4김정관 제7장223p 정의적특성평가의이해 4김정관
제7장223p 정의적특성평가의이해 4김정관 Minsoo Jung
 
Redis运维之道
Redis运维之道Redis运维之道
Redis运维之道jackbillow
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redisiammutex
 

Viewers also liked (8)

大型网站架构的发展
大型网站架构的发展大型网站架构的发展
大型网站架构的发展
 
GIMP 2.8 - Efeito foto rasgada
GIMP 2.8 - Efeito foto rasgadaGIMP 2.8 - Efeito foto rasgada
GIMP 2.8 - Efeito foto rasgada
 
The simplethebeautiful
The simplethebeautifulThe simplethebeautiful
The simplethebeautiful
 
Peirce tp
Peirce tpPeirce tp
Peirce tp
 
Oracle数据库分析函数详解
Oracle数据库分析函数详解Oracle数据库分析函数详解
Oracle数据库分析函数详解
 
제7장223p 정의적특성평가의이해 4김정관
제7장223p 정의적특성평가의이해 4김정관 제7장223p 정의적특성평가의이해 4김정관
제7장223p 정의적특성평가의이해 4김정관
 
Redis运维之道
Redis运维之道Redis运维之道
Redis运维之道
 
深入了解Redis
深入了解Redis深入了解Redis
深入了解Redis
 

Similar to Redis Beyond

MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB plc
 
Aerospike Hybrid Memory Architecture
Aerospike Hybrid Memory ArchitectureAerospike Hybrid Memory Architecture
Aerospike Hybrid Memory ArchitectureAerospike, Inc.
 
Aerospike Architecture
Aerospike ArchitectureAerospike Architecture
Aerospike ArchitecturePeter Milne
 
PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013Andrew Dunstan
 
C# as a System Language
C# as a System LanguageC# as a System Language
C# as a System LanguageScyllaDB
 
High-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deploymentHigh-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deploymentFederico Razzoli
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB plc
 
Red Hat Gluster Storage Performance
Red Hat Gluster Storage PerformanceRed Hat Gluster Storage Performance
Red Hat Gluster Storage PerformanceRed_Hat_Storage
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMariaDB plc
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMariaDB plc
 
Serverless Apps on Google Cloud: more dev, less ops
Serverless Apps on Google Cloud:  more dev, less opsServerless Apps on Google Cloud:  more dev, less ops
Serverless Apps on Google Cloud: more dev, less opsJoseph Lust
 
Serverless Apps on Google Cloud: more dev, less ops
Serverless Apps on Google Cloud: more dev, less opsServerless Apps on Google Cloud: more dev, less ops
Serverless Apps on Google Cloud: more dev, less opsmabl
 
Automation of Hadoop cluster operations in Arm Treasure Data
Automation of Hadoop cluster operations in Arm Treasure DataAutomation of Hadoop cluster operations in Arm Treasure Data
Automation of Hadoop cluster operations in Arm Treasure DataYan Wang
 
AWSome day 2018 - database in cloud
AWSome day 2018 -  database in cloudAWSome day 2018 -  database in cloud
AWSome day 2018 - database in cloudCorley S.r.l.
 
EVCache: Lowering Costs for a Low Latency Cache with RocksDB
EVCache: Lowering Costs for a Low Latency Cache with RocksDBEVCache: Lowering Costs for a Low Latency Cache with RocksDB
EVCache: Lowering Costs for a Low Latency Cache with RocksDBScott Mansfield
 
Capacity Planning
Capacity PlanningCapacity Planning
Capacity PlanningMongoDB
 
Building Efficient Multi-Threaded Filters for Faster SQL Queries
Building Efficient Multi-Threaded Filters for Faster SQL QueriesBuilding Efficient Multi-Threaded Filters for Faster SQL Queries
Building Efficient Multi-Threaded Filters for Faster SQL QueriesScyllaDB
 
Big data should be simple
Big data should be simpleBig data should be simple
Big data should be simpleDori Waldman
 
MariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB plc
 

Similar to Redis Beyond (20)

MariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance OptimizationMariaDB Paris Workshop 2023 - Performance Optimization
MariaDB Paris Workshop 2023 - Performance Optimization
 
Aerospike Hybrid Memory Architecture
Aerospike Hybrid Memory ArchitectureAerospike Hybrid Memory Architecture
Aerospike Hybrid Memory Architecture
 
Aerospike Architecture
Aerospike ArchitectureAerospike Architecture
Aerospike Architecture
 
Memcache d
Memcache dMemcache d
Memcache d
 
PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013PostgreSQL and Redis - talk at pgcon 2013
PostgreSQL and Redis - talk at pgcon 2013
 
C# as a System Language
C# as a System LanguageC# as a System Language
C# as a System Language
 
High-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deploymentHigh-level architecture of a complete MariaDB deployment
High-level architecture of a complete MariaDB deployment
 
MariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & OptimizationMariaDB Server Performance Tuning & Optimization
MariaDB Server Performance Tuning & Optimization
 
Red Hat Gluster Storage Performance
Red Hat Gluster Storage PerformanceRed Hat Gluster Storage Performance
Red Hat Gluster Storage Performance
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Maximizing performance via tuning and optimization
Maximizing performance via tuning and optimizationMaximizing performance via tuning and optimization
Maximizing performance via tuning and optimization
 
Serverless Apps on Google Cloud: more dev, less ops
Serverless Apps on Google Cloud:  more dev, less opsServerless Apps on Google Cloud:  more dev, less ops
Serverless Apps on Google Cloud: more dev, less ops
 
Serverless Apps on Google Cloud: more dev, less ops
Serverless Apps on Google Cloud: more dev, less opsServerless Apps on Google Cloud: more dev, less ops
Serverless Apps on Google Cloud: more dev, less ops
 
Automation of Hadoop cluster operations in Arm Treasure Data
Automation of Hadoop cluster operations in Arm Treasure DataAutomation of Hadoop cluster operations in Arm Treasure Data
Automation of Hadoop cluster operations in Arm Treasure Data
 
AWSome day 2018 - database in cloud
AWSome day 2018 -  database in cloudAWSome day 2018 -  database in cloud
AWSome day 2018 - database in cloud
 
EVCache: Lowering Costs for a Low Latency Cache with RocksDB
EVCache: Lowering Costs for a Low Latency Cache with RocksDBEVCache: Lowering Costs for a Low Latency Cache with RocksDB
EVCache: Lowering Costs for a Low Latency Cache with RocksDB
 
Capacity Planning
Capacity PlanningCapacity Planning
Capacity Planning
 
Building Efficient Multi-Threaded Filters for Faster SQL Queries
Building Efficient Multi-Threaded Filters for Faster SQL QueriesBuilding Efficient Multi-Threaded Filters for Faster SQL Queries
Building Efficient Multi-Threaded Filters for Faster SQL Queries
 
Big data should be simple
Big data should be simpleBig data should be simple
Big data should be simple
 
MariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and OptimizationMariaDB Performance Tuning and Optimization
MariaDB Performance Tuning and Optimization
 

Recently uploaded

Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaRTTS
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupCatarinaPereira64715
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Alison B. Lowndes
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...Elena Simperl
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Frank van Harmelen
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™UiPathCommunity
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor TurskyiFwdays
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...Product School
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Product School
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf91mobiles
 
UiPath New York Community Day in-person event
UiPath New York Community Day in-person eventUiPath New York Community Day in-person event
UiPath New York Community Day in-person eventDianaGray10
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Product School
 
КАТЕРИНА АБЗЯТОВА «Ефективне планування тестування ключові аспекти та практ...
КАТЕРИНА АБЗЯТОВА  «Ефективне планування тестування  ключові аспекти та практ...КАТЕРИНА АБЗЯТОВА  «Ефективне планування тестування  ключові аспекти та практ...
КАТЕРИНА АБЗЯТОВА «Ефективне планування тестування ключові аспекти та практ...QADay
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backElena Simperl
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsPaul Groth
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...Product School
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
 

Recently uploaded (20)

Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
ODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User GroupODC, Data Fabric and Architecture User Group
ODC, Data Fabric and Architecture User Group
 
Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........Bits & Pixels using AI for Good.........
Bits & Pixels using AI for Good.........
 
When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*Neuro-symbolic is not enough, we need neuro-*semantic*
Neuro-symbolic is not enough, we need neuro-*semantic*
 
GraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge GraphGraphRAG is All You need? LLM & Knowledge Graph
GraphRAG is All You need? LLM & Knowledge Graph
 
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
Le nuove frontiere dell'AI nell'RPA con UiPath Autopilot™
 
"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi"Impact of front-end architecture on development cost", Viktor Turskyi
"Impact of front-end architecture on development cost", Viktor Turskyi
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...Mission to Decommission: Importance of Decommissioning Products to Increase E...
Mission to Decommission: Importance of Decommissioning Products to Increase E...
 
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdfSmart TV Buyer Insights Survey 2024 by 91mobiles.pdf
Smart TV Buyer Insights Survey 2024 by 91mobiles.pdf
 
UiPath New York Community Day in-person event
UiPath New York Community Day in-person eventUiPath New York Community Day in-person event
UiPath New York Community Day in-person event
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
КАТЕРИНА АБЗЯТОВА «Ефективне планування тестування ключові аспекти та практ...
КАТЕРИНА АБЗЯТОВА  «Ефективне планування тестування  ключові аспекти та практ...КАТЕРИНА АБЗЯТОВА  «Ефективне планування тестування  ключові аспекти та практ...
КАТЕРИНА АБЗЯТОВА «Ефективне планування тестування ключові аспекти та практ...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMsTo Graph or Not to Graph Knowledge Graph Architectures and LLMs
To Graph or Not to Graph Knowledge Graph Architectures and LLMs
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
From Siloed Products to Connected Ecosystem: Building a Sustainable and Scala...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 

Redis Beyond

  • 1. + Redis {beyond the basics} Presented by Steph ☺
  • 2. + Outline ■ Revisiting Redis ■ Keeping data safe ■ ■ Replication ■ Replacing Failed Master ■ ■ Persistence Transaction Reducing memory use ■ ■ Intlist ■ ■ Ziplist Sharding Scaling
  • 3. + Redis ■ In-memory remote database ■ Advanced key-value store ■ Data-structure server ■ Offers ■ High Performance ■ Replication ■ Unique data model
  • 4. + Snapshotting {Persistence} ■ Data is taken as it exists and is written to the disk ■ Point-in-time copy of in-memory data ■ Backup & transfer to other server ■ Written to file in “dbfilename” stored in “dir” ■ Until next snapshot is taken, last snapshot can be lost if redis crashes
  • 6. + Snapshotting ■ How often to perform an automatic snapshot ■ Accept writes on failure ■ Snapshot compression ■ What to name the snapshot on the disk
  • 7. + Append Only File (AOF) {Persistence} ■ Copies incoming write commands as it happens ■ Records data changes at the end of the backup file ■ Data set could be recovered with replaying AOF ■ “append only yes” ■ “appendfsyc always” ■ Limited by disk performance
  • 8. + Append Only File (AOF) ■ Option to use AOF ■ Occurrence of sync writes to disk ■ Option to sync during AOF compaction ■ Occurrence of AOF compaction
  • 9. + Replication ■ Method where other servers receive an updated copy of the data as its being written ■ Replicas can service read queries ■ Single master database sends writes out to multiple slave databases ■ Set operations can take seconds to finish
  • 10. + Replication ■ Configuring for replication On master, ensure that the path and filename are writable by redis process ■ Enable slaving : slaveof host port ■ In a running system, redis can be stopped slaving or connect to a different master ■ New / Transfer connection: slaveof host port ■ Stop data update: SLAVEOF no one ■
  • 13. + Replacing Failed Master {Scenario and Solution} ■ What will we do in case of system failure? ■ Scenario ■ ■ Machine A loses network connectivity ■ ■ Machine A – Redis Master, Machine B – Redis Slave Machine C has Redis, but no copy of data Solution A ■ Make a fresh snapshot using Machine B using SAVE ■ Copy snapshot to Machine C ■ Start Redis on Machine C ■ Tell Machine B to be a slave of Machine C
  • 15. + Replacing Failed Master {Scenario and Solution} ■ What will we do in case of system failure? ■ Solution B ■ Use Machine B (Slave) as Master ■ Create a new Slave (maybe Machine C) ■ Update client configuration to read/write to proper servers ■ (optional) update server configuration if restart is needed
  • 16. + Transactions ■ Begin transaction with MULTI ■ Execute commands with EXEC ■ Delayed execution with multi/exec can improve performance ■ Holds off sending commands until all of them are known ■ When all of the commands are known, MULTI is sent by client
  • 17. + Transactions ■ Pipelining ■ Send multiple commands at once ■ Wait for all replies ■ Reduces number of network roundtrips that the client waits for
  • 18. + Reducing Memory Use {Short Structures} ■ Method of reducing memory use ■ Ziplist – compact storage and unstructured representation of LISTs HASHes and ZSETs ■ Intset – compact representation of SET ■ As structures grow beyond limits, they are converted back to their original data structure type ■ Manipulating compact versions can become slow as they grow
  • 19. + Ziplist ■ Basic configuration for the 3 data types are similar ■ *-max-ziplist-value – max number of items to be encoded as ziplist ■ If limits are exceeded, redis will convert the list/hash/zset into non-ziplist structure
  • 22. + Sharded Structures ■ Sharding – takes data, partitions it to smaller pieces and sends data to different locations depending on which partition the data is assigned to ■ Sharding LISTs – uses LUA scripting ■ Sharding ZSETs – zset operations on shards violate how quickly zsets perform, sharding is not useful on zsets
  • 23. + Sharded Structures ■ Sharding HASHes ■ Method of partitioning data must be chosen ■ Hash’s keys can be used as source of info for sharding ■ To partition keys: ■ Calculate hash function on the key ■ Calculate number of shards needed depending on number of keys we want to fit in one shard and the total number of keys ■ Resulting number of shards along with hash value will be used to find out which shard we’ll use
  • 24. + Scaling {read capacity} ■ In using small structures, make sure max ziplist is not too large ■ Use structures that offer good performance for the types of queries we want to perform ■ Compress large data sent to redis for caching to reduce network reads and writes ■ Use pipelining and connection pooling
  • 25. + Scaling {read capacity} ■ Increase total read throughput using read only slave servers ■ ■ ■ Always remember to WRITE TO THE MASTER Writing on SLAVE will cause an error Redis Sentinel ■ Mode where redis server binary doesn’t act like the typical one ■ Watches behavior and health of master(s) and slave(s) ■ Intended to offer automated failover
  • 26. + Scaling {memory capacity} ■ Make sure to check all methods to reduce read data volume ■ Make sure larger pieces of unrelated functionality are moved to different servers ■ Aggregate writes in local memory before writing to redis ■ Consider using locks or LUA when limitations such as watch/multi/exec are encountered ■ When using AOF, keep in mind that the disk needs to keep up with the volume we’re writing
  • 27. + Scaling {write capability} ■ Presharding for growth ■ Run multiple redis servers on your machine (listen on diff. ports) ■ Use multiple redis database on your database server
  • 28. + Scaling {complex queries} ■ Scenario : machines have enough memory to hold index, but we need to execute more queries that server can handle ■ Use : SUNIONSTORE, SINTERSTORE, SDIFFSTORE, ZINTERSTORE, and/or ZUNIONSTORE ■ Since we “read” from slave, set : slave-read-only no
  • 29. + Reference ■ Carlson, Josiah. (2013) Redis in Action. Shelter Island, NY: Manning Publications