SlideShare a Scribd company logo
PYTHON AND
RIAK DB
A PERFECT COUPLE FOR HUGE
SCALE DISTRIBUTED COMPUTING
twitter
Github
@Narenarya3
@narenaryan
CORRECT WITH GRAMMARLY IGNORE
WHAT RIAK CAN DO?
Riak is a database that helps any business by supporting these
4 features
1. 100% uptime
2. Infinite scale*
3. Fault recovery
4. Low latency
WHY CARE FAULT
TOLERANCE?
Companies rely on data to power their day-today
operations. Even minutes of application downtime can
mean lost sales, a poor user experience, and a bruised
brand.This can add up to millions in lost revenue
NEVER LOSE A
CUSTOMER IN T
BUSINESS DUE T
LATENCY
WHAT EXACTLY RIAK IS?
Different than traditional relational databases and other
“NoSQL” (non-relational) databases, Riak offers benefits of
enormous availability, replication and monitoring – all in a
highly distributed deployment
Built on Erlang for rock solid stability
Open source implementation of Dynamo paper by
Amazon
NO 2:00AM EMERGENCY
CALLS FOR AN ENGINEER
DISTRIBUTED
DATABASES
Data distrbution is achieved through two things.
Replication
Partition
Replication
Partition
CAP THEOROM
Brewer's CAP Theorom states that CAP loosely states that
you can have a C (consistent), A (available), or P (partition-
tolerant) system, but you can only choose any 2 of them at a
particular time.
Consistency + Partition Tolerance
or
Availability + Partition Tolerance
Riak’s solution is based on Amazon Dynamo’s novel
approach of a tunable AP system. Riak has a two knob
theory which sets both levels of availlability and
consistency.
RIAK'S TUNABLE CAP
PARAMETERS
Level of Availability
Level of Consistency
RIAK N-R-W STRATEGY
1. N - No of nodes to replicate data
2. R - No of nodes to be read to confirm a successful read
3. W - No of nodes to write to confirm a successful write
N-R-W
RIAK'S CONSISTENT
HASHING STRATEGY
OPERATIONAL
SIMPLICITY
# Add a node to existing cluster
$ riak­admin cluster join riak@127.0.0.1
# Remove a node from existing cluster
$ riak­admin cluster leave NODE
# Replaces a failed node with new one in cluster
$ riak­admin cluster replace NODE_1 NODE_2
# Shows the changes we made to cluster
$ riak­admin cluster plan
# Only modifies cluster state after commiting
$ riak­admin cluster replace NODE_1 NODE_2
#Check ring status
$ riak­admin cluster status
DO YOU KNOW, RIAK IS
BASE
Basically Available
Soft-state
Eventually consistent
Durable
WHY PYTHON?
FUN | POWER | LOVE | ZILLION
REASONS
I LOVE PYTHON
because of it's
1. Expressive power
2. Simplicity
3. Multi domain expertise
4. Mammoth library base
more than that....
Python is in first three clients Riak 1.0 supported.
DOES RIAK HAS A
PYTHON CLIENT
Yes, Riak has six official clients for Major programming
languages.
RIAK FOR IMPATIENT
import riak
client = riak.RiakClient()
bucket = client.bucket('developers')
person = bucket.new('python_developer_1', data={
    'name': 'Naren',
    'age': 22,
    'company': 'Mr. Startup!',
})
person.store()
4 SIMPLE METHODS TO
START
1. RiakClient
2. bucket
3. new
4. store
BASIC PYTHON CLIENT
METHODS
RiakClient - creates a client connnection to Database
bucket - Creates a bucket if not exists, else uses it
new - creates a new key-value data pair
store - Stores key-value pair in database
TWO MORE METHODS TO
COMPLETE SIMPLICITY
get - Fetches a bucket data row using key
get_data - Fetches value associated for that key
SEE HOW CODE WORKS
import riak
client = riak.RiakClient()
bucket = client.bucket('developers')
naren = user_bucket.get('python_developer_1')
naren_dict = naren.get_data()
RIAK CLIENT VARIATIONS
RiakClient()
RiakClient(protocol='http', host='127.0.0.1', http_port=8098)
RiakClient(nodes=[{'host':'127.0.0.1','http_port':8098}])
Nodes are the remote systems or virtual containers running
Riak Servers . When your data size is increasing grow your
data horizontally by allocating more nodes to cluster
RIAK SEARCH
Riak Search 2.0 is an integration of Solr (for indexing and
querying) and Riak (for storage and distribution).It has
search capability on distributed riak servers
results = client.fulltext_search('famous', 'name_s:Lion*')
print results
print results['docs']
RIAK MAP REDUCE
ARCHITECTURE
Riak has a very good support for map-reducing of big data
WHAT WE ARE GAINING
The advantages of using Riak and Python are:
Fast and easy setup
Developer friendly stack
Less operational cost
Horizontal scaling on demand
Rock solid consistency
Now Flask and Django projects can scale on huge data
WHERE YOU SHOULD
NOT USE RIAK?
You should not use Riak
If you have average sized data needs.
If you are nostalgic about SQL and queries
IF YOU DON'T HAVE ANY
PROBLEM NOW
WHERE YOU SHOULD USE
RIAK?
MUCH MORE
Riak Book
Riak DB
Client libraries
Python and RiakDB
THANK YOU
NARENARYA@LIVE.COM
-
-
-
@Narenarya3
Source code for this slides
Website

