SlideShare ist ein Scribd-Unternehmen logo
1 von 22
Downloaden Sie, um offline zu lesen
NoSQL
MongoDB and Redis as alternatives to
traditional RDBMS
Then...
...and now
*This thing weighs less than 50g
Meaning of NoSQL
1970 = We have no SQL
1980 = Know SQL
2000 = No SQL!
2005 = Not only SQL
2014 = No, SQL
(slide adapted from @markmadsen)
MongoDB
MongoDB
● it is the “new MySQL”
● Project started in 2007 by 10gen (now MongoDB Inc)
● Cross-platform, open-source
● 5th most used DBMS & most used Document Store*
(next DS CouchDB - 21st)
* According to db-engines.com as of Oct 2014
Characteristics
● “It's really a hybrid database with features from a few
different places.” (Gaetan Voyer-Perrault on Quora)
● Document Oriented but NO SCHEMA!
● Documents grouped in Collections
● Binary JSON (BSON) format
● Load Balancing (automated sharding, sharding key
can be user defined)
● Replication (Replica Sets)
● Automated failover
Characteristics - continued
● Primary and Secondary Indexes
● JavaScript for UDF
● MapReduce
● Capped Collections
● Aggregation Framework since 2.2
● Ad-hoc Query Support
Caveats
Generic performance tips
● Use 64-bit OS
● Lots of RAM, fast disks (was anyone expecting
something else?)
● ensure that at least indexes + working set fit in RAM
(db.stats(), db.<coll>.stats()) - if not, you might want to
try TokuMX
● Design for de-normalized data models
Generic performance tips
● Write-Concerns
● Shard early
● Fixed (or at least bounded) record size => better write
performance
● Use short attribute names (reduces index & data size,
OFC!)
● EXT4 or XFS
IRL
● virtualized server 8G RAM, 4 vCPU - no sharding, no
replica sets
● 100 inserts/s , 130M doc collection WITH secondary
index (avg doc size 0.6k)
● 20 inserts/s 3M doc collection WITH 18 secondary
indexes (avg doc size 10k)
Use Cases
● Logs
● Location Data (Mongo has built in Geospatial ops)
● Account and User Profiles
● Messaging
● (complex) Config Data
● http://www.mongodb.com/who-uses-mongodb (hint:
Expedia, Business Insider, The Weather Channel,
Foursquare, eBay)
Redis
Redis
● Salvatore Sanfilippo (@antirez)
● Started in 2009
● Key-Value Store
● 11th most used DBMS & most used KV Store* (next
KVS memcached - 19th)
● Sponsored by Pivotal (spinoff EMC/VMware)
* According to db-engines.com as of Oct 2014
Characteristics
● Holds all data in memory, persists on disk
● Data Models
○ Strings/Blobs/Bit-Maps (not really Bitmaps)
○ Hashtables
○ Linked Lists
○ Sets
○ Sorted Sets
● HyperLogLog (+2.8.9 - trade accuracy for memory)
● Master Slave Replication
● High Availability (through Sentinel)
Characteristics - continued
● Redis Cluster in works (not production ready yet) -
sharding
○ asynchronous replication
○ does not guarantee strong consistency (may ‘forget’ writes)
● AOF sync - default 2s
● Does not support secondary indexes
● Pub/Sub mode since 2.0
● Key expiry
● Server scripting with Lua
IRL
● virtualized server 4G RAM, 1vCPU
● +50k get/set per second (redis-benchmark)
● only 128 queries out of 1165550375 over 10ms
(0.00001%)
○ uptime_in_days:439
○ used_memory_human:424.09M
○ used_memory_peak_human:834.94M
○ total_connections_received:1352935
○ db0:keys=610884,expires=355397
Generic performance tips
● Use short key names (reduces data size, OFC!)
● You can create secondary indexes (but you have to
maintain them, e.g. using SET)
● You can have ad-hoc queries (actually is query) :
using SORT
Use Cases
● Cache
● IPSS/IPC
● Queue mechanisms (see e.g. Resque)
● Log/Task buffers
● Statistics and aggregation datastore
● (anywhere you use memcached)
● http://redis.io/topics/whos-using-redis (hint: Twitter,
GitHub, Snapchat, StackOverflow a.o.)
Recap
One size does NOT fit all!
Further reading
● Must read: http://blog.andreamostosi.name/big-
data/ (almost exhaustive list of all things NoSQL and
BigData)

