Redis is an in-memory data structure store that can be used as a database, cache, or message broker. It supports string, hash, list, set and sorted set data types and allows for atomic operations and transactions. While data resides in memory, Redis can optionally persist data to disk for durability. It is useful for caching, real-time analytics, queues and more due to its speed, flexibility and support for pub/sub messaging.
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 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.
Introduction to memcached, a caching service designed for optimizing performance and scaling in the web stack, seen from perspective of MySQL/PHP users. Given for 2nd year students of professional bachelor in ICT at Kaho St. Lieven, Gent.
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!
Understanding and tuning WiredTiger, the new high performance database engine...Ontico
MongoDB 3.0 introduced the concept of different storage engine. The new engine known as WiredTiger introduces document level MVCC locking, compression and a choice between Btree or LSM indexes. In this talk you will learn about the storage engine architecture and specifically WiredTiger, and how to tune and monitor it for best performance.
MongoDB 3.0 представил новый концепт движков хранения. Новый движок известен как WiredTiger и предоставляет новый уровень документов MVCC фикс, компрессию и выбор между Btree или индексами LSM. В этом докладе вы поймете, как тюнить и мониторить архитектуры движка базы данных, а точнее WiredTiger для получения максимальной производительности.
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.
HBaseCon 2012 | HBase Schema Design - Ian Varley, SalesforceCloudera, Inc.
Most developers are familiar with the topic of “database design”. In the relational world, normalization is the name of the game. How do things change when you’re working with a scalable, distributed, non-SQL database like HBase? This talk will cover the basics of HBase schema design at a high level and give several common patterns and examples of real-world schemas to solve interesting problems. The storage and data access architecture of HBase (row keys, column families, etc.) will be explained, along with the pros and cons of different schema decisions.
Clickhouse Capacity Planning for OLAP Workloads, Mik Kocikowski of CloudFlareAltinity Ltd
Presented on December ClickHouse Meetup. Dec 3, 2019
Concrete findings and "best practices" from building a cluster sized for 150 analytic queries per second on 100TB of http logs. Topics covered: hardware, clients (http vs native), partitioning, indexing, SELECT vs INSERT performance, replication, sharding, quotas, and benchmarking.
This tutorial covers all parallel replication implementation in MariaDB 10.0 and 10.1 and MySQL 5.6, 5.7 and 8.0 (including how it works in Group Replication).
MySQL and MariaDB have different types of parallel replication. In this tutorial, we present the different implementations that allow us to understand their limitations and tuning parameters. We cover how to make parallel replication faster and what to avoid for maximizing its benefits. We also present tests from Booking.com workloads.
Some of the subjects that are covered are group commit and optimistic parallel replication in MariaDB, the parallelism interval of MySQL and its Write Set optimization, and the ?slowing down the master to speed up the slave? optimization.
After this tutorial, you will know everything you need to implement and tune parallel replication in your environment. But more importantly, we will show how you can test parallel replication benefit in a non-disruptive way before deployment.
This is the presentation I made on JavaDay Kiev 2015 regarding the architecture of Apache Spark. It covers the memory model, the shuffle implementations, data frames and some other high-level staff and can be used as an introduction to Apache Spark
A Day in the Life of a ClickHouse Query Webinar Slides Altinity Ltd
Why do queries run out of memory? How can I make my queries even faster? How should I size ClickHouse nodes for best cost-efficiency? The key to these questions and many others is knowing what happens inside ClickHouse when a query runs. This webinar is a gentle introduction to ClickHouse internals, focusing on topics that will help your applications run faster and more efficiently. We’ll discuss the basic flow of query execution, dig into how ClickHouse handles aggregation and joins, and show you how ClickHouse distributes processing within a single CPU as well as across many nodes in the network. After attending this webinar you’ll understand how to open up the black box and see what the parts are doing.
Introduction to memcached, a caching service designed for optimizing performance and scaling in the web stack, seen from perspective of MySQL/PHP users. Given for 2nd year students of professional bachelor in ICT at Kaho St. Lieven, Gent.
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!
Understanding and tuning WiredTiger, the new high performance database engine...Ontico
MongoDB 3.0 introduced the concept of different storage engine. The new engine known as WiredTiger introduces document level MVCC locking, compression and a choice between Btree or LSM indexes. In this talk you will learn about the storage engine architecture and specifically WiredTiger, and how to tune and monitor it for best performance.
MongoDB 3.0 представил новый концепт движков хранения. Новый движок известен как WiredTiger и предоставляет новый уровень документов MVCC фикс, компрессию и выбор между Btree или индексами LSM. В этом докладе вы поймете, как тюнить и мониторить архитектуры движка базы данных, а точнее WiredTiger для получения максимальной производительности.
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.
HBaseCon 2012 | HBase Schema Design - Ian Varley, SalesforceCloudera, Inc.
Most developers are familiar with the topic of “database design”. In the relational world, normalization is the name of the game. How do things change when you’re working with a scalable, distributed, non-SQL database like HBase? This talk will cover the basics of HBase schema design at a high level and give several common patterns and examples of real-world schemas to solve interesting problems. The storage and data access architecture of HBase (row keys, column families, etc.) will be explained, along with the pros and cons of different schema decisions.
Clickhouse Capacity Planning for OLAP Workloads, Mik Kocikowski of CloudFlareAltinity Ltd
Presented on December ClickHouse Meetup. Dec 3, 2019
Concrete findings and "best practices" from building a cluster sized for 150 analytic queries per second on 100TB of http logs. Topics covered: hardware, clients (http vs native), partitioning, indexing, SELECT vs INSERT performance, replication, sharding, quotas, and benchmarking.
This tutorial covers all parallel replication implementation in MariaDB 10.0 and 10.1 and MySQL 5.6, 5.7 and 8.0 (including how it works in Group Replication).
MySQL and MariaDB have different types of parallel replication. In this tutorial, we present the different implementations that allow us to understand their limitations and tuning parameters. We cover how to make parallel replication faster and what to avoid for maximizing its benefits. We also present tests from Booking.com workloads.
Some of the subjects that are covered are group commit and optimistic parallel replication in MariaDB, the parallelism interval of MySQL and its Write Set optimization, and the ?slowing down the master to speed up the slave? optimization.
After this tutorial, you will know everything you need to implement and tune parallel replication in your environment. But more importantly, we will show how you can test parallel replication benefit in a non-disruptive way before deployment.
This is the presentation I made on JavaDay Kiev 2015 regarding the architecture of Apache Spark. It covers the memory model, the shuffle implementations, data frames and some other high-level staff and can be used as an introduction to Apache Spark
A Day in the Life of a ClickHouse Query Webinar Slides Altinity Ltd
Why do queries run out of memory? How can I make my queries even faster? How should I size ClickHouse nodes for best cost-efficiency? The key to these questions and many others is knowing what happens inside ClickHouse when a query runs. This webinar is a gentle introduction to ClickHouse internals, focusing on topics that will help your applications run faster and more efficiently. We’ll discuss the basic flow of query execution, dig into how ClickHouse handles aggregation and joins, and show you how ClickHouse distributes processing within a single CPU as well as across many nodes in the network. After attending this webinar you’ll understand how to open up the black box and see what the parts are doing.
Logging at OVHcloud :
Logs Data platform est la plateforme de collecte, d'analyse et de gestion centralisée de logs d'OVHcloud. Cette plateforme a pour but de répondre aux challenges que constitue l'indexation de plus de 4000 milliards de logs par une entreprise comme OVHcloud. Cette présentation vous décrira l'architecture générale de Logs Data Platform autour de ses composants centraux Elasticsearch et Graylog et vous décrira les différentes problématiques de scalabilité, disponibilité, performance et d'évolutivité qui sont le quotidien de l'équipe Observability à OVHcloud.
a comprehensive good introduction to the the Big data world in AWS cloud, hadoop, Streaming, batch, Kinesis, DynamoDB, Hbase, EMR, Athena, Hive, Spark, Piq, Impala, Oozie, Data pipeline, Security , Cost, Best practices
Eko10 - Security Monitoring for Big Infrastructures without a Million Dollar ...Hernan Costante
Nowadays in an increasingly more complex and dynamic network its not enough to be a regex ninja and storing only the logs you think you might need. From network traffic to custom logs you won't know which logs will be crucial to stop the next attacker, and if you are not planning to spend a half of your security budget in a commercial solution we will show you a way to building you own SIEM with open source. The talk will go from how to build a powerful logging environment for your organization to scaling on the cloud and storing everything forever. We will walk through how to build such a system with open source solutions as Elasticsearch and Hadoop, and creating your own custom monitoring rules to monitor everything you need. The talk will also include how to secure the environment and allow restricted access to other teams as well as avoiding common pitfalls and ensuring compliance standards.
Redis - for duplicate detection on real time streamCodemotion
Roberto "frank" Franchini presenta a Codemotion Techmeetup Torino Redis, un data structure server che può utilizzare come chiavi stringhe, hashes, lists, sets, sorted sets, bitmaps e hyperloglogs
.
Presentations from the Cloudera Impala meetup on Aug 20 2013Cloudera, Inc.
Presentations from the Cloudera Impala meetup on Aug 20 2013:
- Nong Li on Parquet+Impala and UDF support
- Henry Robinson on performance tuning for Impala
Docker Introduction, and what's new in 0.9 — Docker Palo Alto at RelateIQJérôme Petazzoni
Docker is the Open Source container engine. This is an introduction to Docker, what it is, how it works, and some material presenting the new features in versions 0.8 and 0.9.
Docker and Containers for Development and Deployment — SCALE12XJérôme Petazzoni
Docker is an Open Source engine to build, run, and manage containers. We'll explain what are Linux Containers, what powers them (under the hood), and what extra value Docker brings to the table. Then we'll see what the typical Docker workflow looks like from a developer point of view. We'll also give an Ops perspective, including deployment options. If you already saw a "Docker 101", consider this presentation as the February 2014 update! :-)
Introduction to Docker (as presented at December 2013 Global Hackathon)Jérôme Petazzoni
Not on board of the Docker ship yet? This presentation will get you up to speed, and explain everything you want to know about Linux Containers and Docker, including the new features of the latest 0.7 version (which brings support for all Linux distros and kernels).
Searching Billions of Documents with RedisDvir Volk
RediSearch is a powerful Redis module for full-text and secondary indexing, that can scale to billions of documents and deliver super fast performance for real time indexing and searching. An overview of how it works and how it can scale to huge clusters.
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.
Connector Corner: Automate dynamic content and events by pushing a buttonDianaGray10
Here is something new! In our next Connector Corner webinar, we will demonstrate how you can use a single workflow to:
Create a campaign using Mailchimp with merge tags/fields
Send an interactive Slack channel message (using buttons)
Have the message received by managers and peers along with a test email for review
But there’s more:
In a second workflow supporting the same use case, you’ll see:
Your campaign sent to target colleagues for approval
If the “Approve” button is clicked, a Jira/Zendesk ticket is created for the marketing design team
But—if the “Reject” button is pushed, colleagues will be alerted via Slack message
Join us to learn more about this new, human-in-the-loop capability, brought to you by Integration Service connectors.
And...
Speakers:
Akshay Agnihotri, Product Manager
Charlie Greenberg, Host
GraphRAG is All You need? LLM & Knowledge GraphGuy Korland
Guy Korland, CEO and Co-founder of FalkorDB, will review two articles on the integration of language models with knowledge graphs.
1. Unifying Large Language Models and Knowledge Graphs: A Roadmap.
https://arxiv.org/abs/2306.08302
2. Microsoft Research's GraphRAG paper and a review paper on various uses of knowledge graphs:
https://www.microsoft.com/en-us/research/blog/graphrag-unlocking-llm-discovery-on-narrative-private-data/
Essentials of Automations: Optimizing FME Workflows with ParametersSafe Software
Are you looking to streamline your workflows and boost your projects’ efficiency? Do you find yourself searching for ways to add flexibility and control over your FME workflows? If so, you’re in the right place.
Join us for an insightful dive into the world of FME parameters, a critical element in optimizing workflow efficiency. This webinar marks the beginning of our three-part “Essentials of Automation” series. This first webinar is designed to equip you with the knowledge and skills to utilize parameters effectively: enhancing the flexibility, maintainability, and user control of your FME projects.
Here’s what you’ll gain:
- Essentials of FME Parameters: Understand the pivotal role of parameters, including Reader/Writer, Transformer, User, and FME Flow categories. Discover how they are the key to unlocking automation and optimization within your workflows.
- Practical Applications in FME Form: Delve into key user parameter types including choice, connections, and file URLs. Allow users to control how a workflow runs, making your workflows more reusable. Learn to import values and deliver the best user experience for your workflows while enhancing accuracy.
- Optimization Strategies in FME Flow: Explore the creation and strategic deployment of parameters in FME Flow, including the use of deployment and geometry parameters, to maximize workflow efficiency.
- Pro Tips for Success: Gain insights on parameterizing connections and leveraging new features like Conditional Visibility for clarity and simplicity.
We’ll wrap up with a glimpse into future webinars, followed by a Q&A session to address your specific questions surrounding this topic.
Don’t miss this opportunity to elevate your FME expertise and drive your projects to new heights of efficiency.
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Ramesh Iyer
In today's fast-changing business world, Companies that adapt and embrace new ideas often need help to keep up with the competition. However, fostering a culture of innovation takes much work. It takes vision, leadership and willingness to take risks in the right proportion. Sachin Dev Duggal, co-founder of Builder.ai, has perfected the art of this balance, creating a company culture where creativity and growth are nurtured at each stage.
JMeter webinar - integration with InfluxDB and GrafanaRTTS
Watch this recorded webinar about real-time monitoring of application performance. See how to integrate Apache JMeter, the open-source leader in performance testing, with InfluxDB, the open-source time-series database, and Grafana, the open-source analytics and visualization application.
In this webinar, we will review the benefits of leveraging InfluxDB and Grafana when executing load tests and demonstrate how these tools are used to visualize performance metrics.
Length: 30 minutes
Session Overview
-------------------------------------------
During this webinar, we will cover the following topics while demonstrating the integrations of JMeter, InfluxDB and Grafana:
- What out-of-the-box solutions are available for real-time monitoring JMeter tests?
- What are the benefits of integrating InfluxDB and Grafana into the load testing stack?
- Which features are provided by Grafana?
- Demonstration of InfluxDB and Grafana using a practice web application
To view the webinar recording, go to:
https://www.rttsweb.com/jmeter-integration-webinar
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.
Software Delivery At the Speed of AI: Inflectra Invests In AI-Powered QualityInflectra
In this insightful webinar, Inflectra explores how artificial intelligence (AI) is transforming software development and testing. Discover how AI-powered tools are revolutionizing every stage of the software development lifecycle (SDLC), from design and prototyping to testing, deployment, and monitoring.
Learn about:
• The Future of Testing: How AI is shifting testing towards verification, analysis, and higher-level skills, while reducing repetitive tasks.
• Test Automation: How AI-powered test case generation, optimization, and self-healing tests are making testing more efficient and effective.
• Visual Testing: Explore the emerging capabilities of AI in visual testing and how it's set to revolutionize UI verification.
• Inflectra's AI Solutions: See demonstrations of Inflectra's cutting-edge AI tools like the ChatGPT plugin and Azure Open AI platform, designed to streamline your testing process.
Whether you're a developer, tester, or QA professional, this webinar will give you valuable insights into how AI is shaping the future of software delivery.
Key Trends Shaping the Future of Infrastructure.pdfCheryl Hung
Keynote at DIGIT West Expo, Glasgow on 29 May 2024.
Cheryl Hung, ochery.com
Sr Director, Infrastructure Ecosystem, Arm.
The key trends across hardware, cloud and open-source; exploring how these areas are likely to mature and develop over the short and long-term, and then considering how organisations can position themselves to adapt and thrive.
UiPath Test Automation using UiPath Test Suite series, part 3DianaGray10
Welcome to UiPath Test Automation using UiPath Test Suite series part 3. In this session, we will cover desktop automation along with UI automation.
Topics covered:
UI automation Introduction,
UI automation Sample
Desktop automation flow
Pradeep Chinnala, Senior Consultant Automation Developer @WonderBotz and UiPath MVP
Deepak Rai, Automation Practice Lead, Boundaryless Group and UiPath MVP
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Jeffrey Haguewood
Sidekick Solutions uses Bonterra Impact Management (fka Social Solutions Apricot) and automation solutions to integrate data for business workflows.
We believe integration and automation are essential to user experience and the promise of efficient work through technology. Automation is the critical ingredient to realizing that full vision. We develop integration products and services for Bonterra Case Management software to support the deployment of automations for a variety of use cases.
This video focuses on the notifications, alerts, and approval requests using Slack for Bonterra Impact Management. The solutions covered in this webinar can also be deployed for Microsoft Teams.
Interested in deploying notification automations for Bonterra Impact Management? Contact us at sales@sidekicksolutionsllc.com to discuss next steps.
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Introduction to redis - version 2
1. "Little Server of Awesome"
2011 Dvir Volk
Software Architect, DoAT
dvir@doat.com http://doat.com
2. Redis: Key => DataStructure Server
● Memcache-ish in-memory key/value store
● But values are complex data types:
○ blobs
○ lists
○ sets
○ sorted sets
○ hash tables
● And it has persistence.
● Open source; very helpful and friendly community.
● Used in the real world: github, craigslist, bit.ly, engineyard...
● Used heavily in doAT as a front-end database, search, geo
resolving
3. Key Features and Cool Stuff
● All data is in memory (almost)
● All data is eventually persistent
● Handles huge workloads easily
● Mostly O(1) behavior, Ideal for write-heavy workloads
● Support for atomic operations, transactions
● Has pub/sub functionality
● Single threaded, uses aync. IO
● Internal scripting with LUA in alpha
4. A little benchmark
This is on my laptop (core i7 @2.2Ghz)
● SET: 187265.92 requests per second
● GET: 185185.17 requests per second
● INCR: 190114.06 requests per second
● LPUSH: 190114.06 requests per second
● LPOP: 187090.73 requests per second
●
● SADD: 186567.16 requests per second
● SPOP: 185873.61 requests per second
5. Scaling it up
● Master-slave replication out of the box
● Slaves can be made masters on the fly
● Redis-cluster in alpha state.
● Sharding supported by some clients
● Single threaded - run num_cores/2 instances on the same
machine
6. Persistence
● All data is synchronized to disk - eventually or immediately
● Pick your risk level Vs. performance
● Data is either dumped in a forked process, or written as a
append-only change-log (AOF)
● Append-only mode supports transactional disk writes so you
can lose no data (cost: 99% speed loss :) )
● You can save the state explicitly, background or blocking
● If the data is too big to fit in memory - redis can handle its
own swap.
8. The basics...
Get/Sets - nothing fancy. Keys are strings, anything goes - just quote spaces.
redis> SET foo "bar"
OK
redis> GET foo
"bar"
You can atomically increment numbers
redis> SET bar 337
OK
redis> INCRBY bar 1000
(integer) 1337
Getting multiple values at once
redis> MGET foo bar
1. "bar"
2. "1337"
Keys are lazily expired
redis> EXPIRE foo 1
(integer) 1
redis> GET foo
(nil)
Be careful with EXPIRE - re-setting a value without re-expiring it will remove the
expiration!
9. Atomic Operations
GETSET puts a different value inside a key, retriving the old one
redis> SET foo bar
OK
redis> GETSET foo baz
"bar"
redis> GET foo
"baz"
SETNX sets a value only if it does not exist
redis> SETNX foo bar
*OK*
redis> SETNX foo baz
*FAILS*
10. List operations
● Lists are your ordinary linked lists.
● You can push and pop at both sides, extract range, resize..
● Random access and ranges at O(N)
● BLPOP: Blocking POP - wait until a list has elements and pop
them. Useful for realtime stuff.
11. Set operations
● Sets are... well, sets of unique values w/ push, pop, etc.
● Sets can be intersected/diffed /union'ed server side.
● Can be useful as keys when building complex schemata.
12. Sorted Sets
● Same as sets, but with score per element
● Ranked ranges, aggregation of scores on INTERSECT
● Can be used as ordered keys in complex schemata
● Think timestamps, inverted index, geohashing, ip ranges
13. Hashes
● Hash tables as values
● Think of an object store with atomic access to object
members
redis> HSET foo bar 1 redis> HINCRBY foo bar 1
(integer) 1 (integer) 2
redis> HSET foo baz 2
(integer) 1 redis> HGET foo bar
redis> HSET foo foo foo "2"
(integer) 1
redis> HKEYS foo
redis> HGETALL foo 1. "bar"
{ 2. "baz"
"bar": "1", 3. "foo"
"baz": "2",
"foo": "foo"
}
14. PubSub - Publish/Subscribe
● Clients can subscribe to channels or patterns and receive
notifications when messages are sent to channels.
● Subscribing is O(1), posting messages is O(n)
● Think chats, Comet applications: real-time analytics, twitter
15. Transactions
● MULTI, ...., EXEC: Easy because of the single thread.
● All commands are executed after EXEC, block and return
values for the commands as a list.
● Example:
redis> MULTI
OK
redis> SET "foo" "bar"
QUEUED
redis> INCRBY "num" 1
QUEUED
redis> EXEC
1) OK
2) (integer) 1
● Transactions can be discarded with DISCARD.
● WATCH allows you to lock keys while you are queuing your
transaction, and avoid race conditions.
16. Gotchas, Lessons Learned
● 64 bit instances consume much much more RAM.
● Master/Slave sync far from perfect.
● DO NOT USE THE KEYS COMMAND!!!
● vm.overcommit_memory = 1
● Use MONITOR to see what's going on
17. Recipe 1: Social Feed
● Each User's followers are list: user:$ID:followers => { 1, 2, 4 }
● Each User's feed is a sorted set with the time-stamp being the
score: user:$ID:feed => { msg1234: 124950132, ... }
● Each message is either a blob or a HASH object with fields:
msg1234 => {title, text, ... }
● When a message is added, we:
○ add the message
○ read the posting user's follower list
○ add the message id to each follower's feed
● When a user reads their feeds, we use ZREVRANGE to get the
latest item ids, and HGETALL to fetch the message texts.
● For bonus points, connected users can receive push notifications
with PubSub
18. Recipe 2: Real-Time Analytics
● We want to measure page views, per page, one minute resolution,
in real time.
● Each page is represented by a sorted set, where the value is the
minute, and the score is the number of hits.
● On each page hit, we do ZINCRBY <page> <current_minute> 1
● Page views for the last N minutes: ZREVRANGE <page> 0 N
● Group several pages together: ZUNIONSTORE ... AGGREGATE
SUM
● Trimming for a specific window: ZREMRANGEBYRANK
● Again, PubSub can be used to push updates to clients
19. Recipe 3: Processing Queue
● Each task can be a blob describing it with json, using
SET/GET/DEL.
● We keep a list of pending tasks, or multiple lists per task
type/priority ("tasks:urgent")
● Worker procs can work from any machine over the network.
● Workers poll task queues using BRPOP tasks:urgent
● atomicity guaranteed!
● When a task is pulled it can be marked on a different list/set of
"tasks:inprogress". When a task is done it is moved to a "done"
or "failed" task list.
● A manager can monitor failed tasks and move them around.
20. Other use case ideas
● Geo Resolving with geohashing
● Implemented and opened by yours truly https://github.com/doat/geodis
● API Key and rate management
● Very fast key lookup, rate control counters using INCR
● Real time game data
● ZSETs for high scores, HASHES for online users, etc
● Database Shard Index
● map key => database id. Count size with SETS
● Comet - no polling ajax
● use BLPOP or pub/sub
● Machine learning data with automatic persistence.
● sorted sets are your vectors!
21. More resources
Redis' website:
http://redis.io
Excellent and more detailed presentation by Simon Willison (a
bit old):
http://simonwillison.net/static/2010/redis-tutorial/
Much more complex twitter clone:
http://code.google.com/p/redis/wiki/TwitterAlikeExample
Full command reference:
http://redis.io/commands