Choosing the Right CBSE School A Comprehensive Guide for Parents
Mongodb beijingconf yottaa_3.3
1. MongoDB In Production: YottaaPractice XiangJun Wu System Engineer xwu@yottaa.com Yottaa Inc. 2 Canal Park 5th Floor Cambridge MA 02141 http://www.yottaa.com
28. 100% in the cloud: EC2, voxel, linode, rackspaceand so forth cloud provider7
29. Sharding! High Concurrency Scale-Out App Server Passenger Collection Nginx Mongos Reporting Easy as Rails! MongoD Data Source MongoD Load Balancer User MongoD 8
30.
31. Web metrics - store DNS lookup, http connection, firebug etc. Web metrics data with different scales: daily, monthly. The purpose is to speed up data report from frontend. Raw data for query in the detailed.
37. All log information - use logstash (http://code.google.com/p/logstash/) to feed and store log for different components inMongoDB. Search log via Rails. Plan to applySinatra interface for both log feed and query. 10
40. URL Location Connect First Byte Last Byte Timestamp Thinking in rows What was the average connect time for google on friday? From Beijing? From Shanghai? Between 1AM-2AM? 13
41. Up to 100’s of samples per URL per day!! URL Location Connect First Byte Last Byte Timestamp An “average” chart had to hit 3000 rows 30 days average query range Thinking in rows Day 1 AVG Result Day 2 AVG Day 3 AVG 14
42. URL www.google.com Last Byte Sum 2312 SFO Sum 1200 Sum 1112 Thinking in Documents This document contains all data for www.google.com collected during 9/20/2010 This tells us the average value for this metric for this url / time period Average value from Beijing Average value from Shanghai 15
43. URL Day <data> More efficient charts 1 Document per URL per Day Day 1 AVG Result Day 2 Average chart hits 30 documents. AVG 100x fewer Day 3 AVG 30 days == 30 documents 16
44. Which document we’re updating Atomically update the document Update the aggregate value Update the location specific value Create the document if it doesn’t already exist Storing a sample db.metrics.dailies.update( { url: ‘www.google.com’, day: new Date(2010,9,2)}, { ‘$inc’: { ‘connect.sum’:1234, ‘connect.count’:1, ‘connect.bj.sum’:1234, ‘connect.bj.count’:1 } }, true // upsert ); 17
45. Putting it together Atomically update the daily data 1 { url: ‘www.google.com’, location: “Beijing” connect: 23, first_byte: 123, last_byte: 245, timestamp: 1234 } Atomically update the weekly data 2 Atomically update the monthly data 3 18