LECTURE 27. Python and Redis

Size: px
Start display at page:

Download "LECTURE 27. Python and Redis"

Transcription

1 LECTURE 27 Python and Redis

2 PYTHON AND REDIS Today, we ll be covering a useful but not entirely Python-centered topic: the inmemory datastore Redis. We ll start by introducing Redis itself and then discussing the Python clients available for interfacing with Redis. Then, we ll talk about some unique Python projects that enhance Redis functionality.

3 REDIS Redis is often known as a data-structure server. REmote DIctionary Server. Essentially, it is a key-value store which supports strings, lists, sets, sorted sets, hashes, and more. Each of these types has a number of supported atomic operations like appending to a string, pushing an element to a list, computing set intersection, etc. Compared to traditional databases, Redis is extremely fast. This is because the whole dataset is stored in-memory, as opposed to being written to disk on every transaction. The trade off here is that high write and read speed is achieved with the limitation of data sets that can't be larger than memory.

4 REDIS USAGE Commonly, Redis is used to buffer write-heavy small data and insert big blobs of data into an SQL or other on-disk database. Redis can also be partitioned into multiple instances of set up in a Master-Slave configuration. There is a new method of partitioning instances into a Redis Cluster, but it is currently in a kind of beta stage. Redis is not completely volatile it will write to disk but should not be relied upon for integrity. From the default Redis configuration file: save save save # after 900 sec (15 min) if at least 1 key changed # after 300 sec (5 min) if at least 10 keys changed # after 60 sec if at least keys changed

5 REDIS BASICS Assuming you have Redis installed (as easy as sudo aptget install redis-server on Ubuntu), you can get a command line to the local instance with redis-cli. Note that the INCR operation is completely atomic this prevents undefined behavior that might arise from two connections to the server. Note: the maximum allowed key size is 512 MB. ~$ redis-cli redis :6379> SET somekey "somevalue" OK redis :6379> GET somekey "somevalue" redis :6379> SET count 10 OK redis :6379> INCR count 1 redis :6379> INCR count 2 redis :6379> SETNX count 20 (integer) 0 redis :6379> INCR count 3 redis :6379> DEL count redis :6379> GET count (nil)

6 REDIS BASICS redis :6379> SET countdown "This message will self destruct in 20 secs" OK redis :6379> EXPIRE countdown 20 redis :6379> TTL countdown 4 redis :6379> TTL countdown (integer) 9 redis :6379> TTL countdown (integer) 5 redis :6379> TTL countdown (integer) 2 redis :6379> TTL countdown (integer) -2 redis :6379> TTL somekey (integer) -1 Expire will cause the first argument to become unavailable after some amount of time. TTL will display the time-to-live. A -2 sentinel value indicates that the item has expired. A -1 sentinel value indicates that it is not scheduled to expire.

7 REDIS BASICS One of the most useful Redis structures is the list, an ordered set of values. Redis structures do not need to be declared, you can immediately start working with a key as a certain structure by using its built-in methods as long as the key is not already defined. redis :6379> RPUSH fruit "apple" redis :6379> RPUSH fruit "orange" (integer) 2 redis :6379> LPUSH fruit "banana" (integer) 3 redis :6379> LRANGE fruit 0-1 1) "banana" 2) "apple" 3) "orange" redis :6379> LRANGE fruit 1 2 1) "apple" 2) "orange" redis :6379> LLEN fruit (integer) 3 redis :6379> LPOP fruit "banana" redis :6379> RPOP fruit "orange" redis :6379> LRANGE fruit 0-1 1) "apple"

8 REDIS BASICS Like a Python set, Redis sets are unordered and may only have one instance of any item. redis :6379> SADD veggies "potato" redis :6379> SADD veggies "cucumber" redis :6379> SADD veggies "brussel sprouts" redis :6379> SMEMBERS veggies 1) "potato" 2) "brussel sprouts" 3) "cucumber" redis :6379> SADD veggies "potato" (integer) 0 redis :6379> SISMEMBER veggies "cucumber" redis :6379> SREM veggies "brussel sprouts" 1 redis :6379> SADD other_veggies "carrot" redis :6379> SUNION veggies other_veggies 1) "carrot" 2) "potato" 3) "cucumber"

9 REDIS BASICS Sorted sets are like sets but each value in the set has an associated ordering value. redis :6379> ZADD hackers 1940 "Alan Kay" redis :6379> ZADD hackers 1906 "Grace Hopper" redis :6379> ZADD hackers 1953 "Richard Stallman" redis :6379> ZADD hackers 1916 "Claude Shannon" redis :6379> ZADD hackers 1912 "Alan Turing" redis :6379> ZRANGE hackers 2 4 1) "Claude Shannon" 2) "Alan Kay" 3) "Richard Stallman"

10 REDIS BASICS Hashes map string fields to string values. redis :6379> HSET user:1000 name "John Smith" redis :6379> HSET user:1000 redis :6379> HSET user:1000 password "s3cret" redis :6379> HGETALL user:1000 1) "name" 2) "John Smith" 3) " " 4) 5) "password" 6) "s3cret"

11 REDIS BASICS redis :6379> HMSET user:1001 name "Mary Jones" password "hidden" OK redis :6379> HGET user:1001 name "Mary Jones redis :6379> HSET user:1000 visits 10 redis :6379> HINCRBY user:1000 visits 1 1 redis :6379> HINCRBY user:1000 visits 10 (integer) 21 redis :6379> HDEL user:1000 visits redis :6379> HINCRBY user:1000 visits 1

12 REDIS BASICS Redis has commands for a simple Pub/Sub where publishers can publish messages to specific channels which are subscribed to by subscribers. SUBSCRIBE channel1 [channel2, ] UNSUBSCRIBE channel1 [channel2, ] PUBLISH channel message Broadcast message to subscribers of channel. PSUBSCIBE pattern1 [pattern2, ] subscribe to channel matching regex s. PUNSUBSCRIBE pattern1 [pattern2, ]

