Friday, May 25, 2012

MongoDB pain points

Recently I was contacted by 10gen's account manager soliciting a feedback on our use of MongoDB at the company I'm working at. I wrote a lengthy reply on what we do with MongoDB and the problems we see with it and never heard back. It was a shame to all these feedback to go to waste so I decided to repost it with minor edits in my blog. So here it comes ...

We are using MongoDB at IPONWEB for quite long time - for ~2 years already for a number of high loaded projects. Our company specializes at creating products for display advertising and mostly we are using MongoDB to keep track of user data in our adservers. The main reason we are using MongoDB is raw performance. We are using MongoDB mostly as dumb NoSQL key-value database where we try to keep data fully cached in RAM. With rare exceptions we are not using any fancy features like complex queries, map-reduce and so on but rather limit ourselves to queries by a primary key. We do use sharding because as I mentioned above we have to put whole database to RAM so we often have to split database across multiple servers. Generally we are very price sensitive about costs of the installation so we are always looking at reducing hardware costs for our databases. Giving this background the following limitations in MongoDB implementation cause us the most grief:

a) lack of online database defragmentation in MongoDB. Currently the only way to compact MongoDB database is to stop the database and run compact or repair. On our datasets this process runs for considerable time. We do have to defragment  database pretty often to keep RAM usage under control. Fragmented vs non-fragmented database can be easily be two times bigger what in our case means two time higher hardware costs.

b) realistically for our use case we can do MongoDB resharding only offline. Adserving is extremely sensitive to any latencies and if we add more shards to existing cluster we more or less forced to take the application offline until resharding finishes.

c) lack of good support of SSD. The way MongoDB works now switching from using more RAM with HDD as backing storage in favor of using less RAM with SSD backing storage doesn't seem to be cost effective. SSD if priced per 1GB is roughly two times cheaper then RAM but if we place our data on SSD we have to reserve at least two more time space on SSD if we want to be able to run repair on the data (this is because running repair requires two times more space). Other reason we considered using SSD as backing storage instead of HDD is write performance in some applications where it was a limitation. But from our limited benchmarking we found small performance difference because it looks like single thread write lock in MongoDB becomes a bottleneck rather then underlying storage.

d) minor point: underlying networking protocol could be more efficient with some optimizations. If you send many small queries and get small documents as result MongoDB creates separate TCP packets for each request/response. Under high load especially in case of virtualized hardware (i.e. EC2) this introduces additional high overhead. We have our own client driver which tries to pack multiple requests in single TCP packets and it makes noticeable difference in performance on EC2. But this is a partial solution because responses from MongoDB and communications between mongos and mongod are still inefficient.

e) another minor point: BSON format is very wasteful in terms of memory usage. Giving that we try to minimize our database sizes to reduce hardware costs the recent trend in our use of MongoDB is instead of representing data as BSON document do serialization to some more compact format and instead store our data as big binary blobs (i.e. to simplify our documents look like { _id = '....', data = '... serialized data ...'}

By the way at some point we evaluated switching to CitrusLeaf. This product supposedly addresses some of the above issues (mostly a, b and c) but it seems that expected savings in hardware costs would be offset by licensing costs so at least for now we are not going to.

22 comments:

Salocin.TEN (www.salocinten.info) said...

Thank you for the pointers.

I am currently starting out with MongoDB and so will take into account the points mentioned. :-)

Ac Jitu said...

After study a number of the websites with your site now, and that i genuinely appreciate your method of blogging. I bookmarked it to my bookmark site list and are checking back soon. Pls have a look at my web page likewise and let me know if you agree. https://royalcbd.com/product/cbd-gummies-10mg/

Kent Hu said...

Nice post, keep it up.
Hope you are well in the current situation.
b2b marketing service
Marketingcom
seo package

Bryan said...

Good content, hope you well and keep it up.
property management company malaysia

Ahmad Fakruden said...

That's interesting, thanks for sharing.
www.xessb.com
eddy current testing service
www.xessb.com/ndt-service/

luckydavid said...

Very interesting, good job, and thanks for sharing such a good blog.
https://incracked.com/wondershare-recoverit-crack/

maxis wireless broadband said...

Let’s read all these articles
https://www.lokaeats.com/wawa-menu-price-usa/
https://www.lokaeats.com/jack-in-the-box-menu-price-usa/
https://www.lokataste.com/texas-chicken-menu-malaysia

Anonymous said...

Web Design Malaysia Rebrand specialise in website design, e-commerce solutions, digital marketing, branding strategy and much more. We strongly believe that having a high-quality website doesn't necessarily need to cost a huge sum of money. Hence, we are a group of professionals that came together with a goal in mind: to deliver excellent web designs that provide value to our customers that range from startups to enterprises and large organisations.

