Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
SlideShare a Scribd company logo
Javier Ramírez
@supercoco9
Fun with
and
What?
Redis is an open source, BSD licensed, advanced
key-value store. It is often referred to as a data
structure server since keys can contain strings, hashes,
lists, sets and sorted sets. (http://redis.io)
Salvatore
Sanfilippo
@antirez
Pieter
Noordhuis
@pnoordhuis
95 contributors at
https://github.com/antirez/redis
Who?
The Redis Manifesto
1.A DSL for Abstract Data Types
2.Memory storage is #1
3.Fundamental data structures for a fundamental API
4.Two levels of API
5.Code is like a poem; it's not just something we write
to reach some practical result
6.We're against complexity
7.We optimize for joy
Redis
is fast
unscientific benchmarks*
*on an AWS micro instance with the default install for postgresql and redis
PostgreSQL Redis
1K inserts 3.9s 0.07s
1K reads 0.113s 0.06s
10K inserts 42.9s 0.67s
10K reads 1.15s 0.6s
100K inserts 6.8m 7s
100K reads 11.59s 6.06s
100K pipelined
inserts
- 1.45s
100K pipelined
reads
- 1.22s
Redis is game changing
Disclaimer: after using it, you'll find yourself
doing things you wouldn't do before
Some will not make sense
As every other technology, Redis has its
sweet spot, but it's not a silver bullet
Abusing sidekiq/RESQUE
In memory data store
Redis stores all the data in memory all the
time. Plan your architecture accordingly
Persistance: RDB
Compact binary format
Saves snapshots every few minutes
Good for backups and synchronizing
If Redis crashes, a few minutes worth of
data will be lost
Durability: AOF
Log text format
Configurable durability
Large file, can slow down startup
If Redis crashes, typically one second of
data could be lost
Connecting from Ruby
redis-rb exposes calls to all the methods in the redis
protocol
other useful gems:
github.com/soveran/nest => helps with key naming
https://github.com/soveran/ohm => “ORM” for redis
github.com/obie/redis_props => properties for AR objects
github.com/nateware/redis-objects => map redis types to ruby
objects
github.com/agoragames/amico => redis-backed friendships
DATA TYPES
Strings
Hashes
Lists
Sets
Sorted Sets
Key handling
Transactions
Scripting
Pub/Sub
Server
Connection
untyped operations
STRING commands
string commands
append, get, getset, set
getrange, setrange, strlen
bitcount, bitop, getbit, setbit
mget, mset, msetnx
setnx, setex, psetex
incr, incrby, incrbyfloat, decr, decrby, decrbyfloat
LIST commands
llen, lindex, linsert, lrange, lrem, lset, ltrim
lpop, lpush, lpushx, rpop, , rpush, rpushx
blpop, brpop
rpoplpush, brpoplpush
List commands
Hash commands
hkeys, hvals, hlen, hgetall, hexists
hmget, hmset
hdel, hget, hset, hsetnx
hincrby, hincrbyfloat
at the hash level
at the attribute level
Set commands
sadd, scard, smembers,
sismember, srem, smove, srandmember, smove
sdiff, sinter, sunion
sdiffstore, sinterstore, sunionstore
Set commands
team.euruko.users javier diego matz nikos
team.teowaki.users javier diego alberto
team.euruko location:greece contact:nikos edition:2013
team.teowaki location:london contact:diego
tags.matz ruby mruby
tags.nikos ruby css
tags.javier ruby
tags.diego ruby chef
users.javier.teams euruko teowaki
users.alberto.teams teowaki
users.nikos.teams euruko
users.matz.teams euruko
users.diego.teams euruko teowaki
r.sunion r.smembers('team.euruko').map{|m| "tags.#{m}"}
=>["mruby", "ruby", "css", "chef"]
r.sinter r.smembers('team.euruko').map{|m| "tags.#{m}"}
=>["ruby"]
r.diff r.smembers('team.euruko').map{|m| "tags.#{m}"}
=>["mruby", "css", "chef"]
sorted Set commands
zadd, zcard, zcount
zincrby, zrank, zrem,zrevrank, zscore
zrange, zrangebyscore, zremrangebyrank, zrevrangebyscore, zrevrange,
zrevrangebyscore
zinterstore, zunionstore
Sorted set commands
counters
Atomic counters can be
safely invoked concurrently
from anywhere
You can create global sequences
with counters. Redis-objects
block semantics allow for
rewinding on errors
Scripting with lua*
You can use Lua for scripting Redis when you need to
atomically execute a sequence of commands in which the
output of a command is used as input for another
It reduces the need to use complex lock mechanisms and
simplifies dependencies between clients
You can even extend the functionality
of Redis by using Lua scripts
* no, mruby won't be supported
LUA example
Expiring attributes inside a Redis hash*
1
2
4
5
3
Temporary data
Very simple to implement
usage quota patterns
(even better if done in Lua)
It's possible to set self-expiring keys
Redis as a cache
maxmemory 128mb
maxmemory-policy allkeys-lru
#save 900 1
#save 300 10
#save 60 10000
Expire keys individually or turn off persistence and use
Redis as a cache system with automatic eviction
Multiple levels of cache by using Redis on the webserver/
middleware layer
http://wiki.nginx.org/HttpRedis
https://github.com/jodosha/redis-store
Redis as a PUBSUB system
redsmin: remote Monitor
Shameless self promotion
If you enjoyed this presentation, please thank me by
registering on http://teowaki.com
It's a site for developers, you can hang around for free, and
I think it's quite cool
<3 <3 <3
Javier Ramírez
@supercoco9

More Related Content

What's hot

Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3
Felix Geisendörfer
 
Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)
Felix Geisendörfer
 
COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?
Lloyd Huang
 
Unix shell scripting tutorial
Unix shell scripting tutorialUnix shell scripting tutorial
Unix shell scripting tutorial
Prof. Dr. K. Adisesha
 
DBD::Gofer 200809
DBD::Gofer 200809DBD::Gofer 200809
DBD::Gofer 200809
Tim Bunce
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to Redis
Charles Anderson
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
Kenneth Geisshirt
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
C4Media
 
extending-php
extending-phpextending-php
extending-php
tutorialsruby
 
Linux shell scripting tutorial
Linux shell scripting tutorialLinux shell scripting tutorial
Linux shell scripting tutorial
samsami1971
 
Application Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.keyApplication Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.key
Tim Bunce
 
Top 10 Perl Performance Tips
Top 10 Perl Performance TipsTop 10 Perl Performance Tips
Top 10 Perl Performance Tips
Perrin Harkins
 
Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406
Tim Bunce
 
Comredis
ComredisComredis
Comredis
Iuri Fernandes
 
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Using Node.js to  Build Great  Streaming Services - HTML5 Dev ConfUsing Node.js to  Build Great  Streaming Services - HTML5 Dev Conf
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Tom Croucher
 
Node.js streaming csv downloads proxy
Node.js streaming csv downloads proxyNode.js streaming csv downloads proxy
Node.js streaming csv downloads proxy
Ismael Celis
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
simha.dev.lin
 

What's hot (17)

Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3Nodejs - A-quick-tour-v3
Nodejs - A-quick-tour-v3
 
Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)Nodejs - A quick tour (v4)
Nodejs - A quick tour (v4)
 
COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?COSCUP2012: How to write a bash script like the python?
COSCUP2012: How to write a bash script like the python?
 
Unix shell scripting tutorial
Unix shell scripting tutorialUnix shell scripting tutorial
Unix shell scripting tutorial
 
DBD::Gofer 200809
DBD::Gofer 200809DBD::Gofer 200809
DBD::Gofer 200809
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to Redis
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboy
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for Everyone
 
extending-php
extending-phpextending-php
extending-php
 
Linux shell scripting tutorial
Linux shell scripting tutorialLinux shell scripting tutorial
Linux shell scripting tutorial
 
Application Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.keyApplication Logging in the 21st century - 2014.key
Application Logging in the 21st century - 2014.key
 
Top 10 Perl Performance Tips
Top 10 Perl Performance TipsTop 10 Perl Performance Tips
Top 10 Perl Performance Tips
 
Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406Devel::NYTProf v5 at YAPC::NA 201406
Devel::NYTProf v5 at YAPC::NA 201406
 
