SlideShare a Scribd company logo
INTRODUCTION REDIS
Maarten Smeets
09-04-2018
INTRODUCTION REDIS
INTRODUCING REDIS DATATYPES PUBLISH SUBSCRIBE
PERSISTENCE TRANSACTIONS
REJSON AND REDISEARCH CLIENTS
1 2 3
What is Redis Why use Redis Who uses Redis
INTRODUCTION REDIS
INTRODUCING REDIS
• Redis
First release 2009
An open-source in-memory database project implementing
a distributed, in-memory key-value store with optional
durability.
INTRODUCING REDIS
• Redis is an open source, in-memory data structure store
Can be used as Database, Cache, Message broker
• NoSQL Key/Value store
• Supports multiple data structures
• Features like
• Transactions
• Pub/Sub
• Scalability / availability options
• Time to live for entries Mostly single threaded!
Modules can be multi threaded
TYPICAL USES OF REDIS
• Cache database query results
• https://redislabs.com/ebook/part-1-getting-started/chapter-2-anatomy-of-a-redis-web-application/2-4-
database-row-caching/
• Cache entire webpages (e.g. Wordpress)
• https://wordpress.org/plugins/redis-cache/
• Use for HTTP session store
• https://docs.spring.io/spring-session/docs/current/reference/html5/
• Cache logins / cookies
• https://redislabs.com/ebook/part-1-getting-started/chapter-2-anatomy-of-a-redis-web-application/2-1-
login-and-cookie-caching/
WHY REDIS?
• Very flexible
• Very fast
• Caching & Disk persistence
• No schemas, column names
• Rich Datatype Support
HOW TO USE REDIS
EXAMPLE: CACHE DB RESULTS
Clients Back-end / server side
Persistent storage
Cache
WHO USES REDIS
Azure Redis Cache
WHO USES REDIS
IN THE NETHERLANDS
1 2 3
Strings and expiry Lists, Sets, Hashes Sorted sets
DATATYPES
DATATYPES
• Strings
• Lists
• Sets
• Sorted sets
• Hashes
• Bitmaps
• Hyperlogs
• Geospatial
indexes
Datatypes cannot be nested!
E.g. no lists of hashes
You can name your variables like:
person:1
person:2
KEYS person:* gives all person variables
The KEYS command is blocking.
Better to keep a set or list of person keys
STRINGS
• Max size 512Mb
• Byte save. Can store binaries
• Use cases:
• Store JPEG’s
• Store serialized objects
• Example usage
127.0.0.1:6379> SET greeting
‘Hello’
OK
127.0.0.1:6379> GET greeting
“Hello”
127.0.0.1:6379> DEL greeting
(integer) 1
127.0.0.1:6379> EXISTS greeting
(integer) 0
EXPIRY
• Expiry can be set for existing variables
127.0.0.1:6379> SET greeting “Hello”
OK
127.0.0.1:6379> EXPIRE greeting 10
(integer) 1
127.0.0.1:6379> TTL greeting
(integer) 8
127.0.0.1:6379> GET greeting
“Hello”
127.0.0.1:6379> GET greeting
(nil)
EXPIRY
• Expiry can be set when a variable is created and expiry can be removed
127.0.0.1:6379> SETEX greeting 10 “Hello”
OK
127.0.0.1:6379> TTL greeting
(integer) 8
127.0.0.1:6379> PERSIST greeting
OK
127.0.0.1:6379> TTL greeting
(integer) -1
LISTS
• A list of Strings
• Max size 4294967295
• Can for example be used for
• timelines of social networks
• Speed
• Actions at the start or end of the list are very fast.
• Actions in the middle are a little less fast
127.0.0.1:6379> LPUSH people “Maarten”
(integer) 1
127.0.0.1:6379> RPUSH people “John”
(integer) 2
127.0.0.1:6379> LRANGE people 0 -1
1) “Maarten”
2) “John”
127.0.0.1:6379> LLEN people
(integer) 2
127.0.0.1:6379> LPOP people
“Maarten”
127.0.0.1:6379> RPOP people
“John”
SETS
• Unordered collection of Strings
• Does not allow repeated elements
• Useful for tracking unique items
• Allows extracting random members
Using SPOP, SRANDMEMBER
• Useful for intersects and diffs
127.0.0.1:6379> SADD cars “Honda”
(integer) 1
127.0.0.1:6379> SADD cars “Ford”
(integer) 1
127.0.0.1:6379> SADD cars “Honda”
(integer) 0
127.0.0.1:6379> SISMEMBER cars “Honda”
(integer) 1
127.0.0.1:6379> SISMEMBER cars “BMW”
(integer) 0
127.0.0.1:6379> SMEMBERS cars
1) “Ford”
2) “Honda”
127.0.0.1:6379> SMOVE cars mycars “Honda”
(integer) 1
127.0.0.1:6379> SDIFF cars mycars
1) “Ford”
HASHES
• Maps between string fields and values
• Ideal for storing objects
127.0.0.1:6379> HMSET user:1000 username antirez
password P1pp0 age 34
OK
127.0.0.1:6379> HGETALL user:1000
1) “username”
2) “antirez”
3) “password”
4) “P1pp0”
5) “age”
6) “34”
127.0.0.1:6379> HSET user:1000 password 12345
(integer) 0
127.0.0.1:6379> HGET user:1000 password
“12345”
127.0.0.1:6379> HKEYS user:1000
1) “username”
2) “password”
3) “age”
SORTED SETS
• Non repeating collections of Strings
• Every member has a score.
• Members are unique. Scores are not
• Ordering is from small to large score
• Ordering for items with the same score is
alphabetic
• Useful for leader boards or autocomplete
127.0.0.1:6379> ZADD myzset 1 "one"
(integer) 1
127.0.0.1:6379> ZADD myzset 1 "one"
(integer) 0
127.0.0.1:6379> ZADD myzset 1 "uno"
(integer) 1
127.0.0.1:6379> ZADD myzset 2 "two" 3 "three"
(integer) 2
127.0.0.1:6379> ZRANGE myzset 0 -1 WITHSCORES
1) "one"
2) "1"
3) "uno"
4) "1"
5) "two"
6) "2"
7) "three"
8) "3"
127.0.0.1:6379> ZRANGE myzset 0 0
1) "one"
1 2
PERSISTENCE
Redis Database File (RDB) Append Only File (OAF)
PERSISTENCE
RDB (Redis Database File) AOF (Append Only File)
Provides point in time snapshots Logs every write
Creates complete snapshot at specified interval
Replays at server startup.
If log gets big, optimization takes place
File is in binary format File is easily readable
On crash minutes of data can be lost Minimal chance of data loss
Small files, fast (mostly) Big files, ‘slow’
https://www.slideshare.net/eugef/redis-persistence-in-practice-1
1 2
PUBLISH SUBSCRIBE
How to use it Things to mind
PUBLISH SUBSCRIBE
HOW DOES IT WORK
• SUBSCRIBE [channel]
• UNSUBSCRIBE [channel]
• PUBLISH [channel] [message]
Channel can contain
glob patterns like news.*
PUBLISH SUBSCRIBE
THINGS TO MIND
• A missed message has been missed permanently.
No retry
• There is no history of messages
Like a JMS topic without durable subscribers
1 2
TRANSACTIONS
TRANSACTIONS
• Not like relational database transactions!
• Start a transaction: MULTI
Commands after MULTI are queued
• Execute the queued commands: EXEC
All or none of the commands are executed
However, if one fails, the others are still executed
• Make EXEC conditional: WATCH
EXEC will only execute if watched variables are unchanged
WATCH zset
element = ZRANGE zset 0 0
MULTI
ZREM zset element
EXEC
There is no ZPOP but
it can be implemented like below
Redis LUA scripts are also
executed in a transaction
1 2
JSON AND SEARCH
ReJSON RediSearch
REDIS AS A JSON STORE
JSON support can be implemented by adding the ReJSON module from Redis Labs
127.0.0.1:6379> JSON.SET scalar . '"Hello JSON!"'
OK
127.0.0.1:6379> JSON.SET object . '{"foo": "bar", "ans": 42}'
OK
127.0.0.1:6379> JSON.GET object
"{"foo":"bar","ans":42}"
127.0.0.1:6379> JSON.GET object .ans
"42"
https://redislabs.com/blog/redis-as-a-json-store/
REDISEARCH - REDIS POWERED SEARCH ENGINE
Auto completion
127.0.0.1:6379> FT.SUGADD autocomplete “hello world” 100
OK
127.0.0.1:6379> FT.SUGGET autocomplete “he”
1) "hello world“
Full text search
127.0.0.1:6379> FT.ADD myIdx doc1 1.0 FIELDS title “hello” body “bla” url “http://redis.io”
OK
127.0.0.1:6379> FT.SEARCH myIdx “hello world” LIMIT 0 10
1) (integer) 1
2) “doc1”
3) 1) “title”
2) “hello”
3) “body”
4) “bla”
5) "url”
6) “http://redis.io”
http://redisearch.io/Quick_Start/
docker run -p 6379:6379 redislabs/redisearch:latest
1 2
CLIENTS
Node.js Spring Boot
CLIENTS
NODE.JS
Create a client and connect
Create an event handler
Subscribe to a channel
CLIENTS
SPRING BOOT
• There is no annotation available to
• Create a container
• Register a listener to the container
• Register a receiver to the listener
• This requires more code than for example listening to a Kafka topic
https://spring.io/guides/gs/messaging-redis/
CLIENTS
SPRING BOOT
Wait for a single message
CLIENTS
SPRING BOOT
SOME THINGS TO MIND IN PRODUCTION
• Redis is single threaded
• Want to use more CPU’s? Use more Redis instances!
• Requests are blocking. Be careful with for example KEYS commands. Mind
the time complexity of operations!
• Mind the number of connections!
• Implement a proxy, for example twemproxy (manages persistent connections)
• Snapshotting is blocking
• Investigate persistence requirements and consider rolling BGSAVE, OAF
instead of snapshotting
http://tech.trivago.com/2017/01/25/learn-redis-the-hard-way-in-production/
Introduction to Redis