Weitere ähnliche Inhalte

Was ist angesagt?

Clusters With Glusterfs
Clusters With GlusterfsClusters With Glusterfs
Clusters With Glusterfs
Ontico
 
Gotszling mogo db-membase
Gotszling mogo db-membaseGotszling mogo db-membase
Gotszling mogo db-membase
GiltTech
 
MongoDB Introduction - Document Oriented Nosql Database
MongoDB Introduction - Document Oriented Nosql DatabaseMongoDB Introduction - Document Oriented Nosql Database
MongoDB Introduction - Document Oriented Nosql Database
Sudhir Patil
 
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
IndicThreads
 
CouchDB Talk JChris NYC
CouchDB Talk JChris NYCCouchDB Talk JChris NYC
CouchDB Talk JChris NYC
Chris Anderson
 

Was ist angesagt? (20)

COSCUP 2019 - The discussion between Knex.js and PostgreSQL
COSCUP 2019 - The discussion between Knex.js and PostgreSQLCOSCUP 2019 - The discussion between Knex.js and PostgreSQL
COSCUP 2019 - The discussion between Knex.js and PostgreSQL
 
Clusters With Glusterfs
Clusters With GlusterfsClusters With Glusterfs
Clusters With Glusterfs
 
Gotszling mogo db-membase
Gotszling mogo db-membaseGotszling mogo db-membase
Gotszling mogo db-membase
 
Intro Couchdb
Intro CouchdbIntro Couchdb
Intro Couchdb
 
MongoDB Introduction - Document Oriented Nosql Database
MongoDB Introduction - Document Oriented Nosql DatabaseMongoDB Introduction - Document Oriented Nosql Database
MongoDB Introduction - Document Oriented Nosql Database
 
Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3Post-relational databases: What's wrong with web development? v3
Post-relational databases: What's wrong with web development? v3
 
Introduction to MongoDB (from Austin Code Camp)
Introduction to MongoDB (from Austin Code Camp)Introduction to MongoDB (from Austin Code Camp)
Introduction to MongoDB (from Austin Code Camp)
 
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...Putting rails and couch db on the cloud -  Indicthreads cloud computing confe...
Putting rails and couch db on the cloud - Indicthreads cloud computing confe...
 
Steam Learn: An introduction to Redis
Steam Learn: An introduction to RedisSteam Learn: An introduction to Redis
Steam Learn: An introduction to Redis
 
Кирилл Шутемов aka “kas” - О Transparent Hugepages и Huge zero page
Кирилл Шутемов aka “kas” - О Transparent Hugepages и Huge zero pageКирилл Шутемов aka “kas” - О Transparent Hugepages и Huge zero page
Кирилл Шутемов aka “kas” - О Transparent Hugepages и Huge zero page
 
110304 sha
110304 sha110304 sha
110304 sha
 
Doing E-commerce Right – Magento on DigitalOcean
Doing E-commerce Right – Magento on DigitalOceanDoing E-commerce Right – Magento on DigitalOcean
Doing E-commerce Right – Magento on DigitalOcean
 
Level 101 for Presto: What is PrestoDB?
Level 101 for Presto: What is PrestoDB?Level 101 for Presto: What is PrestoDB?
Level 101 for Presto: What is PrestoDB?
 
Redis IU
Redis IURedis IU
Redis IU
 
Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0Explore the Cosmos (DB) with .NET Core 2.0
Explore the Cosmos (DB) with .NET Core 2.0
 
Mysql to mongo
Mysql to mongoMysql to mongo
Mysql to mongo
 
CouchDB Talk JChris NYC
CouchDB Talk JChris NYCCouchDB Talk JChris NYC
CouchDB Talk JChris NYC
 
Introduction to new high performance storage engines in mongodb 3.0
Introduction to new high performance storage engines in mongodb 3.0Introduction to new high performance storage engines in mongodb 3.0
Introduction to new high performance storage engines in mongodb 3.0
 
AMIS OOW Review - Deel 6 - Emiel Paasschens
AMIS OOW Review - Deel 6 - Emiel PaasschensAMIS OOW Review - Deel 6 - Emiel Paasschens
AMIS OOW Review - Deel 6 - Emiel Paasschens
 