Comredis
ComredisComredis
Comredis
 
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
Using Node.js to  Build Great  Streaming Services - HTML5 Dev ConfUsing Node.js to  Build Great  Streaming Services - HTML5 Dev Conf
Using Node.js to Build Great Streaming Services - HTML5 Dev Conf
 
Node.js streaming csv downloads proxy
Node.js streaming csv downloads proxyNode.js streaming csv downloads proxy
Node.js streaming csv downloads proxy
 
Shell scripting
Shell scriptingShell scripting
Shell scripting
 

Similar to Fun with Ruby and Redis

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Itamar Haber
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
Alex Su
 
Redis overview
Redis overviewRedis overview
Redis overview
Ashokkumar T A
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
Arnab Mitra
 
Redis by-hari
Redis by-hariRedis by-hari
Redis by-hari
Hari Bachala
 
redis-demo.pptx
redis-demo.pptxredis-demo.pptx
redis-demo.pptx
SNEHKUMAR30
 
Redis meetup
Redis meetupRedis meetup
Redis meetup
Nikhil Dole
 
Redis tutoring
Redis tutoringRedis tutoring
Redis tutoring
Chen-Tien Tsai
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
NexThoughts Technologies
 
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
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon Kickoff
Itamar Haber
 
Redis database
Redis databaseRedis database
Redis database
Ñáwrás Ñzár
 
Redis
RedisRedis
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
Tanu Siwag
 
redis basics
redis basicsredis basics
redis basics
Manoj Kumar
 
Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWS
Amazon Web Services
 
Redis introduction
Redis introductionRedis introduction
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
Ricard Clau
 
quickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-adminquickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-admin
jorgesimao71
 
Java at lifeblob
Java at lifeblobJava at lifeblob
Java at lifeblob
Rakesh Rajan
 

Similar to Fun with Ruby and Redis (20)

Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis Introduction
Redis IntroductionRedis Introduction
Redis Introduction
 
Redis overview
Redis overviewRedis overview
Redis overview
 
Introduction to Redis
Introduction to RedisIntroduction to Redis
Introduction to Redis
 
Redis by-hari
Redis by-hariRedis by-hari
Redis by-hari
 
redis-demo.pptx
redis-demo.pptxredis-demo.pptx
redis-demo.pptx
 
Redis meetup
Redis meetupRedis meetup
Redis meetup
 
Redis tutoring
Redis tutoringRedis tutoring
Redis tutoring
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017Redis Modules - Redis India Tour - 2017
Redis Modules - Redis India Tour - 2017
 
Developing a Redis Module - Hackathon Kickoff
 Developing a Redis Module - Hackathon Kickoff Developing a Redis Module - Hackathon Kickoff
Developing a Redis Module - Hackathon Kickoff
 
Redis database
Redis databaseRedis database
Redis database
 
Redis
RedisRedis
Redis
 
Introduction to redis
Introduction to redisIntroduction to redis
Introduction to redis
 
redis basics
redis basicsredis basics
redis basics
 
Cost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWSCost Savings at High Performance with Redis Labs and AWS
Cost Savings at High Performance with Redis Labs and AWS
 
Redis introduction
Redis introductionRedis introduction
Redis introduction
 
Redis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHPRedis Everywhere - Sunshine PHP
Redis Everywhere - Sunshine PHP
 
quickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-adminquickguide-einnovator-10-redis-admin
quickguide-einnovator-10-redis-admin
 
Java at lifeblob
Java at lifeblobJava at lifeblob
Java at lifeblob
 

More from javier ramirez

Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...
Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...
Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...
javier ramirez
 
How We Added Replication to QuestDB - JonTheBeach
How We Added Replication to QuestDB - JonTheBeachHow We Added Replication to QuestDB - JonTheBeach
How We Added Replication to QuestDB - JonTheBeach
javier ramirez
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
javier ramirez
 
¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfest¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfest
javier ramirez
 
QuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series databaseQuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series database
javier ramirez
 
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
javier ramirez
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
javier ramirez
 
Deduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBDeduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDB
javier ramirez
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
javier ramirez
 