More Related Content

What's hot

An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
Ali MasudianPour
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture Forum
Christopher Spring
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redis
Zhichao Liang
 
Redis and it's data types
Redis and it's data typesRedis and it's data types
Redis and it's data types
Aniruddha Chakrabarti
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
Noah Davis
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
Hoang Long
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
Carlos Abalde
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
Eugene Fidelin
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to RedisDvir Volk
 
An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
Stephen Lorello
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
Fabrizio Farinacci
 
What is in a Lucene index?
What is in a Lucene index?What is in a Lucene index?
What is in a Lucene index?
lucenerevolution
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
Mike Dirolf
 
MySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELKMySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELK
YoungHeon (Roy) Kim
 
Introduction to Spark Internals
Introduction to Spark InternalsIntroduction to Spark Internals
Introduction to Spark Internals
Pietro Michiardi
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
Jurriaan Persyn
 
Redis and its Scaling and Obersvability
Redis and its Scaling and ObersvabilityRedis and its Scaling and Obersvability
Redis and its Scaling and Obersvability
AbhishekDubey902839
 
Spark 의 핵심은 무엇인가? RDD! (RDD paper review)
Spark 의 핵심은 무엇인가? RDD! (RDD paper review)Spark 의 핵심은 무엇인가? RDD! (RDD paper review)
Spark 의 핵심은 무엇인가? RDD! (RDD paper review)
Yongho Ha
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
Kris Buytaert
 

