SlideShare a Scribd company logo
1 of 41
Redis Modules
A Crash Course In Redis Advanced Features
Hello World
Open source. The leading in-memory database platform,
supporting any high performance operational, analytics or
hybrid use case.
The open source home and commercial provider of Redis
Enterprise (Redise) technology, platform, products & services.
2
TalshkolnikSolution Architect at Redis Labs.
A Brief Overview of Redis
● Key => Data Structure server
● In memory
● Disk backed
● Scalable
● Modular
● Fast
Redis Top Differentiators
Simplicity ExtensibilityPerformance
NoSQL Benchmark
1
Redis Data Structures
2 3
Redis Modules
4
Lists
Hashes
Bitmaps
Strings
Bit field
Streams
Hyperloglog
Sorted Sets
Sets
Geospatial Indexes
Performance: The Most Powerful Database
Highest Throughput at Lowest Latency
in High Volume of Writes Scenario
Least Servers Needed to
Deliver 1 Million Writes/Sec
Benchmarks performed by Avalon Consulting Group Benchmarks published in the Google blog
5
1
Serversusedtoachieve1Mwrites/sec
Simplicity: Data Structures - Redis’ Building Blocks
Lists
[ A → B → C → D → E ]
Hashes
{ A: “foo”, B: “bar”, C: “baz” }
Bitmaps
0011010101100111001010
Strings
"I'm a Plain Text String!”
Bit field
{23334}{112345569}{766538}
Key
6
2
Streams
→{id1=time1.seq1(A:“xyz”, B:“cdf”),
d2=time2.seq2(D:“abc”, )}→
Hyperloglog
00110101 11001110
Sorted Sets
{ A: 0.1, B: 0.3, C: 100 }
Sets
{ A , B , C , D , E }
Geospatial Indexes
{ A: (51.5, 0.12), B: (32.1, 34.7)
}
• Add-ons that use a Redis API to seamlessly support
additional use cases and data structures.
• Enjoy Redis’ simplicity, super high performance, infinite
scalability and high availability.
Extensibility: Modules Extend Redis Infinitely
• Leverage existing data structures or introduce new ones.
7
3
Redis Modules
• All that is cool, but sometimes you want a bit more
– New Data Structures
– Space Efficiency
– Complex Calculation
– Complex Queries
• Lua scripting not always enough
Why Modules?
Enter Redis Modules
● Since 4.0
● Dynamic libraries loaded to Redis
● With a C API
● Can extend Redis with:
New Capabilities
New Commands
New Data Types
Adapt your database to your data
ReBloom Redis-Graph
Scalable Bloom Filters for
fast and memory efficient
membership testing
Graph database on Redis
based on Cypher language
ReJSON
JSON Engine on Redis.
Pre-released
Neural Redis Redis-ML RediSearch
Full Text Search Engine in
Redis
Machine Learning Model
Serving
Simple Neural Network
Native to Redis
RediSearch
RediSearch: Redis Based Search Index
● Completely from-scratch, in C
● Open source (AGPL)
● Optimized data structures
● Text, numeric and geo filters
● Fast concurrent updates and deletes
● Scalable to 100s of servers, billions of docs
Working in Real Time
● Being 100% in RAM allows:
– ~O(1) insertions
– No batch vs. incremental indexing
– Concurrent operation
● Fast indexing, immediately searchable
● Fast updates / deletes
● Garbage collection and background optimization
Building an Index
doc1
{
title: “LCD TV”,
price: 500,
description: “foo”
}
Tokenizing /
Indexing
Term Posting List
lcd doc1, doc3, doc5...
tv doc1, doc7, doc19...
foo doc1
bar doc1, doc100, ...
doc1
{
title: “LCD TV”,
price: 500,
description: “foo”
}
doc1
{
title: “LCD TV”,
price: 500,
description: “foo”
}
Documents / Entities
Index
Price Index
…. ….
500 doc1, doc7, doc19...
503 doc3
…. ...
Searching The Index
Term Posting List
lcd doc1, doc3, doc5...
tv doc1, doc7, doc19...
foo doc1
bar doc1, doc100, ...
Query
Index
Price Index
…. ….
500 doc1, doc7, doc19...
503 doc3
…. ...
Text: “lcd tv”
Price: 500
Doc1
Intersect Index Entries
Result
Let’s Model Something
● A product database
● Products have:
– Title
– Description
– Price
– Categories
– Brand
● Sort by: Relevance, Title, Price
Defining Our Model
FT.CREATE products
SCHEMA
title TEXT SORTABLE
body TEXT
cats TEXT NOSTEM
brand TEXT NOSTEM
price NUMERIC SORTABLE
Inserting Records
FT.ADD products
prod1 0.58
FIELDS
title “Samsung 42 Inch LCD TV”
brand “Samsung”
body “Is Nice TV!”
cats “tvs, electronics”
price 350
Searching
FT.SEARCH products
“@title|body:(lcd 42|44|50)
@cats:(tvs|electronics )
@brand:(samsung|sony)
@price:[200 500]”
LIMIT 0 20
SORTBY price DESC
Search Benchmark
Search Benchmark
Search Benchmark
Search Benchmark
ReJSON
JSON and Redis
• Everybody uses JSON
• Everybody uses Redis
• Atwood's Law:
"any application that can be written in JavaScript, will eventually be
written in JavaScript"
• Which leads to:
"...any database will eventually store JSON" :)
26
Storing JSON values in Redis (pre v4)
Two approaches using the core Redis data structures:
• Raw JSON in String keys: the document is stored in serialized form
– Lua may be used to encode/decode on the fly
– Fast fetching
– Manipulations are slow and non atomic
• Decomposed in Hash keys: the data is deserialized to key-value pairs
– Fast, atomic updates
– Supports only flat documents with string/number values
27
ReJSON
• A native JSON data type for Redis
• Keys can contain any valid JSON value
• Data is stored decoded (tree, binary format)
• JSONPath-like syntax for direct access to elements
• Strongly-typed values and commands
28
ReJSON "demo"
29
> JSON.SET foo . '{"foo": "bar", "list": [1,2,3,4]}'
> JSON.GET foo .
"{"foo":"bar","list":[1,2,3,4]}"
> JSON.GET foo foo
""bar""
> JSON.GET foo .list[1]
"2"
> JSON.ARRAPPEND foo .list 1337
> JSON.ARRAPPEND foo .list 1337
> JSON.GET foo .list
"[1,2,3,4,1337,1337]"
ReJSON commands
General
JSON.DEL deletes value
JSON.GET gets value
JSON.MGET … from multiple keys
JSON.SET sets value
JSON.TYPE reports type value
Number operations
JSON.NUMINCRBY increments
number
JSON.NUMMULTBY multiplies
number
String operations
JSON.STRAPPEND appends to string
JSON.STRLEN reports string's length
30
Array operations
JSON.ARRAPPEND appends to array
JSON.ARRINDEX searches in array
JSON.ARRINSERT inserts to array
JSON.ARRLEN reports array's length
JSON.ARRPOP pops value from end
JSON.ARRTRIM trims an array
Object operations
JSON.OBJKEYS the keys in object
JSON.OBJLEN the number of keys
Other commands
JSON.RESP returns a JSON value using
Redis Serialization Protocol
Performance: 380 bytes, 3 nesting levels
31
Throughput
Average latency
ReJSON Raw JSON & Lua
MessagePack & Lua
Performance: 3468 bytes, 3 nesting levels
32
Throughput
Average latency
ReJSON Raw JSON & Lua
MessagePack & Lua
Main benefits
Now
• Intuitive for anybody who uses JSON
• Fully integrated in Redis, functionally- and design-wise
• Works with any Redis client, no extra coding required
• Designed for maximal element access performance
Future
Data compression, schema validation, secondary indices,
querying & much more (feature requests are welcome!)
33
Rebloom
What is a bloom filter?
● Probabilistic structure for membership testing
● Trades memory for accuracy
●No false negatives
● False positives - trade-off with space
● RAM - a fraction of a normal set
How Bloom Filters Work
● Bloom Filters work by ‘storing’ each item in a sparse array of bits.
● The item is mapped to n bit positions, and each position is set
● The position is determined through n hash functions.
When to use Bloom Filters?
● Large (possibly remote) database.
– Bloom filters can be used to check if an entry exists before querying.
– Query time in bloom filter on the order of a few µs
● Can tolerate false positives
– Sometimes (how often is configurable) a bloom filter can claim an item
really exists, but it doesn’t. The use case must be able to tolerate this.
● Datastore is append-only (for example, a blacklist)
– Items cannot be deleted from a bloom filter.
ReBloom: Bloom + Redis
● Redis Module by Redis Labs
● Implements Bloom Filter as Redis type
● Simple API
● Possibly the fastest BF implementation out there.
● Can scale automatically
Real Users
● Reddit uses ReBloom to weed out hacked passwords. A list of
300M passwords are loaded into a bloom filter, and existing/new
passwords checked against it.
● Scopely - Filtering in a real-time gaming application
How to use ReBloom
● Functions like a normal Redis data type (can be deleted, saved,
and replicates/persists)
● Items can be added to the filter:
– BF.ADD filterName value1
● Filter can be queried for existence of an item
– BF.EXISTS filterName value1
● Some advanced functionality
– Bulk API
– Customizing filter settings
– Debugging
Q&A Time!
The End!