JS App Architecture
JS App ArchitectureJS App Architecture
JS App Architecture
 

Andere mochten auch

2015-OBDC-Organizational-Report
2015-OBDC-Organizational-Report2015-OBDC-Organizational-Report
2015-OBDC-Organizational-Report
Rachel Aoanan
 
society and Daily Life in Mogul India
society and Daily Life in Mogul Indiasociety and Daily Life in Mogul India
society and Daily Life in Mogul India
mariacardenas02
 
Grafico diario del dax perfomance index para el 10 02-2012
Grafico diario del dax perfomance index para el 10 02-2012Grafico diario del dax perfomance index para el 10 02-2012
Grafico diario del dax perfomance index para el 10 02-2012
Experiencia Trading
 
оценување на вештините на учениците за решавање проблеми
оценување на вештините на учениците за решавање проблемиоценување на вештините на учениците за решавање проблеми
оценување на вештините на учениците за решавање проблеми
Anica Petkoska
 

Andere mochten auch (20)

Brochure (1)
Brochure (1)Brochure (1)
Brochure (1)
 
lookbook 1
lookbook 1lookbook 1
lookbook 1
 
Give Dairy Farmers A Market
Give Dairy Farmers A MarketGive Dairy Farmers A Market
Give Dairy Farmers A Market
 
請敘述Cpu的執行過程或步驟
請敘述Cpu的執行過程或步驟請敘述Cpu的執行過程或步驟
請敘述Cpu的執行過程或步驟
 
lookbook 3
lookbook 3 lookbook 3
lookbook 3
 
2015-OBDC-Organizational-Report
2015-OBDC-Organizational-Report2015-OBDC-Organizational-Report
2015-OBDC-Organizational-Report
 
Game sense
Game senseGame sense
Game sense
 
Power poin programacion
Power poin programacionPower poin programacion
Power poin programacion
 
society and Daily Life in Mogul India
society and Daily Life in Mogul Indiasociety and Daily Life in Mogul India
society and Daily Life in Mogul India
 
Deconstructing Lambda architectures
Deconstructing Lambda architecturesDeconstructing Lambda architectures
Deconstructing Lambda architectures
 
Mashing the data
Mashing the dataMashing the data
Mashing the data
 
Presentation for the first Bucharest Big data meetup
Presentation for the first Bucharest Big data meetupPresentation for the first Bucharest Big data meetup
Presentation for the first Bucharest Big data meetup
 
Estudio de caso
Estudio de casoEstudio de caso
Estudio de caso
 
latihan un smp
latihan un smplatihan un smp
latihan un smp
 
Grafico diario del dax perfomance index para el 10 02-2012
Grafico diario del dax perfomance index para el 10 02-2012Grafico diario del dax perfomance index para el 10 02-2012
Grafico diario del dax perfomance index para el 10 02-2012
 
U.S. Navy Twitter Business Rules 2015
U.S. Navy Twitter Business Rules 2015U.S. Navy Twitter Business Rules 2015
U.S. Navy Twitter Business Rules 2015
 
Mi Escuela
Mi Escuela Mi Escuela
Mi Escuela
 
оценување на вештините на учениците за решавање проблеми
оценување на вештините на учениците за решавање проблемиоценување на вештините на учениците за решавање проблеми
оценување на вештините на учениците за решавање проблеми
 
Dreamforce 2015 - 4 days in 4 minutes
Dreamforce 2015 - 4 days in 4 minutesDreamforce 2015 - 4 days in 4 minutes
Dreamforce 2015 - 4 days in 4 minutes
 
Partes de la computadora sjb
Partes de la computadora sjbPartes de la computadora sjb
Partes de la computadora sjb
 

Ähnlich wie NoSQL solutions

Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dba
orablue11
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
Krivoy Rog IT Community
 

Ähnlich wie NoSQL solutions (20)

002 Database-Engines.pptx
002 Database-Engines.pptx002 Database-Engines.pptx
002 Database-Engines.pptx
 
Postgres-XC as a Key Value Store Compared To MongoDB
Postgres-XC as a Key Value Store Compared To MongoDBPostgres-XC as a Key Value Store Compared To MongoDB
Postgres-XC as a Key Value Store Compared To MongoDB
 