13 REDIS AND PYTHON There are a number of Python Redis clients available but the recommended client is redis-py. As usual, installation is as simple as $ sudo pip install redis Docs are available at readthedocs.

14 REDIS-PY Redis connections are made by instantiating the Redis or StrictRedis classes. Redis provides backwards compatibility with older versions of redis-py. class redis.strictredis(host='localhost', port=6379, password=none, ) This abstract class provides a Python interface to all Redis commands and an implementation of the Redis protocol.

15 REDIS-PY import redis conn = redis.strictredis(host='localhost', port=6379) conn.set('somekey', "somevalue") print "Somekey: ", conn.get('somekey') conn.set('count', 10) print "Count incremented: ", conn.incr('count') print "Count incremented: ", conn.incr('count') conn.setnx('count', 20) print "Count incremented: ", conn.incr('count') conn.delete('count') print "Count: ", conn.get('count') redis :6379> SET somekey "somevalue" OK redis :6379> GET somekey "somevalue" redis :6379> SET count 10 OK redis :6379> INCR count 1 redis :6379> INCR count 2 redis :6379> SETNX count 20 (integer) 0 redis :6379> INCR count 3 redis :6379> DEL count redis :6379> GET count (nil)

16 REDIS-PY import redis conn = redis.strictredis(host='localhost', port=6379) conn.set('somekey', "somevalue") print "Somekey: ", conn.get('somekey') conn.set('count', 10) print "Count incremented: ", conn.incr('count') print "Count incremented: ", conn.incr('count') conn.setnx('count', 20) print "Count incremented: ", conn.incr('count') conn.delete('count') print "Count: ", conn.get('count') $ python redis_ex.py Somekey: somevalue Count incremented: 11 Count incremented: 12 Count incremented: 13 Count: None

17 REDIS-PY The redis-py client has implemented a lot of the redis-cli commands identically. Take lists for example, RPUSH list item conn.rpush(list, item), LPUSH conn.lpush(list, item) RPOP list conn.rpop(list), LPOP list conn.lpop(list) LLEN list conn.llen(list) LRANGE list start end conn.lrange(list, start, end)

18 REDIS AS A REQUEST/RESPONSE QUEUE Say we want to use Redis as a queue in our application. Generally speaking, say our application processes both request items in the form of dictionary objects. Let s implement a class called RedisQueue_hash, which manages queues of request ids as well as hashes of the corresponding JSON objects.

19 QUEUES We have one queue called request. Each request has an associated id. The Ids are stored, in order, in a queue with the name request:queue. The JSON object corresponding to the id is stored in a hash with the key request:<id>. import redis class RedisQueue_hash(object): def init (self, **redis_kwargs): self. db = redis.redis(**redis_kwargs) def put(self, id, data_dict, queue): if queue=="request": key = "request:" + str(id) self. db.hmset(key,data_dict) self. db.rpush("request:queue",str(id)) return True else: return False

20 QUEUES Some other functions we might implement to make our lives better are qsize, empty, pop (for returning the oldest item in the queue), and get for retrieving the contents of a hash. def qsize(self, queue): return self. db.llen(queue + ":queue") def empty(self, queue): return self.qsize(queue) == 0 def pop(self, queue): return self. db.lpop(queue + ":queue") def get(self, id, queue): item = self. db.hgetall(queue+":"+str(id)) keys = self. db.hkeys(queue+":"+str(id)) for each in keys: self. db.hdel(queue+":"+str(id), each) return item

21 QUEUES >>> import RedisQueue_hash as rqh >>> conn = rqh.redisqueue_hash() >>> import uuid >>> conn.put(uuid.uuid4(), {'color': 'red', 'shape': 'star'}, 'request') True >>> conn.qsize('request') 1 >>> conn.empty('request') False >>> new_request = conn.pop('request') >>> print new_request 9e471e07-b334-42e8-a643-22bad18297c8 >>> conn.get(new_request, 'request') {'color': 'red', 'shape': 'star'} >>> conn.empty('request') True

22 CACHING INFO You can also use Redis as a quick and dirty cache for session related information. For example, when using a database like Cassandra, determining the next available row key for a record requires keeping track of inserted records manually. Implement a counter in Redis to store the currently available row key. Applications can atomically increment the key and grab it with INCR.

23 REDIS USAGE Show latest items listings in your home page. -- LPUSH is used to insert a content ID at the head of the list stored at a key. LTRIM is used to limit the number of items in the list to If the user needs to page beyond this cache only then are they sent to the database. Leaderboards and related problems. A leader board is a set sorted by score. The ZADD commands implements this directly and the ZREVRANGE command can be used to get the top 100 users by score and ZRANK can be used to get a users rank. Order by user votes and time. This is a leaderboard like Reddit where the score changes over time. LPUSH + LTRIM are used to add an article to a list. A background task polls the list and recomputes the order of the list and ZADD is used to populate the list in the new order. Implement expires on items. To keep a sorted list by time then use unix time as the key. The difficult task of expiring items is implemented by indexing current_time+time_to_live. Another background worker is used to make queries using ZRANGE... with SCORES and delete timed out entries. Counting stuff. Keeping stats of all kinds is common, say you want to know when to block an IP addresss. The INCRBY command makes it easy to atomically keep counters; GETSET to atomically clear the counter; the expire attribute can be used to tell when a key should be deleted. Unique N items in a given amount of time. This is the unique visitors problem and can be solved using SADD for each pageview. SADD won't add a member to a set if it already exists. Queues. Queues are everywhere in programming. In addition to the push and pop type commands, Redis has blocking queue commands so a program can wait on work being added to the queue by another program.