What's hot (20)

An Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL databaseAn Introduction to REDIS NoSQL database
An Introduction to REDIS NoSQL database
 
Redis overview for Software Architecture Forum
Redis overview for Software Architecture ForumRedis overview for Software Architecture Forum
Redis overview for Software Architecture Forum
 
A simple introduction to redis
A simple introduction to redisA simple introduction to redis
A simple introduction to redis
 
Redis and it's data types
Redis and it's data typesRedis and it's data types
Redis and it's data types
 
Redis in Practice
Redis in PracticeRedis in Practice
Redis in Practice
 
Redis Overview
Redis OverviewRedis Overview
Redis Overview
 
Everything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to askEverything you always wanted to know about Redis but were afraid to ask
Everything you always wanted to know about Redis but were afraid to ask
 
Redis persistence in practice
Redis persistence in practiceRedis persistence in practice
Redis persistence in practice
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
An Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdfAn Introduction to Redis for Developers.pdf
An Introduction to Redis for Developers.pdf
 
Redis - Usability and Use Cases
Redis - Usability and Use CasesRedis - Usability and Use Cases
Redis - Usability and Use Cases
 
Redis 101
Redis 101Redis 101
Redis 101
 
What is in a Lucene index?
What is in a Lucene index?What is in a Lucene index?
What is in a Lucene index?
 