MongoDB 2.4 and spring data
MongoDB 2.4 and spring dataMongoDB 2.4 and spring data
MongoDB 2.4 and spring data
 
MongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL DatabaseMongoDB: Advantages of an Open Source NoSQL Database
MongoDB: Advantages of an Open Source NoSQL Database
 
No sql bigdata and postgresql
No sql bigdata and postgresqlNo sql bigdata and postgresql
No sql bigdata and postgresql
 
Scaling up and accelerating Drupal 8 with NoSQL
Scaling up and accelerating Drupal 8 with NoSQLScaling up and accelerating Drupal 8 with NoSQL
Scaling up and accelerating Drupal 8 with NoSQL
 
BlackRay - The open Source Data Engine
BlackRay - The open Source Data EngineBlackRay - The open Source Data Engine
BlackRay - The open Source Data Engine
 
No SQL Technologies
No SQL TechnologiesNo SQL Technologies
No SQL Technologies
 
Ukoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dbaUkoug 2011 mysql_arch_for_orcl_dba
Ukoug 2011 mysql_arch_for_orcl_dba
 
New paradigms
New paradigmsNew paradigms
New paradigms
 
MongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer GuideMongoDB NoSQL - Developer Guide
MongoDB NoSQL - Developer Guide
 
Mongo db
Mongo dbMongo db
Mongo db
 
Postgres-XC Write Scalable PostgreSQL Cluster
Postgres-XC Write Scalable PostgreSQL ClusterPostgres-XC Write Scalable PostgreSQL Cluster
Postgres-XC Write Scalable PostgreSQL Cluster
 
Mongodb (1)
Mongodb (1)Mongodb (1)
Mongodb (1)
 
Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009Blackray @ SAPO CodeBits 2009
Blackray @ SAPO CodeBits 2009
 
Next.js with drupal, the good parts
Next.js with drupal, the good partsNext.js with drupal, the good parts
Next.js with drupal, the good parts
 
Lean and mean MongoDB
Lean and mean MongoDBLean and mean MongoDB
Lean and mean MongoDB
 
kranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High loadkranonit S06E01 Игорь Цинько: High load
kranonit S06E01 Игорь Цинько: High load
 
Mongodb open data day 2014
Mongodb open data day 2014Mongodb open data day 2014
Mongodb open data day 2014
 
ArangoDB
ArangoDBArangoDB
ArangoDB
 

Mehr von Felix Crisan

Mehr von Felix Crisan (12)

Big data uservices
Big data uservicesBig data uservices
Big data uservices
 
Bitcoin:Next
Bitcoin:NextBitcoin:Next
Bitcoin:Next
 
BigData in BlockChains
BigData in BlockChainsBigData in BlockChains
BigData in BlockChains
 
Lightning Network
Lightning  NetworkLightning  Network
Lightning Network
 
Smart contracts using web3.js
Smart contracts using web3.jsSmart contracts using web3.js
Smart contracts using web3.js
 
Smart contracts in Solidity
Smart contracts in SoliditySmart contracts in Solidity
Smart contracts in Solidity
 
Big(data) in block(chains)
Big(data) in block(chains)Big(data) in block(chains)
Big(data) in block(chains)
 
Enablers for o commerce
Enablers for o commerceEnablers for o commerce
Enablers for o commerce
 
mcommad
mcommadmcommad
mcommad
 
402 @ Mobile next
402 @ Mobile next402 @ Mobile next
402 @ Mobile next
 
Data analysis with Pandas and Spark
Data analysis with Pandas and SparkData analysis with Pandas and Spark
Data analysis with Pandas and Spark
 
TCP/IP of money
TCP/IP of moneyTCP/IP of money
TCP/IP of money
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 

Kürzlich hochgeladen (20)

Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Developing An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of BrazilDeveloping An App To Navigate The Roads of Brazil
Developing An App To Navigate The Roads of Brazil
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Tech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdfTech Trends Report 2024 Future Today Institute.pdf
Tech Trends Report 2024 Future Today Institute.pdf
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 