24 REDIS+PYTHON Besides the Python interface for manually manipulating Redis yourself, Python has some libraries that are built-off of Redis but specialized for certain tasks. RQ (Redis Queue) -- library for queuing jobs and processing them in the background with workers. leaderboard Redis-backed leaderboard library. runlog Redis-backed logging library for recurring jobs. Celery, a message-passing library, can be backed with Redis.

Redis Functions and Data Structures at Percona Live. Dave Nielsen, Developer Redis

Redis Functions and Data Structures at Percona Live. Dave Nielsen, Developer Redis Redis Functions and Data Structures at Percona Live Dave Nielsen, Developer Advocate dave@redislabs.com @davenielsen Redis Labs @redislabs Redis = A Unique Database Redis is an open source (BSD licensed),

More information

Redis - a Flexible Key/Value Datastore An Introduction

Redis - a Flexible Key/Value Datastore An Introduction Redis - a Flexible Key/Value Datastore An Introduction Alexandre Dulaunoy AIMS 2011 MapReduce and Network Forensic MapReduce is an old concept in computer science The map stage to perform isolated computation

More information

NoSQL: Redis and MongoDB A.A. 2016/17

NoSQL: Redis and MongoDB A.A. 2016/17 Università degli Studi di Roma Tor Vergata Dipartimento di Ingegneria Civile e Ingegneria Informatica NoSQL: Redis and MongoDB A.A. 2016/17 Matteo Nardelli Laurea Magistrale in Ingegneria Informatica -

More information

Dr. Chuck Cartledge. 19 Nov. 2015

Dr. Chuck Cartledge. 19 Nov. 2015 CS-695 NoSQL Database Redis (part 1 of 2) Dr. Chuck Cartledge 19 Nov. 2015 1/21 Table of contents I 1 Miscellanea 2 DB comparisons 3 Assgn. #7 4 Historical origins 5 Data model 6 CRUDy stuff 7 Other operations

More information

Jason Brelloch and William Gimson

Jason Brelloch and William Gimson Jason Brelloch and William Gimson Overview 1. Introduction 2. History 3. Specifications a. Structure b. Communication c. Datatypes 4. Command Overview 5. Advanced Capabilities 6. Advantages 7. Disadvantages

More information

Redis Func+ons and Data Structures

Redis Func+ons and Data Structures Redis Func+ons and Data Structures About This Talk Topic : Redis Func/ons and Data Structures Presenter: Redis Labs, the open source home and provider of enterprise Redis About Redis Labs: 5300+ paying

More information

Harnessing the Full power of Redis. Daniel Magliola

Harnessing the Full power of Redis. Daniel Magliola Harnessing the Full power of Redis Daniel Magliola daniel@danielmagliola.com http://danielmagliola.com What is Redis? Redis is essentially like Memcached, but better I mean, it s an in-memory key-value

More information

Classifying malware using network traffic analysis. Or how to learn Redis, git, tshark and Python in 4 hours.

Classifying malware using network traffic analysis. Or how to learn Redis, git, tshark and Python in 4 hours. Classifying malware using network traffic analysis. Or how to learn Redis, git, tshark and Python in 4 hours. Alexandre Dulaunoy January 9, 2015 Problem Statement We have more 5000 pcap files generated

More information

Amritansh Sharma

Amritansh Sharma 17.12.2018 Amritansh Sharma - 000473628 1 CONTENTS 1 Introduction and Background 3 1.1 Relational Databases 3 1.2 NoSQL Databases 4 1.3 Key Value Stores 5 2 Redis 7 2.1 Redis vs Other Key-Value Stores

More information

REDIS: NOSQL DATA STORAGE

REDIS: NOSQL DATA STORAGE REDIS: NOSQL DATA STORAGE 1 Presented By- Shalini Somani (13MCEC22) CATEGORIES OF NOSQL STORAGES Key-Value memcached Redis Column Family Cassandra HBase Document MongoDB Tabular BigTable Graph, XML, Object,

More information

Big Data Management and NoSQL Databases

Big Data Management and NoSQL Databases NDBI040 Big Data Management and NoSQL Databases Lecture 5. Key-value stores Doc. RNDr. Irena Holubova, Ph.D. holubova@ksi.mff.cuni.cz http://www.ksi.mff.cuni.cz/~holubova/ndbi040/ Key-value store Basic

More information

Database Solution in Cloud Computing

Database Solution in Cloud Computing Database Solution in Cloud Computing CERC liji@cnic.cn Outline Cloud Computing Database Solution Our Experiences in Database Cloud Computing SaaS Software as a Service PaaS Platform as a Service IaaS Infrastructure

More information

COSC Redis. Paul Moore, Stephen Smithbower, William Lee. March 11, 2013

COSC Redis. Paul Moore, Stephen Smithbower, William Lee. March 11, 2013 March 11, 2013 What is Redis? - Redis is an in-memory key-value data store. - Can be a middle-ware solution between your expensive persistent data-store (Oracle), and your application. - Provides PubSub,

More information

Buffering to Redis for Efficient Real-Time Processing. Percona Live, April 24, 2018

Buffering to Redis for Efficient Real-Time Processing. Percona Live, April 24, 2018 Buffering to Redis for Efficient Real-Time Processing Percona Live, April 24, 2018 Presenting Today Jon Hyman CTO & Co-Founder Braze (Formerly Appboy) @jon_hyman Mobile is at the vanguard of a new wave

More information

INFO-H-415 Advanced Databases Key-value stores and Redis. Fatemeh Shafiee Raisa Uku

INFO-H-415 Advanced Databases Key-value stores and Redis. Fatemeh Shafiee Raisa Uku INFO-H-415 Advanced Databases Key-value stores and Redis Fatemeh Shafiee 000454718 Raisa Uku 000456485 December 2017 Contents 1 Introduction 5 2 NoSQL Databases 5 2.1 Introduction to NoSQL Databases...............................

More information

pyredis Documentation

