Presentation at WICSA 2012 Industry day.
Architecture withNoSQLExperiences of a SaaS startupVille Lautanala
View Slide
•Single page JavaScript front-end•Thousands of concurrent users•Three replicated databases•X servers on two continents•99.98% availabilityFacts
StreamingAPIMongoDBRedis+ IRC, Twitter, RSS, and EmailintegrationsWebSocketAPIMessage BackendPostgreSQLRails App
MongoDB• Document-oriented• JSON based queries• Scalable reads andwrites• Replication andfailover built-in• No transactions, noJOINs
SSD == Awesome
Chef
Manage serverswith code1. Edit recipes2. knife upload3. ???4. Profit!!!
Redis: in-memory DB•Key-value store•Data-structure server•Network accessible shared memory•Non-blocking event-bus (pub/sub)
Flowdock messageprocessingRedis QueueRedisPubsubMongoDBFlowdock Backend
Redis is SPoF
ZooKeeper
ZooKeeper?•Highly-available key-value store•Enables distributed coordination•Listen for value changes•Eventual consistency with quorumsemantics
Node ManagerNode ManagerRedis NodeRedis NodeZooKeeperMonitorUpdateRedis Failover
Zoos are kept.
Chef ZooKeeperConfiguration filesDynamic configurationvariablesServer installation Failover handlingChef vs ZooKeeper
Network failFlowdockComcastProblems
Taking control ofthe routes1. Submarine communications cable2. 3rd party CDN/Load Balancers3. AWS as SSL endpoint
This Is How WeRoll•GeoDNS chooses endpoint•Encrypted VPN mesh betweenservers•Servers near client act as SSLendpoint•Request processed near data
150ms faster pagerequests from U.S.
Conclusions•MongoDB a bit like MySQL 15 yearsago•Some NoSQL databases aresuitable for distributed setups•Hardware and network issuesneeds to be addressed
Thanks!