NoSQL solutions

  • 1. NoSQL MongoDB and Redis as alternatives to traditional RDBMS
  • 3. ...and now *This thing weighs less than 50g
  • 4. Meaning of NoSQL 1970 = We have no SQL 1980 = Know SQL 2000 = No SQL! 2005 = Not only SQL 2014 = No, SQL (slide adapted from @markmadsen)
  • 6. MongoDB ● it is the “new MySQL” ● Project started in 2007 by 10gen (now MongoDB Inc) ● Cross-platform, open-source ● 5th most used DBMS & most used Document Store* (next DS CouchDB - 21st) * According to db-engines.com as of Oct 2014
  • 7. Characteristics ● “It's really a hybrid database with features from a few different places.” (Gaetan Voyer-Perrault on Quora) ● Document Oriented but NO SCHEMA! ● Documents grouped in Collections ● Binary JSON (BSON) format ● Load Balancing (automated sharding, sharding key can be user defined) ● Replication (Replica Sets) ● Automated failover
  • 8. Characteristics - continued ● Primary and Secondary Indexes ● JavaScript for UDF ● MapReduce ● Capped Collections ● Aggregation Framework since 2.2 ● Ad-hoc Query Support
  • 10. Generic performance tips ● Use 64-bit OS ● Lots of RAM, fast disks (was anyone expecting something else?) ● ensure that at least indexes + working set fit in RAM (db.stats(), db.<coll>.stats()) - if not, you might want to try TokuMX ● Design for de-normalized data models
  • 11. Generic performance tips ● Write-Concerns ● Shard early ● Fixed (or at least bounded) record size => better write performance ● Use short attribute names (reduces index & data size, OFC!) ● EXT4 or XFS
  • 12. IRL ● virtualized server 8G RAM, 4 vCPU - no sharding, no replica sets ● 100 inserts/s , 130M doc collection WITH secondary index (avg doc size 0.6k) ● 20 inserts/s 3M doc collection WITH 18 secondary indexes (avg doc size 10k)
  • 13. Use Cases ● Logs ● Location Data (Mongo has built in Geospatial ops) ● Account and User Profiles ● Messaging ● (complex) Config Data ● http://www.mongodb.com/who-uses-mongodb (hint: Expedia, Business Insider, The Weather Channel, Foursquare, eBay)
  • 14. Redis
  • 15. Redis ● Salvatore Sanfilippo (@antirez) ● Started in 2009 ● Key-Value Store ● 11th most used DBMS & most used KV Store* (next KVS memcached - 19th) ● Sponsored by Pivotal (spinoff EMC/VMware) * According to db-engines.com as of Oct 2014
  • 16. Characteristics ● Holds all data in memory, persists on disk ● Data Models ○ Strings/Blobs/Bit-Maps (not really Bitmaps) ○ Hashtables ○ Linked Lists ○ Sets ○ Sorted Sets ● HyperLogLog (+2.8.9 - trade accuracy for memory) ● Master Slave Replication ● High Availability (through Sentinel)
  • 17. Characteristics - continued ● Redis Cluster in works (not production ready yet) - sharding ○ asynchronous replication ○ does not guarantee strong consistency (may ‘forget’ writes) ● AOF sync - default 2s ● Does not support secondary indexes ● Pub/Sub mode since 2.0 ● Key expiry ● Server scripting with Lua
  • 18. IRL ● virtualized server 4G RAM, 1vCPU ● +50k get/set per second (redis-benchmark) ● only 128 queries out of 1165550375 over 10ms (0.00001%) ○ uptime_in_days:439 ○ used_memory_human:424.09M ○ used_memory_peak_human:834.94M ○ total_connections_received:1352935 ○ db0:keys=610884,expires=355397
  • 19. Generic performance tips ● Use short key names (reduces data size, OFC!) ● You can create secondary indexes (but you have to maintain them, e.g. using SET) ● You can have ad-hoc queries (actually is query) : using SORT
  • 20. Use Cases ● Cache ● IPSS/IPC ● Queue mechanisms (see e.g. Resque) ● Log/Task buffers ● Statistics and aggregation datastore ● (anywhere you use memcached) ● http://redis.io/topics/whos-using-redis (hint: Twitter, GitHub, Snapchat, StackOverflow a.o.)
  • 21. Recap One size does NOT fit all!
  • 22. Further reading ● Must read: http://blog.andreamostosi.name/big- data/ (almost exhaustive list of all things NoSQL and BigData)