pyredis Documentation pyredis Documentation Release 0.0.5 Stephan Schultchen Jul 09, 2018 Contents 1 Introduction 3 1.1 Installing................................................. 3 1.2 Author..................................................

More information

IEMS 5780 / IERG 4080 Building and Deploying Scalable Machine Learning Services

IEMS 5780 / IERG 4080 Building and Deploying Scalable Machine Learning Services IEMS 5780 / IERG 4080 Building and Deploying Scalable Machine Learning Services Lecture 11 - Asynchronous Tasks and Message Queues Albert Au Yeung 22nd November, 2018 1 / 53 Asynchronous Tasks 2 / 53 Client

More information

CSC326 Persistent Programming i. CSC326 Persistent Programming

CSC326 Persistent Programming i. CSC326 Persistent Programming i CSC326 Persistent Programming ii REVISION HISTORY NUMBER DATE DESCRIPTION NAME 1.0 2011-09 JZ iii Contents 1 Agenda 1 2 Persistent Programming 1 3 File 1 4 File names and Path 2 5 Catching Exception

More information

Redis Ma as, greitas, galingas. Specialiai VilniusPHP

Redis Ma as, greitas, galingas. Specialiai VilniusPHP Redis Ma as, greitas, galingas Specialiai VilniusPHP 2013.06.06 Sergej Kurakin Na, Jūs mane jau nekarta matėte, tai nieko nesakysiu apie save. Kaip aš susipa inau! Tai buvo prieš keletą metų! Projektas

More information

Ruby on Redis. Pascal Weemaels Koen Handekyn Oct 2013

Ruby on Redis. Pascal Weemaels Koen Handekyn Oct 2013 Ruby on Redis Pascal Weemaels Koen Handekyn Oct 2013 Target Create a Zip file of PDF s parse csv based on a CSV data file Linear version Making it scale with Redis... zip Step 1: linear Parse CSV std lib

More information

Using Redis As a Time Series Database

Using Redis As a Time Series Database WHITE PAPER Using Redis As a Time Series Database Dr.Josiah Carlson, Author of Redis in Action CONTENTS Executive Summary 2 Use Cases 2 Advanced Analysis Using a Sorted Set with Hashes 2 Event Analysis

More information

whitepaper Using Redis As a Time Series Database: Why and How

whitepaper Using Redis As a Time Series Database: Why and How whitepaper Using Redis As a Time Series Database: Why and How Author: Dr.Josiah Carlson, Author of Redis in Action Table of Contents Executive Summary 2 A Note on Race Conditions and Transactions 2 Use

More information

Agenda. Introduction You Me JDriven The case : Westy Tracking Details Implementation Deployment

Agenda. Introduction You Me JDriven The case : Westy Tracking Details Implementation Deployment y t s e W g n i k c a r T e p o r u mmit E u S y r d un o F 6 d 1 u h t Clo 8 2 r e b m Septe Agenda Introduction You Me JDriven The case : Westy Tracking Details Implementation Deployment About you About

More information

Redisco Documentation

Redisco Documentation Redisco Documentation Release rc3 Sebastien Requiem November 29, 206 Contents Object Relation Manager 3. Model................................................... 3.2 Attributes.................................................

More information

Agenda. About Me JDriven The case : Westy Tracking Background Architecture Implementation Demo

Agenda. About Me JDriven The case : Westy Tracking Background Architecture Implementation Demo y t s e W g n i k c a r T and l a v a j # 6 1 h c r 8 Ma Agenda About Me JDriven The case : Westy Tracking Background Architecture Implementation Demo About me Proud dad of two kids and a '82 VW Westy

More information

Redis Tuesday, May 29, 12

Redis Tuesday, May 29, 12 Redis 2.6 @antirez Redis 2.6 Major new features. Based on unstable branch (minus the cluster code). Why a 2.6 release? Redis Cluster is a long term project (The hurried cat produced blind kittens). Intermediate

More information

Redis as a Time Series DB. Josiah Carlson

Redis as a Time Series DB. Josiah Carlson Redis as a Time Series DB Josiah Carlson - @dr_josiah Agenda Who are you? What is Redis? (3 minutes, optional) What is a time series database? Combining structures for success Analyzing/segmenting events

More information

How you can benefit from using. javier

How you can benefit from using. javier How you can benefit from using I was Lois Lane redis has super powers myth: the bottleneck redis-benchmark -r 1000000 -n 2000000 -t get,set,lpush,lpop,mset -P 16 -q On my laptop: SET: 513610 requests

More information

NoSQL Databases. an overview

NoSQL Databases. an overview NoSQL Databases an overview Who? Why? During studies: Excited by simplicity Crawler Project: 100 Million records Single server 100+ QPS Initially: Limited query options Now: Query them all Experimented

More information

REdis: Implementing Redis in Erlang. A step-by-step walkthrough

REdis: Implementing Redis in Erlang. A step-by-step walkthrough R: Implementing Redis in Erlang A step-by-step walkthrough 1 2 : Implementing Redis in Erlang A step-by-step walkthrough 2 My Background Microsoft Visual Studio Visto Corporation Founded Inaka Moved to

More information

django-redis-cache Documentation

django-redis-cache Documentation django-redis-cache Documentation Release 1.5.2 Sean Bleier Nov 15, 2018 Contents 1 Intro and Quick Start 3 1.1 Intro................................................... 3 1.2 Quick Start................................................

More information

The Little Redis Book is licensed under the Attribution-NonCommercial 3.0 Unported license. You should not have paid for this book.

The Little Redis Book is licensed under the Attribution-NonCommercial 3.0 Unported license. You should not have paid for this book. About This Book License The Little Redis Book is licensed under the Attribution-NonCommercial 3.0 Unported license. You should not have paid for this book. You are free to copy, distribute, modify or display

More information

The Little Redis Book is licensed under the Attribution-NonCommercial 3.0 Unported license. You should not have paid for this book.

