Provides an overview of Redis which is a Key Value NoSQL database and the different data types it supports. Also shows how to use Redis Client API from node.
Redis is an open source in memory database which is easy to use. In this introductory presentation, several features will be discussed including use cases. The datatypes will be elaborated, publish subscribe features, persistence will be discussed including client implementations in Node and Spring Boot. After this presentation, you will have a basic understanding of what Redis is and you will have enough knowledge to get started with your first implementation!
Provides an overview of Redis which is a Key Value NoSQL database and the different data types it supports. Also shows how to use Redis Client API from node.
Redis is an open source in memory database which is easy to use. In this introductory presentation, several features will be discussed including use cases. The datatypes will be elaborated, publish subscribe features, persistence will be discussed including client implementations in Node and Spring Boot. After this presentation, you will have a basic understanding of what Redis is and you will have enough knowledge to get started with your first implementation!
Redis is an advanced in memory key-value store designed for a world where "Memory is the new disk and disk is the new tape". Redis has some unique properties -- like blazing read and write speed, rich atomic operations and asynchronous persistence -- which make it ideally suited for a number of situations.
The tutorial includes an introduction to redis, data types used for redis, performance related to redis, sweet spots of redis, design consideration/best practices, adopters of redis. Begins with a section giving an introduction to redis which includes an introduction to redis and the features of redis. It also includes a brief history of redis, characteristics of redis, language support of redis. Following is a data types section. It includes the data types of redis like strings, lists, hashes, sets, sorted sets. It also includes not thinking of redis as an RDBMS, installation, atomicity of commands, key expiration.
Moreover, it also includes operations on lists, sets, sorted sets, hashes, keys, redis administration command. Alongside there is a section about performance of redis which includes the performance given by redis like hardware, payload size, batch size. It also includes benchmarks attained by redis, a demo version of redis, data durability and advantages of persistence. Then comes a section about sweet spots of redis. It includes sweet spots like cache server, tag cloud, auto completion, activity feeds and many more sweet spots. It also includes case studies as a video marketing platform, content publishing app etc.
A neighbouring section to this is about best practices which includes the design considerations and best practices of redis like avoid excessive long keys, have human readable keys, all data must fit in memory, polygot persistence is a smart choice and many more practices and design considerations. The last section of this tutorial includes some adopters of redis like stack overflow, craiglist, github, Instagram, blizzard entertainment.
Redis is a popular, powerful, and—most of all—FAST database. Developers worldwide use Redis as a Cache, a session store, a message bus, and even as their regular database. In this session, we'll introduce Redis, and learn some of the key design patterns that you can use with Redis. Then we'll go over how Redis fits into the ecosystem, and how to use it in our applications—including some of the major gotchas to avoid.
Noah Davis & Luke Melia of Weplay share a series of examples of Redis in the real world. In doing so, they cover a survey of Redis' features, approach, history and philosophy. Most examples are drawn from the Weplay team's experience using Redis to power features on Weplay.com, a social site for youth sports.
Practical advices how to achieve persistence in Redis. Detailed overview of all cons and pros of RDB snapshots and AOF logging. Tips and tricks for proper persistence configuration with Redis pools and master/slave replication.
After more than 5 years of doing this, I think I managed to capture the essence of the beast quite neatly. Here's what matters about Redis, the open source in-memory data structure store, IMO.
Redis is an advanced in memory key-value store designed for a world where "Memory is the new disk and disk is the new tape". Redis has some unique properties -- like blazing read and write speed, rich atomic operations and asynchronous persistence -- which make it ideally suited for a number of situations.
The tutorial includes an introduction to redis, data types used for redis, performance related to redis, sweet spots of redis, design consideration/best practices, adopters of redis. Begins with a section giving an introduction to redis which includes an introduction to redis and the features of redis. It also includes a brief history of redis, characteristics of redis, language support of redis. Following is a data types section. It includes the data types of redis like strings, lists, hashes, sets, sorted sets. It also includes not thinking of redis as an RDBMS, installation, atomicity of commands, key expiration.
Moreover, it also includes operations on lists, sets, sorted sets, hashes, keys, redis administration command. Alongside there is a section about performance of redis which includes the performance given by redis like hardware, payload size, batch size. It also includes benchmarks attained by redis, a demo version of redis, data durability and advantages of persistence. Then comes a section about sweet spots of redis. It includes sweet spots like cache server, tag cloud, auto completion, activity feeds and many more sweet spots. It also includes case studies as a video marketing platform, content publishing app etc.
A neighbouring section to this is about best practices which includes the design considerations and best practices of redis like avoid excessive long keys, have human readable keys, all data must fit in memory, polygot persistence is a smart choice and many more practices and design considerations. The last section of this tutorial includes some adopters of redis like stack overflow, craiglist, github, Instagram, blizzard entertainment.
Redis is a popular, powerful, and—most of all—FAST database. Developers worldwide use Redis as a Cache, a session store, a message bus, and even as their regular database. In this session, we'll introduce Redis, and learn some of the key design patterns that you can use with Redis. Then we'll go over how Redis fits into the ecosystem, and how to use it in our applications—including some of the major gotchas to avoid.
Noah Davis & Luke Melia of Weplay share a series of examples of Redis in the real world. In doing so, they cover a survey of Redis' features, approach, history and philosophy. Most examples are drawn from the Weplay team's experience using Redis to power features on Weplay.com, a social site for youth sports.
Practical advices how to achieve persistence in Redis. Detailed overview of all cons and pros of RDB snapshots and AOF logging. Tips and tricks for proper persistence configuration with Redis pools and master/slave replication.
After more than 5 years of doing this, I think I managed to capture the essence of the beast quite neatly. Here's what matters about Redis, the open source in-memory data structure store, IMO.
Starting with v4, modules hold a promise for changing how Redis is used and developed for. Enabling custom data types and commands, Redis Modules build upon and extend the core functionality to handle any use case.
The video of the webinar given with these slides is at: https://youtu.be/EglSYFodaqw
An overview and discussion on indexing data in Redis to facilitate fast and efficient data retrieval. Presented on September 22nd, 2014 to the Redis Tel Aviv Meetup.
Redis is not just a cache, Andrew Lavers, ConFoo Montreal 2020Andrew Lavers
A common misunderstanding about Redis is that it's just a cache, or that you should only store ephemeral data there. In this talk I hope to dispel that myth by sharing some non-cache Redis recipes. I'll talk about how Redis can be used to solve problems such as distributed locking, message queues, one time tokens, and rate limiting.
Redis Use Patterns (DevconTLV June 2014)Itamar Haber
An introduction to Redis for the SQL practitioner, covering data types and common use cases.
The video of this session can be found at: https://www.youtube.com/watch?v=8Unaug_vmFI
Developing a Redis Module - Hackathon KickoffItamar Haber
Slides deck for kicking off Redis Labs' Modules Hackathon - https://www.hackerearth.com/sprints/redislabs-hackathon-global
Video of the webinar is at: https://youtu.be/LPxx4QPyUPw
Accelerate your Kubernetes clusters with Varnish CachingThijs Feryn
A presentation about the usage and availability of Varnish on Kubernetes. This talk explores the capabilities of Varnish caching and shows how to use the Varnish Helm chart to deploy it to Kubernetes.
This presentation was delivered at K8SUG Singapore. See https://feryn.eu/presentations/accelerate-your-kubernetes-clusters-with-varnish-caching-k8sug-singapore-28-2024 for more details.
Epistemic Interaction - tuning interfaces to provide information for AI supportAlan Dix
Paper presented at SYNERGY workshop at AVI 2024, Genoa, Italy. 3rd June 2024
https://alandix.com/academic/papers/synergy2024-epistemic/
As machine learning integrates deeper into human-computer interactions, the concept of epistemic interaction emerges, aiming to refine these interactions to enhance system adaptability. This approach encourages minor, intentional adjustments in user behaviour to enrich the data available for system learning. This paper introduces epistemic interaction within the context of human-system communication, illustrating how deliberate interaction design can improve system understanding and adaptation. Through concrete examples, we demonstrate the potential of epistemic interaction to significantly advance human-computer interaction by leveraging intuitive human communication strategies to inform system design and functionality, offering a novel pathway for enriching user-system engagements.
Securing your Kubernetes cluster_ a step-by-step guide to success !KatiaHIMEUR1
Today, after several years of existence, an extremely active community and an ultra-dynamic ecosystem, Kubernetes has established itself as the de facto standard in container orchestration. Thanks to a wide range of managed services, it has never been so easy to set up a ready-to-use Kubernetes cluster.
However, this ease of use means that the subject of security in Kubernetes is often left for later, or even neglected. This exposes companies to significant risks.
In this talk, I'll show you step-by-step how to secure your Kubernetes cluster for greater peace of mind and reliability.
Removing Uninteresting Bytes in Software FuzzingAftab Hussain
Imagine a world where software fuzzing, the process of mutating bytes in test seeds to uncover hidden and erroneous program behaviors, becomes faster and more effective. A lot depends on the initial seeds, which can significantly dictate the trajectory of a fuzzing campaign, particularly in terms of how long it takes to uncover interesting behaviour in your code. We introduce DIAR, a technique designed to speedup fuzzing campaigns by pinpointing and eliminating those uninteresting bytes in the seeds. Picture this: instead of wasting valuable resources on meaningless mutations in large, bloated seeds, DIAR removes the unnecessary bytes, streamlining the entire process.
In this work, we equipped AFL, a popular fuzzer, with DIAR and examined two critical Linux libraries -- Libxml's xmllint, a tool for parsing xml documents, and Binutil's readelf, an essential debugging and security analysis command-line tool used to display detailed information about ELF (Executable and Linkable Format). Our preliminary results show that AFL+DIAR does not only discover new paths more quickly but also achieves higher coverage overall. This work thus showcases how starting with lean and optimized seeds can lead to faster, more comprehensive fuzzing campaigns -- and DIAR helps you find such seeds.
- These are slides of the talk given at IEEE International Conference on Software Testing Verification and Validation Workshop, ICSTW 2022.
Encryption in Microsoft 365 - ExpertsLive Netherlands 2024Albert Hoitingh
In this session I delve into the encryption technology used in Microsoft 365 and Microsoft Purview. Including the concepts of Customer Key and Double Key Encryption.
Why You Should Replace Windows 11 with Nitrux Linux 3.5.0 for enhanced perfor...SOFTTECHHUB
The choice of an operating system plays a pivotal role in shaping our computing experience. For decades, Microsoft's Windows has dominated the market, offering a familiar and widely adopted platform for personal and professional use. However, as technological advancements continue to push the boundaries of innovation, alternative operating systems have emerged, challenging the status quo and offering users a fresh perspective on computing.
One such alternative that has garnered significant attention and acclaim is Nitrux Linux 3.5.0, a sleek, powerful, and user-friendly Linux distribution that promises to redefine the way we interact with our devices. With its focus on performance, security, and customization, Nitrux Linux presents a compelling case for those seeking to break free from the constraints of proprietary software and embrace the freedom and flexibility of open-source computing.
UiPath Test Automation using UiPath Test Suite series, part 4DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 4. In this session, we will cover Test Manager overview along with SAP heatmap.
The UiPath Test Manager overview with SAP heatmap webinar offers a concise yet comprehensive exploration of the role of a Test Manager within SAP environments, coupled with the utilization of heatmaps for effective testing strategies.
Participants will gain insights into the responsibilities, challenges, and best practices associated with test management in SAP projects. Additionally, the webinar delves into the significance of heatmaps as a visual aid for identifying testing priorities, areas of risk, and resource allocation within SAP landscapes. Through this session, attendees can expect to enhance their understanding of test management principles while learning practical approaches to optimize testing processes in SAP environments using heatmap visualization techniques
What will you get from this session?
1. Insights into SAP testing best practices
2. Heatmap utilization for testing
3. Optimization of testing processes
4. Demo
Topics covered:
Execution from the test manager
Orchestrator execution result
Defect reporting
SAP heatmap example with demo
Speaker:
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
LF Energy Webinar: Electrical Grid Modelling and Simulation Through PowSyBl -...DanBrown980551
Do you want to learn how to model and simulate an electrical network from scratch in under an hour?
Then welcome to this PowSyBl workshop, hosted by Rte, the French Transmission System Operator (TSO)!
During the webinar, you will discover the PowSyBl ecosystem as well as handle and study an electrical network through an interactive Python notebook.
PowSyBl is an open source project hosted by LF Energy, which offers a comprehensive set of features for electrical grid modelling and simulation. Among other advanced features, PowSyBl provides:
- A fully editable and extendable library for grid component modelling;
- Visualization tools to display your network;
- Grid simulation tools, such as power flows, security analyses (with or without remedial actions) and sensitivity analyses;
The framework is mostly written in Java, with a Python binding so that Python developers can access PowSyBl functionalities as well.
What you will learn during the webinar:
- For beginners: discover PowSyBl's functionalities through a quick general presentation and the notebook, without needing any expert coding skills;
- For advanced developers: master the skills to efficiently apply PowSyBl functionalities to your real-world scenarios.
The Metaverse and AI: how can decision-makers harness the Metaverse for their...Jen Stirrup
The Metaverse is popularized in science fiction, and now it is becoming closer to being a part of our daily lives through the use of social media and shopping companies. How can businesses survive in a world where Artificial Intelligence is becoming the present as well as the future of technology, and how does the Metaverse fit into business strategy when futurist ideas are developing into reality at accelerated rates? How do we do this when our data isn't up to scratch? How can we move towards success with our data so we are set up for the Metaverse when it arrives?
How can you help your company evolve, adapt, and succeed using Artificial Intelligence and the Metaverse to stay ahead of the competition? What are the potential issues, complications, and benefits that these technologies could bring to us and our organizations? In this session, Jen Stirrup will explain how to start thinking about these technologies as an organisation.
Climate Impact of Software Testing at Nordic Testing DaysKari Kakkonen
My slides at Nordic Testing Days 6.6.2024
Climate impact / sustainability of software testing discussed on the talk. ICT and testing must carry their part of global responsibility to help with the climat warming. We can minimize the carbon footprint but we can also have a carbon handprint, a positive impact on the climate. Quality characteristics can be added with sustainability, and then measured continuously. Test environments can be used less, and in smaller scale and on demand. Test techniques can be used in optimizing or minimizing number of tests. Test automation can be used to speed up testing.
2. Agenda
● What is Redis?
● Data structures overview
● Data modeling examples
● Keys expiration
● Redis transactions
● Redis pub/sub
● Pipelining
2
3. What is Redis?
● In-memory key-value store, with persistence
● Open source, written in C
● Extremely fast and lightweight
● Binary-safe keys with supported expiration
● High level data structures
● Support for atomic operations and transactions
● Internal scripting with LUA
● Master-slave replication
● Tons of client libraries for all major languages
3
4. History
● REmote DIctionary Server
● Released in March 2009 by Salvatore
Sanfilippo
● Built in order to scale http://lloogg.com/
● According to the monthly ranking by DB-
Engines.com, Redis is the most popular key-
value store
4
5. How to install?
● http://redis.io/download
● The Redis project does not officially support
Windows.
● Microsoft Open Tech group develops and
maintains this Windows port targeting
Win64.
5
6. Redis implementation details
● Redis is a TCP server using the client-server model.
● Redis protocol - simple and efficient text-based
protocol called RESP (REdis Serialization Protocol).
● Every Redis command is atomic, including the ones
that do multiple things.
● Redis is single-threaded, which is how every
command is guaranteed to be atomic. While one
command is executing, no other command will run.
6
7. Data structures overview
Key
● STRING - binary-safe string with max allowed size 512 MB
Value
● Primitives
○ STRING - Strings, integers, or floating point values
● Containers (of strings)
○ LIST - Linked list of strings
○ SET - Unordered collection of unique strings
○ HASH - Unordered hash table of keys to values
○ ZSET - Ordered mapping of string members to floating-
point scores, ordered by score
7
8. Redis STRING
The Redis String type is the simplest type
of value you can associate with a Redis
key. Integer and float numbers can be
stored as STRING type in Redis.
hello
world
string
Key name Type of value
Value stored
Command What it does
GET Fetches the data stored at the given key
SET Sets the value stored at the given key
DEL Deletes the value stored at the given key (works
for all types)
8
9. Redis STRING examples
redis> SET hello world
OK
redis> GET hello
"world"
redis> DEL hello
(integer) 1
redis> GET hello
(nil)
redis> SET counter 100
OK
redis> INCR counter
(integer) 101
redis> INCR counter
(integer) 102
redis> INCRBY counter 50
(integer) 152
9
10. Redis STRING use cases
● Use Strings to store serialized JSON/XML/etc data
● Use Strings as atomic counters using commands in
the INCR family: INCR, DECR, INCRBY.
● Append to strings with the APPEND command. Use
Strings as a random access vectors with
GETRANGE and SETRANGE.
10
11. Redis LIST
LISTs in Redis is a sequence of order
strings, implemented using a Linked
List.
list-key
item
item2
item
list
Key name Type of value
List of values,
duplicates possible
Command What it does
RPUSH Pushes the value onto the right end of the list
LRANGE Fetches a range of values from the list
LINDEX Fetches an item at a given position in the list
LPOP Pops the value from the left end of the list and
returns it
11
12. Redis LIST implementation details
● The max length of a list is 232
- 1 elements
(4294967295, more than 4 billion of elements per list).
● Redis lists are implemented via Linked Lists.
● The operation of adding a new element in the head or
in the tail of the list is performed in constant time.
● Accessing an element by index is very fast near the
head and tail of the list, but O(N) operation in the
middle.
12
14. Redis LIST use cases
● Model a timeline, for example in a social network, using
LPUSH in order to add new elements in the user time
line, and using LRANGE in order to retrieve a few of
recently inserted items.
● You can use LPUSH together with LTRIM to create a
list that never exceeds a given number of elements, but
just remembers the latest N elements.
● Lists can be used as a message passing primitive.
14
15. Redis SET
In Redis, SETs are similar to LISTs in
that they’re a sequence of strings, but
unlike LISTs, Redis SETs use a hash
table to keep all strings unique.
set-key
item2
item
item3
set
Key name Type of value
Set of distinct values,
undefined order
Command What it does
SADD Adds the item to the set
SMEMBERS Returns the entire set of items
SISMEMBER Checks if an item is in the set
SREM Removes the item from the set, if it exists
15
16. Redis SET implementation details
● Redis SET provides O(1) constant time
regardless of the number of elements
contained inside the set for add, remove and
test for member existance operations.
● Supports server-side operations of unions,
intersections, differences of sets.
● The max number of elements in set 232
- 1.
16
18. Redis SET use cases
● Use SETs to track unique things, for
example unique IP addresses or user ids
visiting a web page.
● Sets are good to represent relations
between objects. For example 1 to many
relation could be represented as a set order:
1234:items → [234, 555, 674]
18
19. Redis HASH
Redis HASHes store a mapping of keys to
values. The values that can be stored in
HASHes are strings and numbers.
hash-key
sub-key-1
sub-key-2
hash
Key name Type of value
Distinct keys,
undefined order
Command What it does
HSET Stores the value at the key in the hash
HGET Fetches the value at the given hash key
HGETALL Fetches the entire hash
HDEL Removes a key from the hash, if it exists
Values associated
with the key
value-1
value-2
19
20. Redis HASH implementation details
● The max number of elements in hash 232
- 1.
● A hash with a few fields (where few means
up to one hundred or so) is stored in a way
that takes very little space, so you can store
millions of objects in a small Redis instance.
20
22. ● Hashes are used mainly to represent objects. For
example, storing users as hashes:
Redis HASH use cases
users:1
{
id: 1,
name: john,
email: john@gmail.com
}
users:2
{
id: 1,
name: john,
email: john@gmail.com
}
22
23. Shopping cart example
cart
cart_line
Redis model
SET cart:john → [ 1, 3 ]
SET cart:james → [ 2 ]
HASH cart:1 { user: “john”, status: “submitted” }
HASH cart:2 { user: “james”, status: “in progress” }
HASH cart:1:products [ 28: 1, 372: 2 ]
HASH cart:2:products [ 15: 5, 160: 4 ]
CartID User Status
1 john Submitted
2 james In Progress
3 john Submitted
CartID ProductID Quantity
1 28 1
1 372 2
2 15 5
2 160 4
23
24. Redis ZSET
ZSET (Sorted set) is a data type which is similar to a mix
between a Set and a Hash. Every element (called
member) in a sorted set is associated with a floating point
value (called score).
zset-key
member1
member2
zset
Key name Type of value
Named
members,
ordered by
associated
score
Command What it does
ZADD Adds member with the given score to the
ZSET
ZRANGE Fetches the items in the ZSET from their
positions in sorted order
ZRANGEBYS
CORE
Fetches items in the ZSET based on a range
of scores
ZREM Removes the item from the ZSET, if it exists
Scores, ordered
by numeric value
728
982
24
25. Redis ZSET implementation details
● ZSET supports add, remove, or update elements in a time
proportional to the ln(N) (logarithm of the number of
elements).
● Since elements are taken in order get ranges by score or by
rank (position) could be done in a very fast way.
● Accessing the middle of a sorted set is also very fast, so
ZSETs can be used as a smart list of non repeating elements
where you can quickly access everything you need: elements
in order, fast existence test, fast access to elements in the
middle.
25
27. Redis ZSET use cases
● A leader board in an online game, where
every time a new score is submitted you
update it using ZADD.
● Top users can be easily get using ZRANGE.
● Using ZRANK can get a rank by username.
27
28. Redis key rules/recommendations
● Very long/short keys are not a good idea. For example,
key user:1000:followers is more readable than u1000flw.
● While short keys will obviously consume a bit less
memory, your job is to find the right balance between long
and short keys.
● Stick with a schema. For instance object-type:id is a
good idea, as in user:1000. Dots or dashes are often used
for multi-word fields, as in comment:1234:reply.to or
comment:1234:reply-to.
28
29. Redis keys anti-pattern
● We are building a blog and we need to store
comments added by users with keys look
like: posts:post_id:comment_id
● To find all comments added to specific post
you will use command: KEYS posts:1234:*
● Is there a better solution?
29
30. Redis keys anti-pattern (solution)
● The better solution is to use a hash with a new key
scheme posts:post_id:comments
● To add new comments to specific post use next
commands:
○ HSET posts:1234:comments 1 '{"id":1,
"account": 1233, "subject": "..."}'
○ HSET posts:1234:comments 2 '{"id":2,
"account": 1233, "subject": "..."}'
30
31. Redis keys anti-pattern (solution)
● To get all comment ids use command:
○ HKEYS posts:1234:comments
● To get comment by specific id use command:
○ HGET posts:1234:comments 2
● To delete a specific comment use command
○ HDEL posts:1234:comments 2
● To delete all post comments use command
○ DEL posts:1234:comments
31
32. Redis keys expiration
● Redis allows to set timeout (TTL) on keys by calling
EXPIRE key seconds command
● Timeout is cleared only when key is removed or using
DEL or overwritten with SET or GETSET commands
● Expiration could be refreshed by calling EXPIRE
command
● After timeout has expired, the key will be deleted
automatically
32
33. How Redis expires keys?
● Active way
○ Key is actively expired when some client tries to access
it, and the key is found to be timed out.
● Passive way
○ Redis does 10 times per second:
■ Test 20 random keys from the set of keys with an
associated expire.
■ Delete all the keys found expired.
■ If more than 25% of keys were expired, start again
from step 1.
33
34. Redis keys expiration examples
redis> SET mykey "Hello"
OK
redis> EXPIRE mykey 10
(integer) 1
redis> TTL mykey
(integer) 10
redis> SET mykey "Hello World"
OK
redis> TTL mykey
(integer) -1
34
35. Redis Transactions
● All commands are serialized and executed sequentially
● Transactions are atomic (without another client’s command
being executed halfway through)
● Either all commands or no commands will be executed
● Redis commands for transactions:
○ WATCH
○ MULTI
○ DISCARD
○ EXEC
○ UNWATCH
35
36. Redis Transactions example
redis> MULTI
OK
redis> INCR foo
QUEUED
redis> INCR boo
QUEUED
redis> EXEC
1) (integer) 1
2) (integer) 1
redis> WATCH foo, boo
OK
redis> MULTI
OK
redis> SET foo 2
QUEUED
redis> SET boo 3
QUEUED
redis> EXEC
1) OK
2) OK
36
37. Optimistic locking using CAS
● WATCH is used to provide a check-and-set (CAS)
behavior to Redis transactions.
● WATCHed keys are monitored in order to detect
changes against them.
● If at least one watched key is modified before the
EXEC command, the whole transaction aborts, and
EXEC returns a Null reply to notify that the
transaction failed.
37
38. Errors inside transactions
During a transaction it is possible to encounter two kind of
command errors:
● A command may fail to be queued, so there may be an
error before EXEC is called. For instance: syntactically
wrong command or another critical condition
● A command may fail after EXEC is called, for instance
since we performed an operation against a key with the
wrong value (like calling a list operation against a string
value).
38
39. Redis does not support roll backs
● Redis commands can fail only if called with a
wrong syntax, or against keys holding the wrong
data type.
● Redis is internally simplified and faster because
it does not need the ability to roll back.
39
40. Redis Publish/Subscribe
● Redis has first-class support for publishing messages
and subscribing to channels implemented by
SUBSCRIBE, PUBLISH and UNSUBSCRIBE
commands.
● Messages published into channels, without knowledge
of what subscribers there may be.
● Subscribers express interest in one or more channels,
and only receive messages that are of interest, without
knowledge of what publishers there are.
40
41. Pattern-matching subscriptions
● The Redis Pub/Sub supports pattern-
matching subscriptions
● PSUBSCRIBE tweets.* will receive
message from both tweets.john and
tweets.sean channels
● PUNSUBSCRIBE tweets.* will unsubscribe
the client from this pattern
41
43. Request/Response protocol and RTT
● Redis request is accomplished with the following two
steps:
○ The client sends a query to the server, and reads from
the socket, usually in a blocking way, for the server
response.
○ The server processes the command and sends the
response back to the client.
● RTT (Round Trip Time) - time for the packets to travel
from the client to the server, and back from the server to
the client to carry the reply.
43
44. What’s wrong with blocking request
● Four commands sequence is something like this:
○ Request: INCR X
○ Response: 1
○ Request: INCR X
○ Response: 2
○ Request: INCR X
○ Response: 3
○ Request: INCR X
○ Response: 4
● RTT time is 250 ms, Redis server is able to process 100k
request per second, so will be able to process max 4
requests per second
44
45. Redis Pipelining
● Pipelining is a way to send multiple commands to the server
without waiting for the replies at all, and finally read the
replies in a single step.
● Pipelined version of four commands sequence:
○ Request: INCR X
○ Request: INCR X
○ Request: INCR X
○ Request: INCR X
○ Response: 1
○ Response: 2
○ Response: 3
○ Response: 4
45
46. Redis Pipelining recommendations
● While client sends commands using
pipelining, server forced to queue the
responses in memory.
● To reduce memory usage when sending a
lot of commands better to send them as
batches having a reasonable number.
46
47. Links and Literature
● redis.io/documentation
● The Little Redis Book by Karl Seguin
● Redis in Action by Josiah L. Carlson
● Seven databases in seven weeks (The
Pragmatic Bookshelf, 2012)
47