Introduction to MongoDB
Introduction to MongoDBIntroduction to MongoDB
Introduction to MongoDB
 
MySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELKMySQL Slow Query log Monitoring using Beats & ELK
MySQL Slow Query log Monitoring using Beats & ELK
 
Introduction to Spark Internals
Introduction to Spark InternalsIntroduction to Spark Internals
Introduction to Spark Internals
 
Introduction to memcached
Introduction to memcachedIntroduction to memcached
Introduction to memcached
 
Redis and its Scaling and Obersvability
Redis and its Scaling and ObersvabilityRedis and its Scaling and Obersvability
Redis and its Scaling and Obersvability
 
Spark 의 핵심은 무엇인가? RDD! (RDD paper review)
Spark 의 핵심은 무엇인가? RDD! (RDD paper review)Spark 의 핵심은 무엇인가? RDD! (RDD paper review)
Spark 의 핵심은 무엇인가? RDD! (RDD paper review)
 
MySQL HA with PaceMaker
MySQL HA with  PaceMakerMySQL HA with  PaceMaker
MySQL HA with PaceMaker
 

Similar to Introduction to Redis

10 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 201910 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 2019
Dave Nielsen
 
10 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 201910 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 2019
Dave Nielsen
 
Resilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron Evans
Resilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron EvansResilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron Evans
Resilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron Evans
Redis Labs
 
Testing at scale with Redis queues
Testing at scale with Redis queuesTesting at scale with Redis queues
Testing at scale with Redis queues
AAron EvaNS
 
Testing at scale with redis queues
Testing at scale with redis queuesTesting at scale with redis queues
Testing at scale with redis queues
AAron EvaNS
 
WebClusters, Redis
WebClusters, RedisWebClusters, Redis
WebClusters, RedisFilip Tepper
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
Michael Renner
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and Spark
Dvir Volk
 
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
Spark Summit
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Itamar Haber
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101
Dvir Volk
 
Getting started with Amazon ElastiCache
Getting started with Amazon ElastiCacheGetting started with Amazon ElastiCache
Getting started with Amazon ElastiCache
Amazon Web Services
 
Redispresentation apac2012
Redispresentation apac2012Redispresentation apac2012
Redispresentation apac2012
Ankur Gupta
 
Getting Started with Redis
Getting Started with RedisGetting Started with Redis
Getting Started with Redis
Faisal Akber
 
Seedhack MongoDB 2011
Seedhack MongoDB 2011Seedhack MongoDB 2011
Seedhack MongoDB 2011Rainforest QA
 
Redis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale AppsRedis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale Apps
Dave Nielsen
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
HashedIn Technologies
 
London MongoDB User Group April 2011
London MongoDB User Group April 2011London MongoDB User Group April 2011
London MongoDB User Group April 2011
Rainforest QA
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Sandesh Rao
 
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
Redis Labs
 

Similar to Introduction to Redis (20)

10 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 201910 Ways to Scale Your Website Silicon Valley Code Camp 2019
10 Ways to Scale Your Website Silicon Valley Code Camp 2019
 
10 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 201910 Ways to Scale with Redis - LA Redis Meetup 2019
10 Ways to Scale with Redis - LA Redis Meetup 2019
 
Resilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron Evans
Resilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron EvansResilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron Evans
Resilient Testing At Scale Using Redis Queues To Manage Concurrency: Aaron Evans
 
Testing at scale with Redis queues
Testing at scale with Redis queuesTesting at scale with Redis queues
Testing at scale with Redis queues
 
Testing at scale with redis queues
Testing at scale with redis queuesTesting at scale with redis queues
Testing at scale with redis queues
 
WebClusters, Redis
WebClusters, RedisWebClusters, Redis
WebClusters, Redis
 
Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014Postgres Vienna DB Meetup 2014
Postgres Vienna DB Meetup 2014
 
Boosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and SparkBoosting Machine Learning with Redis Modules and Spark
Boosting Machine Learning with Redis Modules and Spark
 
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
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis modules 101
Redis modules 101Redis modules 101
Redis modules 101
 