The Little Redis Book is licensed under the Attribution-NonCommercial 3.0 Unported license. You should not have paid for this book. About This Book License The Little Redis Book is licensed under the Attribution-NonCommercial 3.0 Unported license. You should not have paid for this book. You are free to copy, distribute, modify or display

More information

Harness the power of Python magic methods and lazy objects.

Harness the power of Python magic methods and lazy objects. Harness the power of Python magic methods and lazy objects. By Sep Dehpour Aug 2016 zepworks.com sep at zepworks.com https://github.com/seperman/redisworks Lazy Loading Defer initialization of an object

More information

Beyond Relational Databases: MongoDB, Redis & ClickHouse. Marcos Albe - Principal Support Percona

Beyond Relational Databases: MongoDB, Redis & ClickHouse. Marcos Albe - Principal Support Percona Beyond Relational Databases: MongoDB, Redis & ClickHouse Marcos Albe - Principal Support Engineer @ Percona Introduction MySQL everyone? Introduction Redis? OLAP -vs- OLTP Image credits: 451 Research (https://451research.com/state-of-the-database-landscape)

More information

IERG 4080 Building Scalable Internet-based Services

IERG 4080 Building Scalable Internet-based Services Department of Information Engineering, CUHK Term 1, 2016/17 IERG 4080 Building Scalable Internet-based Services Lecture 7 Asynchronous Tasks and Message Queues Lecturer: Albert C. M. Au Yeung 20 th & 21

More information

INFO-H-415 Advanced Databases

INFO-H-415 Advanced Databases INFO-H-415 Advanced Databases Prof. Esteban Zimanyi In-memory Databases and Redis Larissa Leite Alexandr Tretyak Brussels, December 2015 In-memory databases An in-memory database system is a database management

More information

NoSQL Databases Analysis

NoSQL Databases Analysis NoSQL Databases Analysis Jeffrey Young Intro I chose to investigate Redis, MongoDB, and Neo4j. I chose Redis because I always read about Redis use and its extreme popularity yet I know little about it.

More information

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

IEMS 5722 Mobile Network Programming and Distributed Server Architecture Department of Information Engineering, CUHK MScIE 2 nd Semester, 2016/17 IEMS 5722 Mobile Network Programming and Distributed Server Architecture Lecture 6 Databases and Caches Lecturer: Albert C. M. Au

More information

IEMS 5722 Mobile Network Programming and Distributed Server Architecture

IEMS 5722 Mobile Network Programming and Distributed Server Architecture Department of Information Engineering, CUHK MScIE 2 nd Semester, 2016/17 IEMS 5722 Mobile Network Programming and Distributed Server Architecture Lecture 9 Asynchronous Tasks & Message Queues Lecturer:

More information

Intro to Redis. A Support Overview

Intro to Redis. A Support Overview Intro to Redis A Support Overview Matt Stancliff Redis Engineer NYC mstancliff@gopivotal.com Today What is Redis? How does Redis work? How do we configure Redis? How do Redis commands work? How do we manage

More information

Dr. Chuck Cartledge. 3 Dec. 2015

Dr. Chuck Cartledge. 3 Dec. 2015 CS-695 NoSQL Database Redis (part 2 of 2) Dr. Chuck Cartledge 3 Dec. 2015 1/14 Table of contents I 1 Miscellanea 2 DB comparisons 3 Assgn. #7 4 Misc. things 6 Course review 7 Conclusion 8 References 5

More information

Distributed Computation Models

Distributed Computation Models Distributed Computation Models SWE 622, Spring 2017 Distributed Software Engineering Some slides ack: Jeff Dean HW4 Recap https://b.socrative.com/ Class: SWE622 2 Review Replicating state machines Case

More information

Scrapy-Redis Documentation

Scrapy-Redis Documentation Scrapy-Redis Documentation Release 0.7.0-dev Rolando Espinoza Nov 13, 2017 Contents 1 Scrapy-Redis 3 1.1 Features.................................................. 3 1.2 Requirements...............................................

More information

Caching Memcached vs. Redis

Caching Memcached vs. Redis Caching Memcached vs. Redis San Francisco MySQL Meetup Ryan Lowe Erin O Neill 1 Databases WE LOVE THEM... Except when we don t 2 When Databases Rule Many access patterns on the same set of data Transactions

More information

Table of Contents GEEK GUIDE TAKE CONTROL OF GROWING REDIS NOSQL SERVER CLUSTERS

Table of Contents GEEK GUIDE TAKE CONTROL OF GROWING REDIS NOSQL SERVER CLUSTERS Table of Contents About the Sponsor... 4 Introduction... 5 Working with Redis... 10 Single-Server Redis... 15 Multi-Server Redis and Replication... 18 IBM s CAPI Technology... 21 Using Redis with CAPI...

More information

THE FLEXIBLE DATA-STRUCTURE SERVER THAT COULD.

THE FLEXIBLE DATA-STRUCTURE SERVER THAT COULD. REDIS THE FLEXIBLE DATA-STRUCTURE SERVER THAT COULD. @_chriswhitten_ REDIS REDIS April 10, 2009; 6 years old Founding Author: Salvatore Sanfilippo Stable release: 3.0.3 / June 4, 2015; 3 months ago Fundamental

More information

CISC 7610 Lecture 2b The beginnings of NoSQL

CISC 7610 Lecture 2b The beginnings of NoSQL CISC 7610 Lecture 2b The beginnings of NoSQL Topics: Big Data Google s infrastructure Hadoop: open google infrastructure Scaling through sharding CAP theorem Amazon s Dynamo 5 V s of big data Everyone

More information

Transformer Looping Functions for Pivoting the data :

Transformer Looping Functions for Pivoting the data : Transformer Looping Functions for Pivoting the data : Convert a single row into multiple rows using Transformer Looping Function? (Pivoting of data using parallel transformer in Datastage 8.5,8.7 and 9.1)

More information

Scaling. Yashh Nelapati Gotham City. Marty Weiner Krypton. Friday, July 27, 12

Scaling. Yashh Nelapati Gotham City. Marty Weiner Krypton. Friday, July 27, 12 Scaling Marty Weiner Krypton Yashh Nelapati Gotham City Pinterest is... An online pinboard to organize and share what inspires you. Relationships Marty Weiner Grayskull, Eternia Relationships Marty

More information

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras

Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Privacy and Security in Online Social Networks Department of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 08 Tutorial 2, Part 2, Facebook API (Refer Slide Time: 00:12)

More information

Scalable Time Series in PCP. Lukas Berk

Scalable Time Series in PCP. Lukas Berk Scalable Time Series in PCP Lukas Berk Summary Problem Statement Proposed Solution Redis Basic Types Summary Current Work Future Work Items Problem Statement Scaling PCP s metrics querying to hundreds/thousands

More information

MEMOIZATION, RECURSIVE DATA, AND SETS

MEMOIZATION, RECURSIVE DATA, AND SETS MEMOIZATION, RECURSIVE DATA, AND SETS 4b COMPUTER SCIENCE 61A July 18, 2013 1 Memoization Later in this class, you ll learn about orders of growth and how to analyze exactly how efficient (or inefficient)

More information

Lecture Notes to Big Data Management and Analytics Winter Term 2017/2018 NoSQL Databases

Lecture Notes to Big Data Management and Analytics Winter Term 2017/2018 NoSQL Databases Lecture Notes to Big Data Management and Analytics Winter Term 2017/2018 NoSQL Databases Matthias Schubert, Matthias Renz, Felix Borutta, Evgeniy Faerman, Christian Frey, Klaus Arthur Schmid, Daniyal Kazempour,

More information

Pypeline Documentation

Pypeline Documentation Pypeline Documentation Release 0.2 Kyle Corbitt May 09, 2014 Contents 1 Contents 3 1.1 Installation................................................ 3 1.2 Quick Start................................................

More information

TSM Studio Server Alerting User Guide

TSM Studio Server Alerting User Guide TSM Studio Server Alerting User Guide Table of Contents Disclaimer... 3 TSM Studio Server Alerting... 4 Activity Log Monitor Alerting... 5 Activity Log Alert Filters... 6 Setting up Activity Log Notification...

More information

Invitation to a New Kind of Database. Sheer El Showk Cofounder, Lore Ai We re Hiring!

Invitation to a New Kind of Database. Sheer El Showk Cofounder, Lore Ai   We re Hiring! Invitation to a New Kind of Database Sheer El Showk Cofounder, Lore Ai www.lore.ai We re Hiring! Overview 1. Problem statement (~2 minute) 2. (Proprietary) Solution: Datomics (~10 minutes) 3. Proposed

More information

Metadata state and history service for datasets

Metadata state and history service for datasets Faculty of Science and Technology Department of Computer Science Metadata state and history service for datasets Enable extracting, storing and access to metadata about a dataset over time. Roberth Hansen

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part V Lecture 13, March 10, 2014 Mohammad Hammoud Today Welcome Back from Spring Break! Today Last Session: DBMS Internals- Part IV Tree-based (i.e., B+

More information

MongoDB: Comparing WiredTiger In-Memory Engine to Redis. Jason Terpko DBA, Rackspace/ObjectRocket 1

MongoDB: Comparing WiredTiger In-Memory Engine to Redis. Jason Terpko DBA, Rackspace/ObjectRocket  1 MongoDB: Comparing WiredTiger In-Memory Engine to Redis Jason Terpko DBA, Rackspace/ObjectRocket www.linkedin.com/in/jterpko 1 Background Started out in relational databases in public education then financial

More information

Eventually Consistent HTTP with Statebox and Riak

Eventually Consistent HTTP with Statebox and Riak Eventually Consistent HTTP with Statebox and Riak Author: Bob Ippolito (@etrepum) Date: November 2011 Venue: QCon San Francisco 2011 1/62 Introduction This talk isn't really about web. It's about how we

More information

Introduction to store data in Redis, a persistent and fast key-value database

Introduction to store data in Redis, a persistent and fast key-value database AMICT 2010-2011. pp. 39 49 39 Introduction to store data in Redis, a persistent and fast key-value database Matti Paksula Department of Computer Science, University of Helsinki P.O.Box 68, FI-00014 University

More information

Database Applications (15-415)

Database Applications (15-415) Database Applications (15-415) DBMS Internals- Part V Lecture 15, March 15, 2015 Mohammad Hammoud Today Last Session: DBMS Internals- Part IV Tree-based (i.e., B+ Tree) and Hash-based (i.e., Extendible

More information

Distributed Systems. 29. Distributed Caching Paul Krzyzanowski. Rutgers University. Fall 2014

Distributed Systems. 29. Distributed Caching Paul Krzyzanowski. Rutgers University. Fall 2014 Distributed Systems 29. Distributed Caching Paul Krzyzanowski Rutgers University Fall 2014 December 5, 2014 2013 Paul Krzyzanowski 1 Caching Purpose of a cache Temporary storage to increase data access

More information

Scaling. Marty Weiner Grayskull, Eternia. Yashh Nelapati Gotham City

Scaling. Marty Weiner Grayskull, Eternia. Yashh Nelapati Gotham City Scaling Marty Weiner Grayskull, Eternia Yashh Nelapati Gotham City Pinterest is... An online pinboard to organize and share what inspires you. Relationships Marty Weiner Grayskull, Eternia Yashh Nelapati

More information

Optimizing Session Caches in PowerCenter

Optimizing Session Caches in PowerCenter Optimizing Session Caches in PowerCenter 1993-2015 Informatica Corporation. No part of this document may be reproduced or transmitted in any form, by any means (electronic, photocopying, recording or otherwise)

More information

Package redux. May 31, 2018

Package redux. May 31, 2018 Title R Bindings to 'hiredis' Version 1.1.0 Package redux May 31, 2018 A 'hiredis' wrapper that includes support for transactions, pipelining, blocking subscription, serialisation of all keys and values,

More information

CSC148H Week 3. Sadia Sharmin. May 24, /20

CSC148H Week 3. Sadia Sharmin. May 24, /20 CSC148H Week 3 Sadia Sharmin May 24, 2017 1/20 Client vs. Developer I For the first couple of weeks, we have played the role of class designer I However, you are also often in the opposite role: when a

More information

Service Manager. Database Configuration Guide

Service Manager. Database Configuration Guide Service Manager powered by HEAT Database Configuration Guide 2017.2.1 Copyright Notice This document contains the confidential information and/or proprietary property of Ivanti, Inc. and its affiliates

More information

MongoDB and Mysql: Which one is a better fit for me? Room 204-2:20PM-3:10PM

MongoDB and Mysql: Which one is a better fit for me? Room 204-2:20PM-3:10PM MongoDB and Mysql: Which one is a better fit for me? Room 204-2:20PM-3:10PM About us Adamo Tonete MongoDB Support Engineer Agustín Gallego MySQL Support Engineer Agenda What are MongoDB and MySQL; NoSQL

More information

Introduction to Databases and SQL

Introduction to Databases and SQL Introduction to Databases and SQL Files vs Databases In the last chapter you learned how your PHP scripts can use external files to store and retrieve data. Although files do a great job in many circumstances,

More information

Manual Mysql Query Cache Hit Rate 0

Manual Mysql Query Cache Hit Rate 0 Manual Mysql Query Cache Hit Rate 0 B) why the Table cache hit rate is only 56% How can i achieve better cache hit rate? (OK) Currently running supported MySQL version 5.5.43-0+deb7u1-log or complex to

More information

Bigtable. Presenter: Yijun Hou, Yixiao Peng

Bigtable. Presenter: Yijun Hou, Yixiao Peng Bigtable Fay Chang, Jeffrey Dean, Sanjay Ghemawat, Wilson C. Hsieh, Deborah A. Wallach Mike Burrows, Tushar Chandra, Andrew Fikes, Robert E. Gruber Google, Inc. OSDI 06 Presenter: Yijun Hou, Yixiao Peng

More information

The Big Python Guide

The Big Python Guide The Big Python Guide Big Python Guide - Page 1 Contents Input, Output and Variables........ 3 Selection (if...then)......... 4 Iteration (for loops)......... 5 Iteration (while loops)........ 6 String

More information

Amazon ElastiCache 8/1/17. Why Amazon ElastiCache is important? Introduction:

Amazon ElastiCache 8/1/17. Why Amazon ElastiCache is important? Introduction: Amazon ElastiCache Introduction: How to improve application performance using caching. What are the ElastiCache engines, and the difference between them. How to scale your cluster vertically. How to scale

More information

Lecture 21 11/27/2017 Next Lecture: Quiz review & project meetings Streaming & Apache Kafka

Lecture 21 11/27/2017 Next Lecture: Quiz review & project meetings Streaming & Apache Kafka Lecture 21 11/27/2017 Next Lecture: Quiz review & project meetings Streaming & Apache Kafka What problem does Kafka solve? Provides a way to deliver updates about changes in state from one service to another

More information

Index Construction. Dictionary, postings, scalable indexing, dynamic indexing. Web Search

Index Construction. Dictionary, postings, scalable indexing, dynamic indexing. Web Search Index Construction Dictionary, postings, scalable indexing, dynamic indexing Web Search 1 Overview Indexes Query Indexing Ranking Results Application Documents User Information analysis Query processing

More information

10. Replication. CSEP 545 Transaction Processing Philip A. Bernstein. Copyright 2003 Philip A. Bernstein. Outline

10. Replication. CSEP 545 Transaction Processing Philip A. Bernstein. Copyright 2003 Philip A. Bernstein. Outline 10. Replication CSEP 545 Transaction Processing Philip A. Bernstein Copyright 2003 Philip A. Bernstein 1 Outline 1. Introduction 2. Primary-Copy Replication 3. Multi-Master Replication 4. Other Approaches

More information

Finding Similar Sets. Applications Shingling Minhashing Locality-Sensitive Hashing

Finding Similar Sets. Applications Shingling Minhashing Locality-Sensitive Hashing Finding Similar Sets Applications Shingling Minhashing Locality-Sensitive Hashing Goals Many Web-mining problems can be expressed as finding similar sets:. Pages with similar words, e.g., for classification

More information

redis-py Documentation

redis-py Documentation redis-py Documentation Release 2.7.2 Andy McCurdy, Mahdi Yusuf September 10, 2015 Contents 1 Redis 3 2 StrictRedis 5 3 Connections 19 4 Utils 23 5 Exceptions 25 6 Indices and tables 27 i ii Contents:

More information

What we already know. more of what we know. results, searching for "This" 6/21/2017. chapter 14

What we already know. more of what we know. results, searching for This 6/21/2017. chapter 14 What we already know chapter 14 Files and Exceptions II Files are bytes on disk. Two types, text and binary (we are working with text) open creates a connection between the disk contents and the program

More information

Spring Modern Computer Science in a Unix Like Environment CIS c

Spring Modern Computer Science in a Unix Like Environment   CIS c Spring 2009 Modern Computer Science in a Unix Like Environment http://www.seas.upenn.edu/~cis399ux 25/01/09 Slide 1 What is Unix/Linux? Linux itself is an Operating System Kernel Linux is often used to

More information

Performance Tuning. Chapter 25

Performance Tuning. Chapter 25 Chapter 25 Performance Tuning This chapter covers the following topics: Overview, 618 Identifying the Performance Bottleneck, 619 Optimizing the Target Database, 624 Optimizing the Source Database, 627

More information

Information Retrieval

Information Retrieval Introduction to Information Retrieval Lecture 4: Index Construction 1 Plan Last lecture: Dictionary data structures Tolerant retrieval Wildcards Spell correction Soundex a-hu hy-m n-z $m mace madden mo

More information

ECE Spring 2018 Problem Set #0 Due: 1/30/18

ECE Spring 2018 Problem Set #0 Due: 1/30/18 ECE 45234 - Spring 2018 Problem Set #0 Due: 1/30/18 The purpose of this first problem set is to remind you of the material you need from 2574 and help get you up-to-speed with python. This course uses

More information

Lecture 12 ADTs and Stacks

Lecture 12 ADTs and Stacks Lecture 12 ADTs and Stacks Modularity Divide the program into smaller parts Advantages Keeps the complexity managable Isolates errors (parts can be tested independently) Can replace parts easily Eliminates

More information

NoSQL Databases An efficient way to store and query heterogeneous astronomical data in DACE. Nicolas Buchschacher - University of Geneva - ADASS 2018

NoSQL Databases An efficient way to store and query heterogeneous astronomical data in DACE. Nicolas Buchschacher - University of Geneva - ADASS 2018 NoSQL Databases An efficient way to store and query heterogeneous astronomical data in DACE DACE https://dace.unige.ch Data and Analysis Center for Exoplanets. Facility to store, exchange and analyse data

More information

O Reilly RailsConf,

O Reilly RailsConf, O Reilly RailsConf, 2011-05- 18 Who is that guy? Jesper Richter- Reichhelm / @jrirei Berlin, Germany Head of Engineering @ wooga Wooga does social games Wooga has dedicated game teams Cooming soon PHP

More information

Munster Programming Training - Cycle 2

Munster Programming Training - Cycle 2 Munster Programming Training - Cycle 2 Lecture 3 - Binary Search & Queues & Stacks Bastien Pietropaoli bastien.pietropaoli@insight-centre.org Time complexity Previously On MPT Cycle 2 Recursions Exercise

More information

How to Design Programs

How to Design Programs How to Design Programs How to (in Racket): represent data variants trees and lists write functions that process the data See also http://www.htdp.org/ 1 Running Example: GUIs Pick a fruit: Apple Banana

More information

Putting together the platform: Riak, Redis, Solr and Spark. Bryan Hunt

Putting together the platform: Riak, Redis, Solr and Spark. Bryan Hunt Putting together the platform: Riak, Redis, Solr and Spark Bryan Hunt 1 $ whoami Bryan Hunt Client Services Engineer @binarytemple 2 Minimum viable product - the ideologically correct doctrine 1. Start

More information

ASP.NET State Management Techniques

ASP.NET State Management Techniques ASP.NET State Management Techniques This article is for complete beginners who are new to ASP.NET and want to get some good knowledge about ASP.NET State Management. What is the need of State Management?

More information

8/24/2017 Week 1-B Instructor: Sangmi Lee Pallickara

8/24/2017 Week 1-B Instructor: Sangmi Lee Pallickara Week 1-B-0 Week 1-B-1 CS535 BIG DATA FAQs Slides are available on the course web Wait list Term project topics PART 0. INTRODUCTION 2. DATA PROCESSING PARADIGMS FOR BIG DATA Sangmi Lee Pallickara Computer

More information

Genesys Mobile Services Deployment Guide. Most Common System Errors

Genesys Mobile Services Deployment Guide. Most Common System Errors Genesys Mobile Services Deployment Guide Most Common System Errors 9/4/2018 Contents 1 Most Common System Errors 1.1 At Start-up 1.2 Errors in GMS Core Functionality 1.3 Callback Service Errors 2 Chat

More information

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23

Final Exam Review 2. Kathleen Durant CS 3200 Northeastern University Lecture 23 Final Exam Review 2 Kathleen Durant CS 3200 Northeastern University Lecture 23 QUERY EVALUATION PLAN Representation of a SQL Command SELECT {DISTINCT} FROM {WHERE

More information

GFS Overview. Design goals/priorities Design for big-data workloads Huge files, mostly appends, concurrency, huge bandwidth Design for failures

GFS Overview. Design goals/priorities Design for big-data workloads Huge files, mostly appends, concurrency, huge bandwidth Design for failures GFS Overview Design goals/priorities Design for big-data workloads Huge files, mostly appends, concurrency, huge bandwidth Design for failures Interface: non-posix New op: record appends (atomicity matters,

More information

Managing IoT and Time Series Data with Amazon ElastiCache for Redis

Managing IoT and Time Series Data with Amazon ElastiCache for Redis Managing IoT and Time Series Data with ElastiCache for Redis Darin Briskman, ElastiCache Developer Outreach Michael Labib, Specialist Solutions Architect 2016, Web Services, Inc. or its Affiliates. All

More information

Distributed KIDS Labs 1

Distributed KIDS Labs 1 Distributed Databases @ KIDS Labs 1 Distributed Database System A distributed database system consists of loosely coupled sites that share no physical component Appears to user as a single system Database

More information

Building tools with Python

Building tools with Python Esri International User Conference San Diego, California Technical Workshops 7/25/2012 Building tools with Python Dale Honeycutt Session description Building Tools with Python A geoprocessing tool does

More information

C exam. Number: C Passing Score: 800 Time Limit: 120 min IBM C IBM Cloud Platform Application Development

C exam. Number: C Passing Score: 800 Time Limit: 120 min IBM C IBM Cloud Platform Application Development C5050-285.exam Number: C5050-285 Passing Score: 800 Time Limit: 120 min IBM C5050-285 IBM Cloud Platform Application Development Exam A QUESTION 1 What are the two key benefits of Cloudant Sync? (Select

More information