Your Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic DatabaseYour Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic Database
javier ramirez
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
javier ramirez
 
QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728
javier ramirez
 
Processing and analysing streaming data with Python. Pycon Italy 2022
Processing and analysing streaming  data with Python. Pycon Italy 2022Processing and analysing streaming  data with Python. Pycon Italy 2022
Processing and analysing streaming data with Python. Pycon Italy 2022
javier ramirez
 
QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...
javier ramirez
 
Servicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en AragónServicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en Aragón
javier ramirez
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverless
javier ramirez
 
How AWS is reinventing the cloud
How AWS is reinventing the cloudHow AWS is reinventing the cloud
How AWS is reinventing the cloud
javier ramirez
 
Analitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAMAnalitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAM
javier ramirez
 
Getting started with streaming analytics
Getting started with streaming analyticsGetting started with streaming analytics
Getting started with streaming analytics
javier ramirez
 
Getting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipelineGetting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipeline
javier ramirez
 

More from javier ramirez (20)

Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...
Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...
Cómo hemos implementado semántica de "Exactly Once" en nuestra base de datos ...
 
How We Added Replication to QuestDB - JonTheBeach
How We Added Replication to QuestDB - JonTheBeachHow We Added Replication to QuestDB - JonTheBeach
How We Added Replication to QuestDB - JonTheBeach
 
The Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series DatabaseThe Building Blocks of QuestDB, a Time Series Database
The Building Blocks of QuestDB, a Time Series Database
 
¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfest¿Se puede vivir del open source? T3chfest
¿Se puede vivir del open source? T3chfest
 
QuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series databaseQuestDB: The building blocks of a fast open-source time-series database
QuestDB: The building blocks of a fast open-source time-series database
 
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
Como creamos QuestDB Cloud, un SaaS basado en Kubernetes alrededor de QuestDB...
 
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
Ingesting Over Four Million Rows Per Second With QuestDB Timeseries Database ...
 
Deduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDBDeduplicating and analysing time-series data with Apache Beam and QuestDB
Deduplicating and analysing time-series data with Apache Beam and QuestDB
 
Your Database Cannot Do this (well)
Your Database Cannot Do this (well)Your Database Cannot Do this (well)
Your Database Cannot Do this (well)
 
Your Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic DatabaseYour Timestamps Deserve Better than a Generic Database
Your Timestamps Deserve Better than a Generic Database
 
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
Cómo se diseña una base de datos que pueda ingerir más de cuatro millones de ...
 
QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728QuestDB-Community-Call-20220728
QuestDB-Community-Call-20220728
 
Processing and analysing streaming data with Python. Pycon Italy 2022
Processing and analysing streaming  data with Python. Pycon Italy 2022Processing and analysing streaming  data with Python. Pycon Italy 2022
Processing and analysing streaming data with Python. Pycon Italy 2022
 
QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...QuestDB: ingesting a million time series per second on a single instance. Big...
QuestDB: ingesting a million time series per second on a single instance. Big...
 
Servicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en AragónServicios e infraestructura de AWS y la próxima región en Aragón
Servicios e infraestructura de AWS y la próxima región en Aragón
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverless
 
How AWS is reinventing the cloud
How AWS is reinventing the cloudHow AWS is reinventing the cloud
How AWS is reinventing the cloud
 
Analitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAMAnalitica de datos en tiempo real con Apache Flink y Apache BEAM
Analitica de datos en tiempo real con Apache Flink y Apache BEAM
 
Getting started with streaming analytics
Getting started with streaming analyticsGetting started with streaming analytics
Getting started with streaming analytics
 
Getting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipelineGetting started with streaming analytics: Setting up a pipeline
Getting started with streaming analytics: Setting up a pipeline
 

Recently uploaded

IVE 2024 Short Course - Lecture 2 - Fundamentals of Perception
IVE 2024 Short Course - Lecture 2 - Fundamentals of PerceptionIVE 2024 Short Course - Lecture 2 - Fundamentals of Perception
IVE 2024 Short Course - Lecture 2 - Fundamentals of Perception
Mark Billinghurst
 
Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...
Cori Faklaris
 