Getting started with Amazon ElastiCache
Getting started with Amazon ElastiCacheGetting started with Amazon ElastiCache
Getting started with Amazon ElastiCache
 
Redispresentation apac2012
Redispresentation apac2012Redispresentation apac2012
Redispresentation apac2012
 
Getting Started with Redis
Getting Started with RedisGetting Started with Redis
Getting Started with Redis
 
Seedhack MongoDB 2011
Seedhack MongoDB 2011Seedhack MongoDB 2011
Seedhack MongoDB 2011
 
Redis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale AppsRedis Functions, Data Structures for Web Scale Apps
Redis Functions, Data Structures for Web Scale Apps
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
 
London MongoDB User Group April 2011
London MongoDB User Group April 2011London MongoDB User Group April 2011
London MongoDB User Group April 2011
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
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
 

More from Maarten Smeets

Google jib: Building Java containers without Docker
Google jib: Building Java containers without DockerGoogle jib: Building Java containers without Docker
Google jib: Building Java containers without Docker
Maarten Smeets
 
Introduction to Anchore Engine
Introduction to Anchore EngineIntroduction to Anchore Engine
Introduction to Anchore Engine
Maarten Smeets
 
R2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database ConnectivityR2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database Connectivity
Maarten Smeets
 
Performance Issue? Machine Learning to the rescue!
Performance Issue? Machine Learning to the rescue!Performance Issue? Machine Learning to the rescue!
Performance Issue? Machine Learning to the rescue!
Maarten Smeets
 
Performance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMsPerformance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMs
Maarten Smeets
 
Performance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMsPerformance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMs
Maarten Smeets
 
VirtualBox networking explained
VirtualBox networking explainedVirtualBox networking explained
VirtualBox networking explained
Maarten Smeets
 
Microservices on Application Container Cloud Service
Microservices on Application Container Cloud ServiceMicroservices on Application Container Cloud Service
Microservices on Application Container Cloud Service
Maarten Smeets
 
WebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck ThreadsWebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck Threads
Maarten Smeets
 
All you need to know about transport layer security
All you need to know about transport layer securityAll you need to know about transport layer security
All you need to know about transport layer security
Maarten Smeets
 
Webservice security considerations and measures
Webservice security considerations and measuresWebservice security considerations and measures
Webservice security considerations and measures
Maarten Smeets
 
Machine learning with R
Machine learning with RMachine learning with R
Machine learning with R
Maarten Smeets
 
WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!
Maarten Smeets
 
Oracle SOA Suite 12.2.1 new features
Oracle SOA Suite 12.2.1 new featuresOracle SOA Suite 12.2.1 new features
Oracle SOA Suite 12.2.1 new features
Maarten Smeets
 
How to build a cloud adapter
How to build a cloud adapterHow to build a cloud adapter
How to build a cloud adapter
Maarten Smeets
 
WebLogic authentication debugging
WebLogic authentication debuggingWebLogic authentication debugging
WebLogic authentication debugging
Maarten Smeets
 

More from Maarten Smeets (16)

Google jib: Building Java containers without Docker
Google jib: Building Java containers without DockerGoogle jib: Building Java containers without Docker
Google jib: Building Java containers without Docker
 
Introduction to Anchore Engine
Introduction to Anchore EngineIntroduction to Anchore Engine
Introduction to Anchore Engine
 
R2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database ConnectivityR2DBC Reactive Relational Database Connectivity
R2DBC Reactive Relational Database Connectivity
 
Performance Issue? Machine Learning to the rescue!
Performance Issue? Machine Learning to the rescue!Performance Issue? Machine Learning to the rescue!
Performance Issue? Machine Learning to the rescue!
 
Performance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMsPerformance of Microservice Frameworks on different JVMs
Performance of Microservice Frameworks on different JVMs
 
Performance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMsPerformance of Microservice frameworks on different JVMs
Performance of Microservice frameworks on different JVMs
 
VirtualBox networking explained
VirtualBox networking explainedVirtualBox networking explained
VirtualBox networking explained
 
Microservices on Application Container Cloud Service
Microservices on Application Container Cloud ServiceMicroservices on Application Container Cloud Service
Microservices on Application Container Cloud Service
 
WebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck ThreadsWebLogic Stability; Detect and Analyse Stuck Threads
WebLogic Stability; Detect and Analyse Stuck Threads
 