More Related Content

What's hot

Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Alluxio, Inc.
 
A Basic Introduction to the Hadoop eco system - no animation
A Basic Introduction to the Hadoop eco system - no animationA Basic Introduction to the Hadoop eco system - no animation
A Basic Introduction to the Hadoop eco system - no animationSameer Tiwari
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101MongoDB
 
Indexing with solr search server and hadoop framework
Indexing with solr search server and hadoop frameworkIndexing with solr search server and hadoop framework
Indexing with solr search server and hadoop frameworkkeval dalasaniya
 
Scalable Filesystem Metadata Services with RocksDB
Scalable Filesystem Metadata Services with RocksDBScalable Filesystem Metadata Services with RocksDB
Scalable Filesystem Metadata Services with RocksDBAlluxio, Inc.
 
ImpalaToGo and Tachyon integration
ImpalaToGo and Tachyon integrationImpalaToGo and Tachyon integration
ImpalaToGo and Tachyon integrationDavid Groozman
 
Accessing external hadoop data sources using pivotal e xtension framework (px...
Accessing external hadoop data sources using pivotal e xtension framework (px...Accessing external hadoop data sources using pivotal e xtension framework (px...
Accessing external hadoop data sources using pivotal e xtension framework (px...Sameer Tiwari
 
Introduction to Big Data and hadoop
Introduction to Big Data and hadoopIntroduction to Big Data and hadoop
Introduction to Big Data and hadoopSandeep Patil
 
Pillars of Heterogeneous HDFS Storage
Pillars of Heterogeneous HDFS StoragePillars of Heterogeneous HDFS Storage
Pillars of Heterogeneous HDFS StoragePete Kisich
 
Backup and Disaster Recovery in Hadoop
Backup and Disaster Recovery in HadoopBackup and Disaster Recovery in Hadoop
Backup and Disaster Recovery in Hadooplarsgeorge
 
Introduction to Big Data and Hadoop
Introduction to Big Data and HadoopIntroduction to Big Data and Hadoop
Introduction to Big Data and HadoopSSandip Patil
 
Aziksa hadoop architecture santosh jha
Aziksa hadoop architecture santosh jhaAziksa hadoop architecture santosh jha
Aziksa hadoop architecture santosh jhaData Con LA
 
July 2010 Triangle Hadoop Users Group - Chad Vawter Slides
July 2010 Triangle Hadoop Users Group - Chad Vawter SlidesJuly 2010 Triangle Hadoop Users Group - Chad Vawter Slides
July 2010 Triangle Hadoop Users Group - Chad Vawter Slidesryancox
 
DataLogix Hadoop Solution
DataLogix Hadoop SolutionDataLogix Hadoop Solution
DataLogix Hadoop SolutionDataLogix B.V.
 
Hadoop training by keylabs
Hadoop training by keylabsHadoop training by keylabs
Hadoop training by keylabsSiva Sankar
 
ImpalaToGo design explained
ImpalaToGo design explainedImpalaToGo design explained
ImpalaToGo design explainedDavid Groozman
 
Intro to Apache Hadoop
Intro to Apache HadoopIntro to Apache Hadoop
Intro to Apache HadoopSufi Nawaz
 
Practical NoSQL: Accumulo's dirlist Example
Practical NoSQL: Accumulo's dirlist ExamplePractical NoSQL: Accumulo's dirlist Example
Practical NoSQL: Accumulo's dirlist ExampleDataWorks Summit
 

What's hot (20)

Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...Scalable and High available Distributed File System Metadata Service Using gR...
Scalable and High available Distributed File System Metadata Service Using gR...
 
Hadoop
HadoopHadoop
Hadoop
 
A Basic Introduction to the Hadoop eco system - no animation
A Basic Introduction to the Hadoop eco system - no animationA Basic Introduction to the Hadoop eco system - no animation
A Basic Introduction to the Hadoop eco system - no animation
 
Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101Ops Jumpstart: MongoDB Administration 101
Ops Jumpstart: MongoDB Administration 101
 
Indexing with solr search server and hadoop framework
Indexing with solr search server and hadoop frameworkIndexing with solr search server and hadoop framework
Indexing with solr search server and hadoop framework
 
Scalable Filesystem Metadata Services with RocksDB
Scalable Filesystem Metadata Services with RocksDBScalable Filesystem Metadata Services with RocksDB
Scalable Filesystem Metadata Services with RocksDB
 
ImpalaToGo and Tachyon integration
ImpalaToGo and Tachyon integrationImpalaToGo and Tachyon integration
ImpalaToGo and Tachyon integration
 
Accessing external hadoop data sources using pivotal e xtension framework (px...
Accessing external hadoop data sources using pivotal e xtension framework (px...Accessing external hadoop data sources using pivotal e xtension framework (px...
Accessing external hadoop data sources using pivotal e xtension framework (px...
 
Introduction to Big Data and hadoop
Introduction to Big Data and hadoopIntroduction to Big Data and hadoop
Introduction to Big Data and hadoop
 
Pillars of Heterogeneous HDFS Storage
Pillars of Heterogeneous HDFS StoragePillars of Heterogeneous HDFS Storage
Pillars of Heterogeneous HDFS Storage
 
Backup and Disaster Recovery in Hadoop
Backup and Disaster Recovery in HadoopBackup and Disaster Recovery in Hadoop
Backup and Disaster Recovery in Hadoop
 
Introduction to Big Data and Hadoop
Introduction to Big Data and HadoopIntroduction to Big Data and Hadoop
Introduction to Big Data and Hadoop
 
Aziksa hadoop architecture santosh jha
Aziksa hadoop architecture santosh jhaAziksa hadoop architecture santosh jha
Aziksa hadoop architecture santosh jha
 
July 2010 Triangle Hadoop Users Group - Chad Vawter Slides
July 2010 Triangle Hadoop Users Group - Chad Vawter SlidesJuly 2010 Triangle Hadoop Users Group - Chad Vawter Slides
July 2010 Triangle Hadoop Users Group - Chad Vawter Slides
 
DataLogix Hadoop Solution
DataLogix Hadoop SolutionDataLogix Hadoop Solution
DataLogix Hadoop Solution
 
Hadoop training by keylabs
Hadoop training by keylabsHadoop training by keylabs
Hadoop training by keylabs
 
ImpalaToGo design explained
ImpalaToGo design explainedImpalaToGo design explained
ImpalaToGo design explained
 
Intro to Apache Hadoop
Intro to Apache HadoopIntro to Apache Hadoop
Intro to Apache Hadoop
 
Hadoop sqoop
Hadoop sqoop Hadoop sqoop
Hadoop sqoop
 
Practical NoSQL: Accumulo's dirlist Example
Practical NoSQL: Accumulo's dirlist ExamplePractical NoSQL: Accumulo's dirlist Example
Practical NoSQL: Accumulo's dirlist Example
 

Similar to Redis Modules - Redis India Tour - 2017

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisItamar Haber
 
Redis - Your Magical superfast database
Redis - Your Magical superfast databaseRedis - Your Magical superfast database
Redis - Your Magical superfast databasethe100rabh
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabaseMubashar Iqbal
 
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit
 
Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSAmazon Web Services
 
Presentacion redislabs-ihub
Presentacion redislabs-ihubPresentacion redislabs-ihub
Presentacion redislabs-ihubssuser9d7c90
 
An Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdfAn Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdfStephen Lorello
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisArnab Mitra
 
Compare DynamoDB vs. MongoDB
Compare DynamoDB vs. MongoDBCompare DynamoDB vs. MongoDB
Compare DynamoDB vs. MongoDBAmar Das
 
Dynamo vs Mongo
Dynamo vs MongoDynamo vs Mongo
Dynamo vs MongoAmar Das
 
What's new with enterprise Redis - Leena Joshi, Redis Labs
What's new with enterprise Redis - Leena Joshi, Redis LabsWhat's new with enterprise Redis - Leena Joshi, Redis Labs
What's new with enterprise Redis - Leena Joshi, Redis LabsRedis Labs
 
Agility and Scalability with MongoDB
Agility and Scalability with MongoDBAgility and Scalability with MongoDB
Agility and Scalability with MongoDBMongoDB
 
Meetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebServiceMeetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebServiceMinsk MongoDB User Group
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBob Ward
 
About elasticsearch
About elasticsearchAbout elasticsearch
About elasticsearchMinsoo Jun
 
Real time analytics at uber @ strata data 2019
Real time analytics at uber @ strata data 2019Real time analytics at uber @ strata data 2019
Real time analytics at uber @ strata data 2019Zhenxiao Luo
 

Similar to Redis Modules - Redis India Tour - 2017 (20)

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis - Your Magical superfast database
Redis - Your Magical superfast databaseRedis - Your Magical superfast database
Redis - Your Magical superfast database
 
PostgreSQL - Object Relational Database
PostgreSQL - Object Relational DatabasePostgreSQL - Object Relational Database
PostgreSQL - Object Relational Database
 
Spark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir VolkSpark Summit EU talk by Shay Nativ and Dvir Volk
Spark Summit EU talk by Shay Nativ and Dvir Volk
 
Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWS
 
Presentacion redislabs-ihub
Presentacion redislabs-ihubPresentacion redislabs-ihub
Presentacion redislabs-ihub
 
An Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdfAn Introduction to Redis for .NET Developers.pdf
An Introduction to Redis for .NET Developers.pdf
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Drop acid
Drop acidDrop acid
Drop acid
 
Compare DynamoDB vs. MongoDB
Compare DynamoDB vs. MongoDBCompare DynamoDB vs. MongoDB
Compare DynamoDB vs. MongoDB
 
Dynamo vs Mongo
Dynamo vs MongoDynamo vs Mongo
Dynamo vs Mongo
 
No sq lv1_0
No sq lv1_0No sq lv1_0
No sq lv1_0
 
What's new with enterprise Redis - Leena Joshi, Redis Labs
What's new with enterprise Redis - Leena Joshi, Redis LabsWhat's new with enterprise Redis - Leena Joshi, Redis Labs
What's new with enterprise Redis - Leena Joshi, Redis Labs
 
Agility and Scalability with MongoDB
Agility and Scalability with MongoDBAgility and Scalability with MongoDB
Agility and Scalability with MongoDB
 
Using Data Lakes
Using Data LakesUsing Data Lakes
Using Data Lakes
 
Meetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebServiceMeetup#2: Building responsive Symbology & Suggest WebService
Meetup#2: Building responsive Symbology & Suggest WebService
 
Brk2051 sql server on linux and docker
Brk2051 sql server on linux and dockerBrk2051 sql server on linux and docker
Brk2051 sql server on linux and docker
 
About elasticsearch
About elasticsearchAbout elasticsearch
About elasticsearch
 
Practical Use of a NoSQL Database
Practical Use of a NoSQL DatabasePractical Use of a NoSQL Database
Practical Use of a NoSQL Database
 
Real time analytics at uber @ strata data 2019
Real time analytics at uber @ strata data 2019Real time analytics at uber @ strata data 2019
Real time analytics at uber @ strata data 2019
 

Recently uploaded

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...gurkirankumar98700
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 

Recently uploaded (20)

From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
Kalyanpur ) Call Girls in Lucknow Finest Escorts Service 🍸 8923113531 🎰 Avail...
 
How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 

Redis Modules - Redis India Tour - 2017

  • 1. Redis Modules A Crash Course In Redis Advanced Features
  • 2. Hello World Open source. The leading in-memory database platform, supporting any high performance operational, analytics or hybrid use case. The open source home and commercial provider of Redis Enterprise (Redise) technology, platform, products & services. 2 TalshkolnikSolution Architect at Redis Labs.
  • 3. A Brief Overview of Redis ● Key => Data Structure server ● In memory ● Disk backed ● Scalable ● Modular ● Fast
  • 4. Redis Top Differentiators Simplicity ExtensibilityPerformance NoSQL Benchmark 1 Redis Data Structures 2 3 Redis Modules 4 Lists Hashes Bitmaps Strings Bit field Streams Hyperloglog Sorted Sets Sets Geospatial Indexes
  • 5. Performance: The Most Powerful Database Highest Throughput at Lowest Latency in High Volume of Writes Scenario Least Servers Needed to Deliver 1 Million Writes/Sec Benchmarks performed by Avalon Consulting Group Benchmarks published in the Google blog 5 1 Serversusedtoachieve1Mwrites/sec
  • 6. Simplicity: Data Structures - Redis’ Building Blocks Lists [ A → B → C → D → E ] Hashes { A: “foo”, B: “bar”, C: “baz” } Bitmaps 0011010101100111001010 Strings "I'm a Plain Text String!” Bit field {23334}{112345569}{766538} Key 6 2 Streams →{id1=time1.seq1(A:“xyz”, B:“cdf”), d2=time2.seq2(D:“abc”, )}→ Hyperloglog 00110101 11001110 Sorted Sets { A: 0.1, B: 0.3, C: 100 } Sets { A , B , C , D , E } Geospatial Indexes { A: (51.5, 0.12), B: (32.1, 34.7) }
  • 7. • Add-ons that use a Redis API to seamlessly support additional use cases and data structures. • Enjoy Redis’ simplicity, super high performance, infinite scalability and high availability. Extensibility: Modules Extend Redis Infinitely • Leverage existing data structures or introduce new ones. 7 3
  • 9. • All that is cool, but sometimes you want a bit more – New Data Structures – Space Efficiency – Complex Calculation – Complex Queries • Lua scripting not always enough Why Modules?
  • 10. Enter Redis Modules ● Since 4.0 ● Dynamic libraries loaded to Redis ● With a C API ● Can extend Redis with: New Capabilities New Commands New Data Types
  • 11. Adapt your database to your data ReBloom Redis-Graph Scalable Bloom Filters for fast and memory efficient membership testing Graph database on Redis based on Cypher language ReJSON JSON Engine on Redis. Pre-released Neural Redis Redis-ML RediSearch Full Text Search Engine in Redis Machine Learning Model Serving Simple Neural Network Native to Redis
  • 13. RediSearch: Redis Based Search Index ● Completely from-scratch, in C ● Open source (AGPL) ● Optimized data structures ● Text, numeric and geo filters ● Fast concurrent updates and deletes ● Scalable to 100s of servers, billions of docs
  • 14. Working in Real Time ● Being 100% in RAM allows: – ~O(1) insertions – No batch vs. incremental indexing – Concurrent operation ● Fast indexing, immediately searchable ● Fast updates / deletes ● Garbage collection and background optimization
  • 15. Building an Index doc1 { title: “LCD TV”, price: 500, description: “foo” } Tokenizing / Indexing Term Posting List lcd doc1, doc3, doc5... tv doc1, doc7, doc19... foo doc1 bar doc1, doc100, ... doc1 { title: “LCD TV”, price: 500, description: “foo” } doc1 { title: “LCD TV”, price: 500, description: “foo” } Documents / Entities Index Price Index …. …. 500 doc1, doc7, doc19... 503 doc3 …. ...
  • 16. Searching The Index Term Posting List lcd doc1, doc3, doc5... tv doc1, doc7, doc19... foo doc1 bar doc1, doc100, ... Query Index Price Index …. …. 500 doc1, doc7, doc19... 503 doc3 …. ... Text: “lcd tv” Price: 500 Doc1 Intersect Index Entries Result
  • 17. Let’s Model Something ● A product database ● Products have: – Title – Description – Price – Categories – Brand ● Sort by: Relevance, Title, Price
  • 18. Defining Our Model FT.CREATE products SCHEMA title TEXT SORTABLE body TEXT cats TEXT NOSTEM brand TEXT NOSTEM price NUMERIC SORTABLE
  • 19. Inserting Records FT.ADD products prod1 0.58 FIELDS title “Samsung 42 Inch LCD TV” brand “Samsung” body “Is Nice TV!” cats “tvs, electronics” price 350
  • 20. Searching FT.SEARCH products “@title|body:(lcd 42|44|50) @cats:(tvs|electronics ) @brand:(samsung|sony) @price:[200 500]” LIMIT 0 20 SORTBY price DESC
  • 26. JSON and Redis • Everybody uses JSON • Everybody uses Redis • Atwood's Law: "any application that can be written in JavaScript, will eventually be written in JavaScript" • Which leads to: "...any database will eventually store JSON" :) 26
  • 27. Storing JSON values in Redis (pre v4) Two approaches using the core Redis data structures: • Raw JSON in String keys: the document is stored in serialized form – Lua may be used to encode/decode on the fly – Fast fetching – Manipulations are slow and non atomic • Decomposed in Hash keys: the data is deserialized to key-value pairs – Fast, atomic updates – Supports only flat documents with string/number values 27
  • 28. ReJSON • A native JSON data type for Redis • Keys can contain any valid JSON value • Data is stored decoded (tree, binary format) • JSONPath-like syntax for direct access to elements • Strongly-typed values and commands 28
  • 29. ReJSON "demo" 29 > JSON.SET foo . '{"foo": "bar", "list": [1,2,3,4]}' > JSON.GET foo . "{"foo":"bar","list":[1,2,3,4]}" > JSON.GET foo foo ""bar"" > JSON.GET foo .list[1] "2" > JSON.ARRAPPEND foo .list 1337 > JSON.ARRAPPEND foo .list 1337 > JSON.GET foo .list "[1,2,3,4,1337,1337]"
  • 30. ReJSON commands General JSON.DEL deletes value JSON.GET gets value JSON.MGET … from multiple keys JSON.SET sets value JSON.TYPE reports type value Number operations JSON.NUMINCRBY increments number JSON.NUMMULTBY multiplies number String operations JSON.STRAPPEND appends to string JSON.STRLEN reports string's length 30 Array operations JSON.ARRAPPEND appends to array JSON.ARRINDEX searches in array JSON.ARRINSERT inserts to array JSON.ARRLEN reports array's length JSON.ARRPOP pops value from end JSON.ARRTRIM trims an array Object operations JSON.OBJKEYS the keys in object JSON.OBJLEN the number of keys Other commands JSON.RESP returns a JSON value using Redis Serialization Protocol
  • 31. Performance: 380 bytes, 3 nesting levels 31 Throughput Average latency ReJSON Raw JSON & Lua MessagePack & Lua
  • 32. Performance: 3468 bytes, 3 nesting levels 32 Throughput Average latency ReJSON Raw JSON & Lua MessagePack & Lua
  • 33. Main benefits Now • Intuitive for anybody who uses JSON • Fully integrated in Redis, functionally- and design-wise • Works with any Redis client, no extra coding required • Designed for maximal element access performance Future Data compression, schema validation, secondary indices, querying & much more (feature requests are welcome!) 33
  • 35. What is a bloom filter? ● Probabilistic structure for membership testing ● Trades memory for accuracy ●No false negatives ● False positives - trade-off with space ● RAM - a fraction of a normal set
  • 36. How Bloom Filters Work ● Bloom Filters work by ‘storing’ each item in a sparse array of bits. ● The item is mapped to n bit positions, and each position is set ● The position is determined through n hash functions.
  • 37. When to use Bloom Filters? ● Large (possibly remote) database. – Bloom filters can be used to check if an entry exists before querying. – Query time in bloom filter on the order of a few µs ● Can tolerate false positives – Sometimes (how often is configurable) a bloom filter can claim an item really exists, but it doesn’t. The use case must be able to tolerate this. ● Datastore is append-only (for example, a blacklist) – Items cannot be deleted from a bloom filter.
  • 38. ReBloom: Bloom + Redis ● Redis Module by Redis Labs ● Implements Bloom Filter as Redis type ● Simple API ● Possibly the fastest BF implementation out there. ● Can scale automatically
  • 39. Real Users ● Reddit uses ReBloom to weed out hacked passwords. A list of 300M passwords are loaded into a bloom filter, and existing/new passwords checked against it. ● Scopely - Filtering in a real-time gaming application
  • 40. How to use ReBloom ● Functions like a normal Redis data type (can be deleted, saved, and replicates/persists) ● Items can be added to the filter: – BF.ADD filterName value1 ● Filter can be queried for existence of an item – BF.EXISTS filterName value1 ● Some advanced functionality – Bulk API – Customizing filter settings – Debugging