Epicor Kinetic REST API Services Overview.pptx
Epicor Kinetic REST API Services Overview.pptxEpicor Kinetic REST API Services Overview.pptx
Epicor Kinetic REST API Services Overview.pptx
Piyush Khalate
 
Mega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in MarketoMega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in Marketo
Stephanie Tyagita
 
FIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptxFIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Alliance
 
Starlink Product Specifications_HighPerformance-1.pdf
Starlink Product Specifications_HighPerformance-1.pdfStarlink Product Specifications_HighPerformance-1.pdf
Starlink Product Specifications_HighPerformance-1.pdf
ssuser0b9571
 
UiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentationsUiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentations
UiPathCommunity
 
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VRIVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
Mark Billinghurst
 
FIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptx
FIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptxFIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptx
FIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptx
FIDO Alliance
 
Jacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and UsesJacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and Uses
ldtexsolbl
 
AMD Zen 5 Architecture Deep Dive from Tech Day
AMD Zen 5 Architecture Deep Dive from Tech DayAMD Zen 5 Architecture Deep Dive from Tech Day
AMD Zen 5 Architecture Deep Dive from Tech Day
Low Hong Chuan
 
TribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeftTribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeft
Dimpy Adhikary
 
Ensuring Secure and Permission-Aware RAG Deployments
Ensuring Secure and Permission-Aware RAG DeploymentsEnsuring Secure and Permission-Aware RAG Deployments
Ensuring Secure and Permission-Aware RAG Deployments
Zilliz
 
Securiport Gambia - Intelligent Threat Analysis
Securiport Gambia - Intelligent Threat AnalysisSecuriport Gambia - Intelligent Threat Analysis
Securiport Gambia - Intelligent Threat Analysis
Securiport Gambia
 
Informatika smk kelas 10 kurikulum merdeka.pptx
Informatika smk kelas 10 kurikulum merdeka.pptxInformatika smk kelas 10 kurikulum merdeka.pptx
Informatika smk kelas 10 kurikulum merdeka.pptx
OkyPrayudi
 
Planetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile BrochurePlanetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile Brochure
Planetek Italia Srl
 
Project Delivery Methodology on a page with activities, deliverables
Project Delivery Methodology on a page with activities, deliverablesProject Delivery Methodology on a page with activities, deliverables
Project Delivery Methodology on a page with activities, deliverables
CLIVE MINCHIN
 
The learners analyze the various sectors of ICT and evaluate the potential ca...
The learners analyze the various sectors of ICT and evaluate the potential ca...The learners analyze the various sectors of ICT and evaluate the potential ca...
The learners analyze the various sectors of ICT and evaluate the potential ca...
maricrismontales
 
UiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, ConnectUiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPathCommunity
 
BCC -401-aktu-Cyber-Security Unit-1.docx
BCC -401-aktu-Cyber-Security Unit-1.docxBCC -401-aktu-Cyber-Security Unit-1.docx
BCC -401-aktu-Cyber-Security Unit-1.docx
pubgnewstate1620
 

Recently uploaded (20)

IVE 2024 Short Course - Lecture 2 - Fundamentals of Perception
IVE 2024 Short Course - Lecture 2 - Fundamentals of PerceptionIVE 2024 Short Course - Lecture 2 - Fundamentals of Perception
IVE 2024 Short Course - Lecture 2 - Fundamentals of Perception
 
Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...Connecting Attitudes and Social Influences with Designs for Usable Security a...
Connecting Attitudes and Social Influences with Designs for Usable Security a...
 
Epicor Kinetic REST API Services Overview.pptx
Epicor Kinetic REST API Services Overview.pptxEpicor Kinetic REST API Services Overview.pptx
Epicor Kinetic REST API Services Overview.pptx
 
Mega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in MarketoMega MUG 2024: Working smarter in Marketo
Mega MUG 2024: Working smarter in Marketo
 
FIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptxFIDO Munich Seminar: FIDO Tech Principles.pptx
FIDO Munich Seminar: FIDO Tech Principles.pptx
 
Starlink Product Specifications_HighPerformance-1.pdf
Starlink Product Specifications_HighPerformance-1.pdfStarlink Product Specifications_HighPerformance-1.pdf
Starlink Product Specifications_HighPerformance-1.pdf
 
UiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentationsUiPath Community Day Amsterdam presentations
UiPath Community Day Amsterdam presentations
 
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VRIVE 2024 Short Course Lecture 9 - Empathic Computing in VR
IVE 2024 Short Course Lecture 9 - Empathic Computing in VR
 
FIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptx
FIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptxFIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptx
FIDO Munich Seminar: Biometrics and Passkeys for In-Vehicle Apps.pptx
 
Jacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and UsesJacquard Fabric Explained: Origins, Characteristics, and Uses
Jacquard Fabric Explained: Origins, Characteristics, and Uses
 
AMD Zen 5 Architecture Deep Dive from Tech Day
AMD Zen 5 Architecture Deep Dive from Tech DayAMD Zen 5 Architecture Deep Dive from Tech Day
AMD Zen 5 Architecture Deep Dive from Tech Day
 
TribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeftTribeQonf2024_Dimpy_ShiftingSecurityLeft
TribeQonf2024_Dimpy_ShiftingSecurityLeft
 
Ensuring Secure and Permission-Aware RAG Deployments
Ensuring Secure and Permission-Aware RAG DeploymentsEnsuring Secure and Permission-Aware RAG Deployments
Ensuring Secure and Permission-Aware RAG Deployments
 
Securiport Gambia - Intelligent Threat Analysis
Securiport Gambia - Intelligent Threat AnalysisSecuriport Gambia - Intelligent Threat Analysis
Securiport Gambia - Intelligent Threat Analysis
 
Informatika smk kelas 10 kurikulum merdeka.pptx
Informatika smk kelas 10 kurikulum merdeka.pptxInformatika smk kelas 10 kurikulum merdeka.pptx
Informatika smk kelas 10 kurikulum merdeka.pptx
 
Planetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile BrochurePlanetek Italia Corporate Profile Brochure
Planetek Italia Corporate Profile Brochure
 
Project Delivery Methodology on a page with activities, deliverables
Project Delivery Methodology on a page with activities, deliverablesProject Delivery Methodology on a page with activities, deliverables
Project Delivery Methodology on a page with activities, deliverables
 
The learners analyze the various sectors of ICT and evaluate the potential ca...
The learners analyze the various sectors of ICT and evaluate the potential ca...The learners analyze the various sectors of ICT and evaluate the potential ca...
The learners analyze the various sectors of ICT and evaluate the potential ca...
 
UiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, ConnectUiPath Community Day Amsterdam: Code, Collaborate, Connect
UiPath Community Day Amsterdam: Code, Collaborate, Connect
 
BCC -401-aktu-Cyber-Security Unit-1.docx
BCC -401-aktu-Cyber-Security Unit-1.docxBCC -401-aktu-Cyber-Security Unit-1.docx
BCC -401-aktu-Cyber-Security Unit-1.docx
 