More Related Content

PDF
Keynote: Customer Journey with Streaming Data on AWS - Rahul Pathak, AWS
PDF
PuppetConf 2016: Automating Datastore Fleets with Puppet – Joseph Lynch, Yelp
PDF
Mesh-ing around with Streams across the Enterprise | Phil Scanlon, Solace
PDF
Continus sql with sql stream builder
PDF
The New Tech Stack for Device Data
PDF
Arcavias at TYPO3 camp Venlo
PDF
Building Robust Production Data Pipelines with Databricks Delta
PPTX
Building A Self Service Streaming Platform at Pinterest - Steven Bairos-Novak...
Keynote: Customer Journey with Streaming Data on AWS - Rahul Pathak, AWS
PuppetConf 2016: Automating Datastore Fleets with Puppet – Joseph Lynch, Yelp
Mesh-ing around with Streams across the Enterprise | Phil Scanlon, Solace
Continus sql with sql stream builder
The New Tech Stack for Device Data
Arcavias at TYPO3 camp Venlo
Building Robust Production Data Pipelines with Databricks Delta
Building A Self Service Streaming Platform at Pinterest - Steven Bairos-Novak...

What's hot (14)

PDF
Qlik and Confluent Success Stories with Kafka - How Generali and Skechers Kee...
PDF
Nine Publishing: Building a modern infrastructure with the Elastic Stack
PDF
Prepare to Recover: Fully Protect Your Salesforce Data
PDF
How to design and implement a data ops architecture with sdc and gcp
PDF
Presto: Fast SQL-on-Anything (including Delta Lake, Snowflake, Elasticsearch ...
PDF
Data Driven Decisions at Scale
PDF
Build and Run Streaming Applications with Apache Flink and Amazon Kinesis Dat...
PPTX
KNIME Meetup 2016-04-16
PPTX
Apache frameworks for Big and Fast Data
PPTX
InleData Webinar: Empowering Businesses with Delta Lake
PPTX
Choosing the Right Open Source Database
PDF
Modern data integration expert sessions
PDF
Building a Streaming Microservices Architecture - Data + AI Summit EU 2020
PDF
Journey to the Modern App with Containers, Microservices and Big Data
Qlik and Confluent Success Stories with Kafka - How Generali and Skechers Kee...
Nine Publishing: Building a modern infrastructure with the Elastic Stack
Prepare to Recover: Fully Protect Your Salesforce Data
How to design and implement a data ops architecture with sdc and gcp
Presto: Fast SQL-on-Anything (including Delta Lake, Snowflake, Elasticsearch ...
Data Driven Decisions at Scale
Build and Run Streaming Applications with Apache Flink and Amazon Kinesis Dat...
KNIME Meetup 2016-04-16
Apache frameworks for Big and Fast Data
InleData Webinar: Empowering Businesses with Delta Lake
Choosing the Right Open Source Database
Modern data integration expert sessions
Building a Streaming Microservices Architecture - Data + AI Summit EU 2020
Journey to the Modern App with Containers, Microservices and Big Data
Ad

Viewers also liked (16)

PDF
Letter of recommendation
PPTX
Egal Plus
DOC
Formatoasesoria
DOC
Informe 603
PPT
Présentation vd colloque com verte 26 mai
PPT
Taller de Consumer Insights In Company - Entrenamiento Empresarial
PDF
Italian retail market: strategies and trends (english)
DOCX
Grade 8 (M2) Science Vocabulary Studyguide for 2nd sem
PDF
Esempio di rubrica valutativa [184957]
DOC
đồ áN btct 2 tính toán và thiết kế kết cấu khung phẳng
PPTX
A2 Media Studies Pitch
PPTX
A2 Media Studies Evaluation
PPTX
Condylar #
PPTX
Ttip 2 bach en contra
PPT
Percorso logico matematico
PPT
Natura 2000
Letter of recommendation
Egal Plus
Formatoasesoria
Informe 603
Présentation vd colloque com verte 26 mai
Taller de Consumer Insights In Company - Entrenamiento Empresarial
Italian retail market: strategies and trends (english)
Grade 8 (M2) Science Vocabulary Studyguide for 2nd sem
Esempio di rubrica valutativa [184957]
đồ áN btct 2 tính toán và thiết kế kết cấu khung phẳng
A2 Media Studies Pitch
A2 Media Studies Evaluation
Condylar #
Ttip 2 bach en contra
Percorso logico matematico
Natura 2000
Ad

Similar to Python and riak a perfect couple for building (20)

PPTX
Bathcamp 2010-riak
PDF
Introduction to Riak - Joel Jacobson
KEY
How does Riak compare to Cassandra? [Cassandra London User Group July 2011]
PDF
Getting Started with Riak - NoSQL Live 2010 - Boston
KEY
Introduction to Riak - Red Dirt Ruby Conf Training
PPTX
Coding with Riak (from Velocity 2015)
KEY
Riak seattle-meetup-august
PDF
Relational Databases to Riak
PDF
Riak from Small to Large
PDF
Migrating to Riak at Shareaholic
PDF
Riak at shareaholic
PDF
Riak - From Small to Large - StrangeLoop
PDF
Riak - From Small to Large
PDF
Os riak1-pdf
PDF
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
PDF
Scalable Persistent Storage for Erlang: Theory and Practice
PDF
PUT Knowledge BUCKET Brain KEY Riak
PPTX
Basho pres
PPT
Rolling With Riak
PDF
Riak at The NYC Cloud Computing Meetup Group
Bathcamp 2010-riak
Introduction to Riak - Joel Jacobson
How does Riak compare to Cassandra? [Cassandra London User Group July 2011]
Getting Started with Riak - NoSQL Live 2010 - Boston
Introduction to Riak - Red Dirt Ruby Conf Training
Coding with Riak (from Velocity 2015)
Riak seattle-meetup-august
Relational Databases to Riak
Riak from Small to Large
Migrating to Riak at Shareaholic
Riak at shareaholic
Riak - From Small to Large - StrangeLoop
Riak - From Small to Large
Os riak1-pdf
Distributed Search in Riak - Integrating Search in a NoSQL Database: Presente...
Scalable Persistent Storage for Erlang: Theory and Practice
PUT Knowledge BUCKET Brain KEY Riak
Basho pres
Rolling With Riak
Riak at The NYC Cloud Computing Meetup Group

More from Naren Arya (6)

PDF
Intermediate college sanction Norms
PPTX
Go to gRPC
PPTX
Boosting python web apps with protocol buffers & grpc
PDF
Building Next generation progressive web apps with Isomorphic JavaScript
PDF
Scaling Django to the sky
PDF
Julia for R programmers
Intermediate college sanction Norms
Go to gRPC
Boosting python web apps with protocol buffers & grpc
Building Next generation progressive web apps with Isomorphic JavaScript
Scaling Django to the sky
Julia for R programmers

Recently uploaded (20)

PPTX
SET 1 Compulsory MNH machine learning intro
PPTX
IMPACT OF LANDSLIDE.....................
PDF
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
PPTX
New ISO 27001_2022 standard and the changes
PPT
statistic analysis for study - data collection
PDF
Microsoft 365 products and services descrption
PPTX
CYBER SECURITY the Next Warefare Tactics
PPTX
Topic 5 Presentation 5 Lesson 5 Corporate Fin
PPTX
chrmotography.pptx food anaylysis techni
PPTX
Business_Capability_Map_Collection__pptx
PPTX
modul_python (1).pptx for professional and student
PDF
Transcultural that can help you someday.
PPTX
Pilar Kemerdekaan dan Identi Bangsa.pptx
PDF
Introduction to the R Programming Language
PDF
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
PDF
Global Data and Analytics Market Outlook Report
PPT
lectureusjsjdhdsjjshdshshddhdhddhhd1.ppt
PPTX
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx
PDF
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
PPTX
STERILIZATION AND DISINFECTION-1.ppthhhbx
SET 1 Compulsory MNH machine learning intro
IMPACT OF LANDSLIDE.....................
Data Engineering Interview Questions & Answers Cloud Data Stacks (AWS, Azure,...
New ISO 27001_2022 standard and the changes
statistic analysis for study - data collection
Microsoft 365 products and services descrption
CYBER SECURITY the Next Warefare Tactics
Topic 5 Presentation 5 Lesson 5 Corporate Fin
chrmotography.pptx food anaylysis techni
Business_Capability_Map_Collection__pptx
modul_python (1).pptx for professional and student
Transcultural that can help you someday.
Pilar Kemerdekaan dan Identi Bangsa.pptx
Introduction to the R Programming Language
Jean-Georges Perrin - Spark in Action, Second Edition (2020, Manning Publicat...
Global Data and Analytics Market Outlook Report
lectureusjsjdhdsjjshdshshddhdhddhhd1.ppt
sac 451hinhgsgshssjsjsjheegdggeegegdggddgeg.pptx
Systems Analysis and Design, 12th Edition by Scott Tilley Test Bank.pdf
STERILIZATION AND DISINFECTION-1.ppthhhbx

Python and riak a perfect couple for building