scalarium and couchdb
DESCRIPTION
How and why Scalarium is using CouchDB to control and manage thousands of machines on Amazon EC2TRANSCRIPT
![Page 1: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/1.jpg)
Scalarium and CouchDB
Jonathan Weiss @jweiss
@scalarium
Peritor GmbH
![Page 2: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/2.jpg)
Scalarium.com
EC2 Cluster Management Automatic & dynamic configuration over lifetime
of a cluster via Chef runs
Self healing clusters
Auto scaling clusters
One click deployment
One click cluster cloning
Monitoring & alerting
Logs & accounting
Firewalls & backups
Access & rights management
2
![Page 3: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/3.jpg)
Use case wooga.com
One of wooga’s Facebook games 1.5 million DAU (Daily Active Users)
~ 130 servers
~ 150.000 requests per minute on average
Complex stack with different databases and replication
Multiple deployments of the game on multiple clusters
3
![Page 4: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/4.jpg)
Scalarium.com
4 http://www.flickr.com/photos/av8pix/3391322123/
![Page 5: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/5.jpg)
Data
Rather static but important Cluster configuration
Server descriptions and current state
Lifecycle events: setup, deploy, configure, shutdown
Applications and deployment definitions
EC2 assets like EBS, elastic IPs, SSH keys
5
Dynamic and non-critical Accounting & events
Monitoring and metering
![Page 6: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/6.jpg)
Data
Rather static but important
6
Dynamic and non-critical
![Page 7: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/7.jpg)
Why CouchDB?
High Availability
Easy Replication
Clustering
Robustness
Short Recovery Time
Jan Lehnardt
7
![Page 8: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/8.jpg)
Architecture
8
![Page 9: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/9.jpg)
Architecture
9
![Page 10: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/10.jpg)
Interaction
10
![Page 11: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/11.jpg)
SimplyStored
Ruby library with ActiveRecord inspired capabilities Models
Associations Generates map & reduce
Validations
Callbacks
Dynamic finders
S3 attachments
Paranoid delete
http://github.com/peritor/simply_stored
11
![Page 12: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/12.jpg)
SimplyStored
12
![Page 13: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/13.jpg)
SimplyStored
13
![Page 14: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/14.jpg)
Conflict & Resolution
14
![Page 15: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/15.jpg)
Conflict & Resolution
Re-load and retry: Automatically done by SimplyStored
Discard and report: Internal report
15
![Page 16: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/16.jpg)
RockingChair
In-memory CouchDB as a Ruby library Just a big Hash
Understands views generated by SimplyStored
Speeds up your tests
Tests can run in parallel
Nice for debugging
http://github.com/jweiss/rocking_chair
16
![Page 17: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/17.jpg)
Operations
17
![Page 18: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/18.jpg)
Backup
Slaves in different EC2 availability zones and regions
Offsite copy of data and index files
18
![Page 19: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/19.jpg)
Hot Standby
19
![Page 20: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/20.jpg)
Cold Standby
20 http://www.flickr.com/photos/dnkemontoh/2680822579
![Page 21: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/21.jpg)
Keeping views fresh
Cronjobs for crawling all design docs and calling all views
On master & standby!
Rollout new views without using them first
And while we are there, compact views&dbs
21
![Page 22: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/22.jpg)
Performance
22
![Page 23: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/23.jpg)
I/O
CouchDB heavily depends on file system I/O EBS RAIDs for better performance
Different volumes for data and indices
Be generous with RAM & CPU
23 http://www.flickr.com/photos/walkn/5471945439
![Page 24: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/24.jpg)
include_docs
Nice feature to load related data in one go…but slow random I/O on read
Emit the data you need to the view index
24
![Page 25: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/25.jpg)
Design Documents
Maintained in a framework/model-layer
Using md5 of content to decide if update needed
Whenever one view definition changed, all views got recomputed
25
![Page 26: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/26.jpg)
Design Documents
Separate design document per view
Fine granular control Update
Delete
Compact
26
![Page 27: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/27.jpg)
One DB to rule them all
27
![Page 28: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/28.jpg)
Separate DBs
28
![Page 29: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/29.jpg)
Wishlist
Build-in caching
include_docs to load from index
Improved performance of building views
Build-in solution for
automatic sharding
Automatic compaction
Metrics & monitoring
29
![Page 30: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/30.jpg)
Couchbase 2.0
30
![Page 31: Scalarium and CouchDB](https://reader034.vdocuments.site/reader034/viewer/2022051611/54b75fa64a7959f9168b4686/html5/thumbnails/31.jpg)
Q&A
Talk to us if you want to use Scalarium 3 month for free
@scalarium
31