background preloader

MongoDB

Facebook Twitter

MongoDB strategies for the disk-averse. Feb 09th Behind the scenes at foursquare, we have a lot of data collection efforts that present interesting scaling puzzles. One is the venue metrics system, which allows business owners to get information about checkins to their venue over time. It lets them see the effect of specials, understand their clientele’s demographics, and even identify their most loyal customers. To store this data, we need to handle tens of writes per second across millions of venues, interleaved with infrequent reads of the last 90 days of data for a given venue. Ideally, reads would return within a second or two. This isn’t inherently hard, but we really want to minimize the resources dedicated to this small corner of our system. We’re fans of MongoDB, and one natural way to store this information would be to have one document for every active (venue, hour) pair which contains various counters (men, women, etc.). If we hold all of the data live in RAM, this is no big deal.

Locality, locality, locality. MongoDB vs Mysql. A devops point of view. Java + MongoDB hello world example. A simple Java + MongoDB hello world example – how to connect, create database, collection and document, save, update, remove, get and display document (data). Tools and technologies used : MongoDB 2.2.3MongoDB-Java-Driver 2.10.1JDK 1.6Maven 3.0.3Eclipse 4.2 P.S Maven and Eclipse are both optional, just my personal favorite development tool. 1.

Create a Java Project Create a simple Java project with Maven. mvn archetype:generate -DgroupId=com.mkyong.core -DartifactId=mongodb -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false 2. Download mongo-java driver from github. Pom.xml <project ... 3. Connect to MongoDB server. // Old version, uses Mongo Mongo mongo = new Mongo("localhost", 27017); // Since 2.10.0, uses MongoClient MongoClient mongo = new MongoClient( "localhost" , 27017 ); If MongoDB in secure mode, authentication is required. 4. Get database. DB db = mongo.getDB("database name"); Display all databases. 5. Get collection / table. 6. 7. 8. 9. 10. App.java Output… References. Amazon EC2 and MongoDB configuration for great performance. Sometimes, we prefer using Amazon EC2 directly for our Rails stack.

No offense to Heroku but we need a more controlled environment; and no offense to EngineYard as they don’t support MongoDB on their environment as yet. We were faced with several problems that we wanted to solve Control our environment without MongoDB hogging all the memory.Choose the right instanceChoose the right fileSystem for the optimal performance. Choice of EC2 instance is always an interesting one – when you have to shell out the money from your pocket, you neither want to overspend nor underutilize the instance.

We found that using an m1.medium instance (4 GB ram) gave us enough lee-way to manage our MongoDB instances. Over the course of changing instances, tuning them up for performance, we realized these important pointers: MongoDB runs well on ext4 systems and really badly on ext3 When we attached an EBS to the instance, you need to format the filesystem. Freeing page caches # echo 1 > /proc/sys/vm/drop_caches. Mongodb 특징 분석. Understanding MongoDB Storage - PolySpot Blog. Posted on July 4, 2012 by Arnaud BAILLY How MongoDB stores its Data This article tries to explain the intricacies of MongoDB storage and how it affects performances of the database. It was sparked by questions which people who were more familiar with “traditional” databases asked, and more specifically questions regarding the memory consumption of mongod and its impact on other processes running in the same host.

It is rather linux-centric. The following figure tries to present how the various components of a MongoDB node (Disks, File System, RAM) interact to provide access to the database. Note that this scheme is not specific to so-called NOSQL databases and actually is rather a general depiction of how databases interact with the operating system to provide data. Memory-mapped Files MongoDB stores its data into files called extents with a standard size of 2GB (actually, the process is a little bit more complex). Running htop and filtering on mongod yields the following picture: References. An Articulate Introduction to MongoDB. NOSQL has become a very heated topic for large web-scale deployment where scalability and semi-structured data driven the DB requirement towards NOSQL.

There has been many NOSQL products evolving in over last couple years. In my past blogs, I have been covering the underlying distributed system theory of NOSQL, as well as some specific products such as CouchDB and Cassandra/HBase. Last Friday I was very lucky to meet with Jared Rosoff from 10gen in a technical conference and have a discussion about the technical architecture of MongoDb. I found the information is very useful and want to share with more people. One thing I am very impressed by MongoDb is that it is extremely easy to use and the underlying architecture is also very easy to understand. Here are some simple admin steps to start/stop MongoDb server 02.mkdir /data/lib 05.... 08.... Major difference from RDBMSMongoDb differs from RDBMS in the following way Query processingMongoDb belongs to the type of document-oriented DB. 09. true)

A Year with MongoDB - Engineering at Kiip. This week marks the one year anniversary of Kiip running MongoDB in production. As of this week, we’ve also moved over 95% of our data off of MongoDB onto systems such as Riak and PostgreSQL, depending which solution made sense for the way we use our data. This post highlights our experience with MongoDB over the past year. A future post will elaborate on the migration process: how we evaluated the proper solutions to migrate to and how we migrated the data from MongoDB.

First, some numbers about our data to give context to the scale being discussed. The figures below represent the peak usage when we were completely on MongoDB — the numbers are actually much higher now but are spread across different data stores. Data size: 240 GBTotal documents: 85,000,000Operations per second: 520 (Create, reads, updates, etc.) The Good We were initially attracted to MongoDB due to the features highlighted on the website as well as word of mouth from those who had used it successfully. The Bad.