Anonymous said...

supplement for knee pain malaysia Duplex® strives to be your trusted healthcare brand, a brand that will never settle for less than the best. We firmly believe your health matters. At Duplex®, we pledge to make your well being our priority. Our aim is to deliver effective, yet affordable healthcare simply because we believe good health makes living more meaningful. We are your trusted ally on the journey to attain a healthy mind, body and spirit.

Anonymous said...

Apple Swift Developer Certification RE2 Learning Solutions (Asia) Sdn Bhd was founded in 2016. The company is one of a leader in the field of professional IT training in Malaysia. Over the years, RE2 (Asia) has helped thousands of young learners, companies, government departments and agencies to improve and develop their IT skills.

Anonymous said...

Microsoft Office Specialist Malaysia RE2 Learning Solutions (Asia) Sdn Bhd was founded in 2016. The company is one of a leader in the field of professional IT training in Malaysia. Over the years, RE2 (Asia) has helped thousands of young learners, companies, government departments and agencies to improve and develop their IT skills.

Assignment Writing Help said...

We are a top rated assignment help online Online service here with experts specializing in a wide range of disciplines ensuring you get the assignments that score maximum grades.

Unknown said...

Leo Pump , LEO GROUP is a national high-tech enterprise engaged in R&D, design, manufacturing, marketing and customer service providing for full range of pumps and pump integration system. LEO Group is the first listed company in Chinese pump industry.

Roan Parker said...

Canon.com/ijsetup Setup delivers amazing printing quality. Simply click on know more to get the complete information of the Canon Pixma Setup.

Max Turner said...

Visit ij.start.cannon | ij.start canon and find out the best way to download Canon printer drivers. Canon printers are ideal for every situation wherever you need a document, paper, or photo print or even if you wish to scan, fax, and do more.

All-in-one Canon Inkjet printers are suitable for home, business, school, and others to improve productivity. You can easily set up your Canon printer through drivers from Canon.com/ijsetup , wireless connection, USB, and a few components.

ethan potter said...

Canon IJ Network Tool you to watch out for the points mentioned below considerably:
If you want a LAN setup for your printer, you should have the required connectivity equipment such as Network Access Point (Router/ Modem), LAN Cable etc.To get your IJ Network tool to work, you first need to check your printer’s connectivity via LAN connection. Next, check your LAN cable carefully. Canon IJ Printer Utility you can alter your printer’s ink cartridge settings according to your requirements. If any ink cartridges get empty, you can continue to print with other available cartridges after changing the settings.

Great Assignment Helper said...

Assignment is a new norm of every modern education system thus creating a need of Do my statistics assignment online websites. We are one of those who have been providing such help to students for years. A main reason behind our success is our trustworthiness. Trust us once with the most important part of your academic life and see how we make it shine.

Emma keth said...

Download Cricut Design Space from Cricut.com/setup | Cricut com setup windows | cricut.com setup windows and install it to set up your Cricut machine. With the installation, you can easily move on to designing, cutting, and crafting. An account is essential to create that allows you to select multiple projects and keeps you updated.

Marry James said...

Marry James is a writing Expert with 15+ years of experience. Marry is also associated with MyAssignmenthelp.com, where she regularly helps students write their essays/assignments. In addition, Marry also likes to read and has read more than 100 books now. Students prefer his services as a tutor and as a counsellor and guides students on academic issues. She offers HTML assignment help to students who need help with their papers. Marry is a programmer too, so she has detailed knowledge about the subject.

Other Service
write my essay for me
Top Essay Writing Service
English Essay Writing Help
Physics homework help
college essays help
Essay Editing Service
Fraction Calculator
Persuasive Essay Help
write my research paper
plagiarism checker
Book Review Writing
Title Generator
plagiarism checker
Nursing Resume
free tools
Harvard referencing generator
Summary Generator
fnsacc311 assessment answers
hltaid004 assessment answers

news said...

Thanks for sharing this informative information with us. This is a fantastic website, thanks for sharing.

cuevana3 | Pelisplus

maxis wireless broadband said...

Good article! Check out
event management company, online payroll system malaysia, and payroll

CoinCog - Best Crypto Blogs in 2022 said...

Only a handful of the steps are listed above, but if you follow them all, you shouldn't have any issues after logging in to Capital One Login. But, if you are still experiencing problems, contact customer care and discuss the matter. The bank will always notify you on the problem before deactivating your account and urge you to fix it or they will move forward with the deactivation process.