SlideShare une entreprise Scribd logo
1  sur  27
Télécharger pour lire hors ligne
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

Contenu connexe

Tendances

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
 
DBD::Gofer 200809
DBD::Gofer 200809DBD::Gofer 200809
DBD::Gofer 200809Tim Bunce
 
A Brief Introduction to Redis
A Brief Introduction to RedisA Brief Introduction to Redis
A Brief Introduction to RedisCharles Anderson
 
Unleash your inner console cowboy
Unleash your inner console cowboyUnleash your inner console cowboy
Unleash your inner console cowboyKenneth Geisshirt
 
Rust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneRust: Systems Programming for Everyone
Rust: Systems Programming for EveryoneC4Media
 
Linux shell scripting tutorial
Linux shell scripting tutorialLinux shell scripting tutorial
Linux shell scripting tutorialsamsami1971
 
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.keyTim Bunce
 
Top 10 Perl Performance Tips
Top 10 Perl Performance TipsTop 10 Perl Performance Tips
Top 10 Perl Performance TipsPerrin 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 201406Tim Bunce
 
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 ConfTom Croucher
 
Node.js streaming csv downloads proxy
Node.js streaming csv downloads proxyNode.js streaming csv downloads proxy
Node.js streaming csv downloads proxyIsmael Celis
 

Tendances (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
 

Similaire à Fun with Ruby and Redis

Similaire à 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
 

Plus de 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? T3chfestjavier 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 databasejavier 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 QuestDBjavier 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 Databasejavier 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-20220728javier 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 2022javier 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ónjavier ramirez
 
Primeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessPrimeros pasos en desarrollo serverless
Primeros pasos en desarrollo serverlessjavier ramirez
 
How AWS is reinventing the cloud
How AWS is reinventing the cloudHow AWS is reinventing the cloud
How AWS is reinventing the cloudjavier 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 BEAMjavier ramirez
 
Getting started with streaming analytics
Getting started with streaming analyticsGetting started with streaming analytics
Getting started with streaming analyticsjavier 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 pipelinejavier ramirez
 
Getting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep DiveGetting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep Divejavier ramirez
 
Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)javier ramirez
 
Monitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWSMonitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWSjavier ramirez
 

Plus de javier ramirez (20)

¿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
 
Getting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep DiveGetting started with streaming analytics: Deep Dive
Getting started with streaming analytics: Deep Dive
 
Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)Getting started with streaming analytics: streaming basics (1 of 3)
Getting started with streaming analytics: streaming basics (1 of 3)
 
Monitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWSMonitorización de seguridad y detección de amenazas con AWS
Monitorización de seguridad y detección de amenazas con AWS
 

Dernier

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfRankYa
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionDilum Bandara
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxNavinnSomaal
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningLars Bell
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfPrecisely
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsMiki Katsuragi
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr BaganFwdays
 

Dernier (20)

From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Search Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdfSearch Engine Optimization SEO PDF for 2024.pdf
Search Engine Optimization SEO PDF for 2024.pdf
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
Advanced Computer Architecture – An Introduction
Advanced Computer Architecture – An IntroductionAdvanced Computer Architecture – An Introduction
Advanced Computer Architecture – An Introduction
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
SAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptxSAP Build Work Zone - Overview L2-L3.pptx
SAP Build Work Zone - Overview L2-L3.pptx
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
DSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine TuningDSPy a system for AI to Write Prompts and Do Fine Tuning
DSPy a system for AI to Write Prompts and Do Fine Tuning
 
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdfHyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
Hyperautomation and AI/ML: A Strategy for Digital Transformation Success.pdf
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 
Vertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering TipsVertex AI Gemini Prompt Engineering Tips
Vertex AI Gemini Prompt Engineering Tips
 
"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan"ML in Production",Oleksandr Bagan
"ML in Production",Oleksandr Bagan
 

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