All you need to know about transport layer security
All you need to know about transport layer securityAll you need to know about transport layer security
All you need to know about transport layer security
 
Webservice security considerations and measures
Webservice security considerations and measuresWebservice security considerations and measures
Webservice security considerations and measures
 
Machine learning with R
Machine learning with RMachine learning with R
Machine learning with R
 
WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!WebLogic Scripting Tool made Cool!
WebLogic Scripting Tool made Cool!
 
Oracle SOA Suite 12.2.1 new features
Oracle SOA Suite 12.2.1 new featuresOracle SOA Suite 12.2.1 new features
Oracle SOA Suite 12.2.1 new features
 
How to build a cloud adapter
How to build a cloud adapterHow to build a cloud adapter
How to build a cloud adapter
 
WebLogic authentication debugging
WebLogic authentication debuggingWebLogic authentication debugging
WebLogic authentication debugging
 

Recently uploaded

OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
takuyayamamoto1800
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
Max Andersen
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
Globus
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
e20449
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
WSO2
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
Paco van Beckhoven
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
IES VE
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Globus
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
Georgi Kodinov
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
XfilesPro
 

Recently uploaded (20)

OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoamOpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
OpenFOAM solver for Helmholtz equation, helmholtzFoam / helmholtzBubbleFoam
 
Quarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden ExtensionsQuarkus Hidden and Forbidden Extensions
Quarkus Hidden and Forbidden Extensions
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
GlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote sessionGlobusWorld 2024 Opening Keynote session
GlobusWorld 2024 Opening Keynote session
 
Graphic Design Crash Course for beginners
Graphic Design Crash Course for beginnersGraphic Design Crash Course for beginners
Graphic Design Crash Course for beginners
 
Accelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with PlatformlessAccelerate Enterprise Software Engineering with Platformless
Accelerate Enterprise Software Engineering with Platformless
 
Prosigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology SolutionsProsigns: Transforming Business with Tailored Technology Solutions
Prosigns: Transforming Business with Tailored Technology Solutions
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024Cracking the code review at SpringIO 2024
Cracking the code review at SpringIO 2024
 
SOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBrokerSOCRadar Research Team: Latest Activities of IntelBroker
SOCRadar Research Team: Latest Activities of IntelBroker
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Using IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New ZealandUsing IESVE for Room Loads Analysis - Australia & New Zealand
Using IESVE for Room Loads Analysis - Australia & New Zealand
 
Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...Developing Distributed High-performance Computing Capabilities of an Open Sci...
Developing Distributed High-performance Computing Capabilities of an Open Sci...
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx2024 RoOUG Security model for the cloud.pptx
2024 RoOUG Security model for the cloud.pptx
 
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, BetterWebinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
Webinar: Salesforce Document Management 2.0 - Smarter, Faster, Better
 

