MongoDB for Developers with Python Transcripts
Chapter: High-performance MongoDB
Lecture: Introducing performance-tuning in MongoDB
Login or
purchase this course
to watch this video and the rest of the course contents.
0:01
Now that you know how to work MongoDB, you know how to work its shell, what the query syntax is, you've seen PyMongo as well as MongoEngine,
0:08
it's time to turn our attention to tuning MongoDB to be the best database it can possibly be.
0:15
We're going to focus on how to make our regular MongoDB server a high performance MongoDB database
0:22
and you'll see there's no magic here, a lot of the things that you can do are relatively straightforward, and there's a systematic way to go about it.
0:30
I want to start this section by maybe putting a little perspective on it.
0:35
I want to start this section, this chapter, by putting a little perspective out there.
0:42
When people come to NoSql and they start looking for alternative databases often the allure of these databases is their performance
0:50
you hear about things like sharding, horizontally scaling them, some incredible performance numbers, things like that.
0:56
That may be what you really need, that may be the most important thing
0:59
and certainly if you don't have performance out of your database it's a big problem.
1:04
We're going to certainly figure out how to make our databases faster and the variety of techniques that we have available to us in MongoDB.
1:12
That said, your biggest problem probably isn't performance, you may have a big data problem, you may have terabytes or petabytes of data
1:20
but most applications don't. You may have a performance problem, it may be that you have so much data
1:27
or you are asking such complex queries that it really does take very precise tuning and scaling to make it work.
1:34
So we're going to focus on some of these types of things. That said, we all have a complexity problem with our application,
1:41
it's always a pain to maintain these databases especially when we're working with relational databases,
1:47
you hear about things like migrations and updating your schema adding, removing, transforming columns, all of this stuff is really complex
1:54
and it even makes deployment really, really challenging, you want to release a new version of something based on SQLAlchemy
2:00
but you need to change the database scheme before it will even run— okay, that sounds like it could be a little bit of a problem.
2:06
What you'll see with MongoDB and these document databases is one of their biggest benefits is the simplicity that they bring.
2:15
The document structure means there's fewer tables, there is much fewer connections between these tables,
2:22
so when you think about the trade-offs and performance and things like that keep in mind that probably the biggest benefit
2:28
that you are going to get from MongoDB is you are going to have simpler versioning, evolution, maintainability, development story.
2:34
I just want to put that out there, because I know sometimes people will say well, I got MongoDB to perform at this speed
2:41
and I cut this other database, and if I tweak it like this and adapt it like that
2:45
maybe I could get it to go a little faster, so maybe we should use that instead. And maybe, I don't know, it depends on the situation,
2:51
and this is very abstract, so it's hard to say, but keep in mind that one of the biggest things these document databases
2:56
bring to you to the table here, is this simplicity. It just so happens we can also make them really, really fast.
3:04
So simple and fast, sounds like a great combination, so let's get into this section where we are going to make MongoDB much faster.