22
New York Redis Meetup Welcome Session June 26, 2012 @ayampolskiy @dannygnj

New York REDIS Meetup Welcome Session

Embed Size (px)

DESCRIPTION

 

Citation preview

Page 1: New York REDIS Meetup Welcome Session

New York Redis Meetup

Welcome Session

June 26, 2012

@ayampolskiy@dannygnj

Page 2: New York REDIS Meetup Welcome Session

Who Are We?Aleksandr Yampolskiy •CTO of Cinchcast, BlogTalkRadio, and Cinch.FM companies that provide solutions to create, share, measure, and monetize audio content.•Previously head of security and compliance for Gilt Groupe companies•Various leadership roles in Goldman Sachs, Oracle, Microsoft building scalable, enterprise software for IDM, SSO, AuthN/AuthZ. •Ph.D. in Cryptography

Danny Gershman•Senior Software Engineer at Cinchcast•Previously held position as Lead Software Engineer at The NewsMarket and Synaptic Digital•Systems Architect at Innovative Systems & Solutions•Specializing in web technologies, caching, and scale.

Page 3: New York REDIS Meetup Welcome Session

What is This Meetup?

• New York REDIS NOSQL Meetup• Topics of interest: REDIS, NOSQL,

Engineering, Entrepreneurs, Open-Source

Page 4: New York REDIS Meetup Welcome Session

What Do You Want to Get Out Of It?

Page 5: New York REDIS Meetup Welcome Session

What is REDIS?

• Database?• Caching?• Pub/Sub?• Key/Value Store?• Redis is more like a

flexible tool designed to solve specific problems

Page 6: New York REDIS Meetup Welcome Session

REDIS

REmote DIctionary Server  (www.redis.io)Key-Value Store “on steroids”Written by Salvatore Sanfilippo (@antirez) in 2009. Now up to 2.4.13

Page 7: New York REDIS Meetup Welcome Session

Redis Manifesto1. Redis is a DSL (Domain Specific Language) that

manipulates abstract data types and implemented as a TCP daemon. Keys are binary-safe strings and values are different kinds of abstract data types.

2. Redis has persistence option but Memory storage is #1. 3. The Redis API is a direct consequence of fundamental

data structures.4. Code is like a poem. 5. We believe designing systems is a fight against

complexity. Most of the time the best way to fight complexity is by not creating it at all.

6. Redis API has two levels: 1) a subset of the API fits naturally into a distributed version of Redis and 2) a more complex API that supports multi-key operations.

7. We optimize for joy. When there is no longer joy in writing code, the best thing to do is stop.

7

Page 8: New York REDIS Meetup Welcome Session

REDIS is Fast

• Fast ~100,000 queries per sec.

• Compare it with ~30,000 queries per sec for MS SQL Server (if you are lucky)

• Kind of like memcached, but values can be persisted and all keys are kept IN MEMORY.

Page 9: New York REDIS Meetup Welcome Session

Modern Computer Latency

L1 3 cycles

L2 14 cycles

RAM 250 cycles

DISK 41,000,000 cycles

NETWORK

240,000,000 cycles

Non-blocking

Blocking

Ryan Dahl, Yahoo BayJax meetup, May 2010

Page 10: New York REDIS Meetup Welcome Session

Who is using REDIS?

11

Page 11: New York REDIS Meetup Welcome Session

Data structures

Keys are strings which identify pieces of data (values)

Values can be strings, integers, hashes, lists, sets, or sorted sets

Various atomic operations (push, pop, add, read, set, etc.) – after all REDIS is single-threaded

12

Page 12: New York REDIS Meetup Welcome Session

Many Language Bindings

Page 13: New York REDIS Meetup Welcome Session

REDIS is Simple

Page 14: New York REDIS Meetup Welcome Session

Scale

Horizontal (multiple processes)

Vertical (master-slave)

Master-master via zookeeper

Page 15: New York REDIS Meetup Welcome Session

Master-Master Replication

Native Redis Master-Master replication doesn’t exist yet, slated for release end of year

Solution using Apache Zookeeper (http://zookeeper.apache.org/)

Checks for status using BLPOP

Will promote a slave to master

Page 16: New York REDIS Meetup Welcome Session

When Not to Use Redis

Data is larger than memory

Need ACID requirements

Big data

Page 17: New York REDIS Meetup Welcome Session

Security Concerns

It is designed to be used only inside trusted environment (kind of like MongoDB)

Basic password authentication (but it’s sent in cleartext)

No data encryption support

18

Page 18: New York REDIS Meetup Welcome Session

Security Recommendations

Configure firewall to block inbound access on REDIS ports

Don’t run REDIS server as root, and harden the server it’s on

Don’t store sensitive data in there.

19

Page 19: New York REDIS Meetup Welcome Session

AOP Caching• Dynamically construct a hash key from

argument values.• “Round up” volatile keys such as timestamps• Put into REDIS cache with a configurable TTL• Lookup from cache before SQL server + lazy

writes.

Page 20: New York REDIS Meetup Welcome Session

Real-time Analytics

Communicate from hydrating application

NodeJS listens to Redis and transmits data to a page using Socket.IO

Historical data is stored in Redis

Pub/Sub is used to notify listening sockets

Page 21: New York REDIS Meetup Welcome Session

Studio Callers

Page 22: New York REDIS Meetup Welcome Session

Cinchcast is Hiring• Well-funded profitable

startup used by millions.• Patented technology utilized

in a new way.• Medical/dental/etc. benefits.• Great office space in mid-

town right near subway.• Flexible hours. Top-notch

compensation + stock options.

Open Positions:•Back-end Architect•Lead Front-end Engineer

•If you are good we’ll find a role for you : [email protected]