Introduction to Redis

  • 2. INTRODUCTION REDIS INTRODUCING REDIS DATATYPES PUBLISH SUBSCRIBE PERSISTENCE TRANSACTIONS REJSON AND REDISEARCH CLIENTS
  • 3. 1 2 3 What is Redis Why use Redis Who uses Redis INTRODUCTION REDIS
  • 4. INTRODUCING REDIS • Redis First release 2009 An open-source in-memory database project implementing a distributed, in-memory key-value store with optional durability.
  • 5. INTRODUCING REDIS • Redis is an open source, in-memory data structure store Can be used as Database, Cache, Message broker • NoSQL Key/Value store • Supports multiple data structures • Features like • Transactions • Pub/Sub • Scalability / availability options • Time to live for entries Mostly single threaded! Modules can be multi threaded
  • 6. TYPICAL USES OF REDIS • Cache database query results • https://redislabs.com/ebook/part-1-getting-started/chapter-2-anatomy-of-a-redis-web-application/2-4- database-row-caching/ • Cache entire webpages (e.g. Wordpress) • https://wordpress.org/plugins/redis-cache/ • Use for HTTP session store • https://docs.spring.io/spring-session/docs/current/reference/html5/ • Cache logins / cookies • https://redislabs.com/ebook/part-1-getting-started/chapter-2-anatomy-of-a-redis-web-application/2-1- login-and-cookie-caching/
  • 7. WHY REDIS? • Very flexible • Very fast • Caching & Disk persistence • No schemas, column names • Rich Datatype Support
  • 8. HOW TO USE REDIS EXAMPLE: CACHE DB RESULTS Clients Back-end / server side Persistent storage Cache
  • 9. WHO USES REDIS Azure Redis Cache
  • 10. WHO USES REDIS IN THE NETHERLANDS
  • 11. 1 2 3 Strings and expiry Lists, Sets, Hashes Sorted sets DATATYPES
  • 12. DATATYPES • Strings • Lists • Sets • Sorted sets • Hashes • Bitmaps • Hyperlogs • Geospatial indexes Datatypes cannot be nested! E.g. no lists of hashes You can name your variables like: person:1 person:2 KEYS person:* gives all person variables The KEYS command is blocking. Better to keep a set or list of person keys
  • 13. STRINGS • Max size 512Mb • Byte save. Can store binaries • Use cases: • Store JPEG’s • Store serialized objects • Example usage 127.0.0.1:6379> SET greeting ‘Hello’ OK 127.0.0.1:6379> GET greeting “Hello” 127.0.0.1:6379> DEL greeting (integer) 1 127.0.0.1:6379> EXISTS greeting (integer) 0
  • 14. EXPIRY • Expiry can be set for existing variables 127.0.0.1:6379> SET greeting “Hello” OK 127.0.0.1:6379> EXPIRE greeting 10 (integer) 1 127.0.0.1:6379> TTL greeting (integer) 8 127.0.0.1:6379> GET greeting “Hello” 127.0.0.1:6379> GET greeting (nil)
  • 15. EXPIRY • Expiry can be set when a variable is created and expiry can be removed 127.0.0.1:6379> SETEX greeting 10 “Hello” OK 127.0.0.1:6379> TTL greeting (integer) 8 127.0.0.1:6379> PERSIST greeting OK 127.0.0.1:6379> TTL greeting (integer) -1
  • 16. LISTS • A list of Strings • Max size 4294967295 • Can for example be used for • timelines of social networks • Speed • Actions at the start or end of the list are very fast. • Actions in the middle are a little less fast 127.0.0.1:6379> LPUSH people “Maarten” (integer) 1 127.0.0.1:6379> RPUSH people “John” (integer) 2 127.0.0.1:6379> LRANGE people 0 -1 1) “Maarten” 2) “John” 127.0.0.1:6379> LLEN people (integer) 2 127.0.0.1:6379> LPOP people “Maarten” 127.0.0.1:6379> RPOP people “John”
  • 17. SETS • Unordered collection of Strings • Does not allow repeated elements • Useful for tracking unique items • Allows extracting random members Using SPOP, SRANDMEMBER • Useful for intersects and diffs 127.0.0.1:6379> SADD cars “Honda” (integer) 1 127.0.0.1:6379> SADD cars “Ford” (integer) 1 127.0.0.1:6379> SADD cars “Honda” (integer) 0 127.0.0.1:6379> SISMEMBER cars “Honda” (integer) 1 127.0.0.1:6379> SISMEMBER cars “BMW” (integer) 0 127.0.0.1:6379> SMEMBERS cars 1) “Ford” 2) “Honda” 127.0.0.1:6379> SMOVE cars mycars “Honda” (integer) 1 127.0.0.1:6379> SDIFF cars mycars 1) “Ford”
  • 18. HASHES • Maps between string fields and values • Ideal for storing objects 127.0.0.1:6379> HMSET user:1000 username antirez password P1pp0 age 34 OK 127.0.0.1:6379> HGETALL user:1000 1) “username” 2) “antirez” 3) “password” 4) “P1pp0” 5) “age” 6) “34” 127.0.0.1:6379> HSET user:1000 password 12345 (integer) 0 127.0.0.1:6379> HGET user:1000 password “12345” 127.0.0.1:6379> HKEYS user:1000 1) “username” 2) “password” 3) “age”
  • 19. SORTED SETS • Non repeating collections of Strings • Every member has a score. • Members are unique. Scores are not • Ordering is from small to large score • Ordering for items with the same score is alphabetic • Useful for leader boards or autocomplete 127.0.0.1:6379> ZADD myzset 1 "one" (integer) 1 127.0.0.1:6379> ZADD myzset 1 "one" (integer) 0 127.0.0.1:6379> ZADD myzset 1 "uno" (integer) 1 127.0.0.1:6379> ZADD myzset 2 "two" 3 "three" (integer) 2 127.0.0.1:6379> ZRANGE myzset 0 -1 WITHSCORES 1) "one" 2) "1" 3) "uno" 4) "1" 5) "two" 6) "2" 7) "three" 8) "3" 127.0.0.1:6379> ZRANGE myzset 0 0 1) "one"
  • 20. 1 2 PERSISTENCE Redis Database File (RDB) Append Only File (OAF)
  • 21. PERSISTENCE RDB (Redis Database File) AOF (Append Only File) Provides point in time snapshots Logs every write Creates complete snapshot at specified interval Replays at server startup. If log gets big, optimization takes place File is in binary format File is easily readable On crash minutes of data can be lost Minimal chance of data loss Small files, fast (mostly) Big files, ‘slow’ https://www.slideshare.net/eugef/redis-persistence-in-practice-1
  • 22. 1 2 PUBLISH SUBSCRIBE How to use it Things to mind
  • 23. PUBLISH SUBSCRIBE HOW DOES IT WORK • SUBSCRIBE [channel] • UNSUBSCRIBE [channel] • PUBLISH [channel] [message] Channel can contain glob patterns like news.*
  • 24. PUBLISH SUBSCRIBE THINGS TO MIND • A missed message has been missed permanently. No retry • There is no history of messages Like a JMS topic without durable subscribers
  • 26. TRANSACTIONS • Not like relational database transactions! • Start a transaction: MULTI Commands after MULTI are queued • Execute the queued commands: EXEC All or none of the commands are executed However, if one fails, the others are still executed • Make EXEC conditional: WATCH EXEC will only execute if watched variables are unchanged WATCH zset element = ZRANGE zset 0 0 MULTI ZREM zset element EXEC There is no ZPOP but it can be implemented like below Redis LUA scripts are also executed in a transaction
  • 27. 1 2 JSON AND SEARCH ReJSON RediSearch
  • 28. REDIS AS A JSON STORE JSON support can be implemented by adding the ReJSON module from Redis Labs 127.0.0.1:6379> JSON.SET scalar . '"Hello JSON!"' OK 127.0.0.1:6379> JSON.SET object . '{"foo": "bar", "ans": 42}' OK 127.0.0.1:6379> JSON.GET object "{"foo":"bar","ans":42}" 127.0.0.1:6379> JSON.GET object .ans "42" https://redislabs.com/blog/redis-as-a-json-store/
  • 29. REDISEARCH - REDIS POWERED SEARCH ENGINE Auto completion 127.0.0.1:6379> FT.SUGADD autocomplete “hello world” 100 OK 127.0.0.1:6379> FT.SUGGET autocomplete “he” 1) "hello world“ Full text search 127.0.0.1:6379> FT.ADD myIdx doc1 1.0 FIELDS title “hello” body “bla” url “http://redis.io” OK 127.0.0.1:6379> FT.SEARCH myIdx “hello world” LIMIT 0 10 1) (integer) 1 2) “doc1” 3) 1) “title” 2) “hello” 3) “body” 4) “bla” 5) "url” 6) “http://redis.io” http://redisearch.io/Quick_Start/ docker run -p 6379:6379 redislabs/redisearch:latest
  • 31. CLIENTS NODE.JS Create a client and connect Create an event handler Subscribe to a channel
  • 32. CLIENTS SPRING BOOT • There is no annotation available to • Create a container • Register a listener to the container • Register a receiver to the listener • This requires more code than for example listening to a Kafka topic https://spring.io/guides/gs/messaging-redis/
  • 33. CLIENTS SPRING BOOT Wait for a single message
  • 35. SOME THINGS TO MIND IN PRODUCTION • Redis is single threaded • Want to use more CPU’s? Use more Redis instances! • Requests are blocking. Be careful with for example KEYS commands. Mind the time complexity of operations! • Mind the number of connections! • Implement a proxy, for example twemproxy (manages persistent connections) • Snapshotting is blocking • Investigate persistence requirements and consider rolling BGSAVE, OAF instead of snapshotting http://tech.trivago.com/2017/01/25/learn-redis-the-hard-way-in-production/

Editor's Notes

  1. Caching like memcached, persistence like MongoDB