Fun with Ruby and Redis

  • 2. What? Redis is an open source, BSD licensed, advanced key-value store. It is often referred to as a data structure server since keys can contain strings, hashes, lists, sets and sorted sets. (http://redis.io) Salvatore Sanfilippo @antirez Pieter Noordhuis @pnoordhuis 95 contributors at https://github.com/antirez/redis Who?
  • 3. The Redis Manifesto 1.A DSL for Abstract Data Types 2.Memory storage is #1 3.Fundamental data structures for a fundamental API 4.Two levels of API 5.Code is like a poem; it's not just something we write to reach some practical result 6.We're against complexity 7.We optimize for joy
  • 5. unscientific benchmarks* *on an AWS micro instance with the default install for postgresql and redis PostgreSQL Redis 1K inserts 3.9s 0.07s 1K reads 0.113s 0.06s 10K inserts 42.9s 0.67s 10K reads 1.15s 0.6s 100K inserts 6.8m 7s 100K reads 11.59s 6.06s 100K pipelined inserts - 1.45s 100K pipelined reads - 1.22s
  • 6. Redis is game changing Disclaimer: after using it, you'll find yourself doing things you wouldn't do before
  • 7. Some will not make sense As every other technology, Redis has its sweet spot, but it's not a silver bullet
  • 9. In memory data store Redis stores all the data in memory all the time. Plan your architecture accordingly
  • 10. Persistance: RDB Compact binary format Saves snapshots every few minutes Good for backups and synchronizing If Redis crashes, a few minutes worth of data will be lost
  • 11. Durability: AOF Log text format Configurable durability Large file, can slow down startup If Redis crashes, typically one second of data could be lost
  • 12. Connecting from Ruby redis-rb exposes calls to all the methods in the redis protocol other useful gems: github.com/soveran/nest => helps with key naming https://github.com/soveran/ohm => “ORM” for redis github.com/obie/redis_props => properties for AR objects github.com/nateware/redis-objects => map redis types to ruby objects github.com/agoragames/amico => redis-backed friendships
  • 13. DATA TYPES Strings Hashes Lists Sets Sorted Sets Key handling Transactions Scripting Pub/Sub Server Connection untyped operations
  • 14. STRING commands string commands append, get, getset, set getrange, setrange, strlen bitcount, bitop, getbit, setbit mget, mset, msetnx setnx, setex, psetex incr, incrby, incrbyfloat, decr, decrby, decrbyfloat
  • 15. LIST commands llen, lindex, linsert, lrange, lrem, lset, ltrim lpop, lpush, lpushx, rpop, , rpush, rpushx blpop, brpop rpoplpush, brpoplpush List commands
  • 16. Hash commands hkeys, hvals, hlen, hgetall, hexists hmget, hmset hdel, hget, hset, hsetnx hincrby, hincrbyfloat at the hash level at the attribute level
  • 17. Set commands sadd, scard, smembers, sismember, srem, smove, srandmember, smove sdiff, sinter, sunion sdiffstore, sinterstore, sunionstore Set commands
  • 18. team.euruko.users javier diego matz nikos team.teowaki.users javier diego alberto team.euruko location:greece contact:nikos edition:2013 team.teowaki location:london contact:diego tags.matz ruby mruby tags.nikos ruby css tags.javier ruby tags.diego ruby chef users.javier.teams euruko teowaki users.alberto.teams teowaki users.nikos.teams euruko users.matz.teams euruko users.diego.teams euruko teowaki r.sunion r.smembers('team.euruko').map{|m| "tags.#{m}"} =>["mruby", "ruby", "css", "chef"] r.sinter r.smembers('team.euruko').map{|m| "tags.#{m}"} =>["ruby"] r.diff r.smembers('team.euruko').map{|m| "tags.#{m}"} =>["mruby", "css", "chef"]
  • 19. sorted Set commands zadd, zcard, zcount zincrby, zrank, zrem,zrevrank, zscore zrange, zrangebyscore, zremrangebyrank, zrevrangebyscore, zrevrange, zrevrangebyscore zinterstore, zunionstore Sorted set commands
  • 20. counters Atomic counters can be safely invoked concurrently from anywhere You can create global sequences with counters. Redis-objects block semantics allow for rewinding on errors
  • 21. Scripting with lua* You can use Lua for scripting Redis when you need to atomically execute a sequence of commands in which the output of a command is used as input for another It reduces the need to use complex lock mechanisms and simplifies dependencies between clients You can even extend the functionality of Redis by using Lua scripts * no, mruby won't be supported
  • 22. LUA example Expiring attributes inside a Redis hash* 1 2 4 5 3
  • 23. Temporary data Very simple to implement usage quota patterns (even better if done in Lua) It's possible to set self-expiring keys
  • 24. Redis as a cache maxmemory 128mb maxmemory-policy allkeys-lru #save 900 1 #save 300 10 #save 60 10000 Expire keys individually or turn off persistence and use Redis as a cache system with automatic eviction Multiple levels of cache by using Redis on the webserver/ middleware layer http://wiki.nginx.org/HttpRedis https://github.com/jodosha/redis-store
  • 25. Redis as a PUBSUB system
  • 27. Shameless self promotion If you enjoyed this presentation, please thank me by registering on http://teowaki.com It's a site for developers, you can hang around for free, and I think it's quite cool <3 <3 <3 Javier Ramírez @supercoco9