My Account Log in

1 option

MongoDB performance tuning : optimizing MongoDB databases and their applications / Guy Harrison, Michael Harrison.

O'Reilly Online Learning: Academic/Public Library Edition Available online

View online
Format:
Book
Author/Creator:
Harrison, Guy, author.
Harrison, Michael, author.
Language:
English
Subjects (All):
Database management.
Physical Description:
1 online resource (xxiv, 349 pages) : illustrations
Place of Publication:
[Place of publication not identified] : APress, [2021]
Summary:
Use this fast and complete guide to optimize the performance of MongoDB databases and the applications that depend on them. You will be able to turbo-charge the performance of your MongoDB applications to provide a better experience for your users, reduce your running costs, and avoid application growing pains. MongoDB is the world's most popular document database and the foundation for thousands of mission-critical applications. This book helps you get the best possible performance from MongoDB. MongoDB Performance Tuning takes a methodical and comprehensive approach to performance tuning that begins with application and schema design and goes on to cover optimization of code at all levels of an application. The book also explains how to configure MongoDB hardware and cluster configuration for optimal performance. The systematic approach in the book helps you treat the true causes of performance issues and get the best return on your tuninginvestment. Even when you're under pressure and don't know where to begin, simply follow the method in this book to set things right and get your MongoDB performance back on track. What You Will Learn * Apply a methodical approach to MongoDB performance tuning * Understand how to design an efficient MongoDB application * Optimize MongoDB document design and indexing strategies * Tune MongoDB queries, aggregation pipelines, and transactions * Optimize MongoDB server resources: CPU, memory, disk * Configure MongoDB Replica sets and Sharded clusters for optimal performance Who This Book Is For Developers and administrators of high-performance MongoDB applications who want to be sure they are getting the best possible performance from their MongoDB system. For developers who wish to create applications that are fast, scalable, and cost-effective. For administrators who want to optimize their MongoDB server and hardware configuration.
Contents:
Intro
Table of Contents
About the Authors
About the Technical Reviewer
Acknowledgments
Introduction
Part I: Methods and Tools
Chapter 1: Methodical Performance Tuning
A Cautionary Tale
Symptomatic Performance Tuning
Systematic Performance Tuning
Anatomy of a Database Request
The Layers of a MongoDB Database
Minimizing the Application Workload
Reducing Physical IO
Optimizing Disk IO
Cluster Tuning
Summary
Chapter 2: MongoDB Architecture and Concepts
The MongoDB Document Model
JSON
Binary JSON (BSON)
Collections
MongoDB Schemas
The MongoDB Protocol
Wire Protocol
MongoDB Drivers
MongoDB Commands
The find Command
The aggregate Command
Data Manipulation Commands
Consistency Mechanisms
Read Preference and Write Concern
Transactions
Query Optimization
MongoDB Architecture
Mongod
Storage Engines
Replica Sets
Sharding
Sharding Mechanisms
Cluster Balancing
Conclusion
Chapter 3: Tools of the Trade
Introduction to explain()
Getting Started with explain()
Alternate Plans
Execution Statistics
Using explain() to Tune a Query
Visual Explain Utilities
The Query Profiler
The system.profile Collection
Analyzing Profiling Data
Tuning with MongoDB Logs
Server Statistics
Examining Current Operations
Operating System Monitoring
MongoDB Compass
Part II: Application and Database Design
Chapter 4: Schema Modelling
The Guiding Principles
Linking vs. Embedding
A Case Study
Getting All the Data for a Customer
Fetching All Open Orders
Top Products
Inserting New Orders
Updating Products
Deleting a Customer
Case Study Summary
Advanced Patterns
Subsetting
Vertical Partitioning
The Attribute Pattern
Chapter 5: Indexing
B-Tree Indexes.
Index Selectivity
Unique Indexes
Index Scans
Case-Insensitive Searches
Compound Indexes
Compound Index Performance
Compound Index Key Order
Guidelines for Compound Indexes
Covering Indexes
Index Merges
Partial and Sparse Indexes
Partial Indexes
Sparse Indexes
Using Indexes for Sorting and Joining
Sorting
Using Indexes for Joins
Index Overhead
Wildcard Indexes
Text Indexes
Text Index Performance
Geospatial Indexes
Geospatial Index Performance
Geospatial Index Limitations
Part III: Tuning MongoDB Code
Chapter 6: Query Tuning
Caching Results
Optimizing Network Round Trips
Projections
Batch Processing
Avoiding Excessive Network Round Trips in Code
Bulk Inserts
Application Architecture
Choosing an Index vs. a Scan
Overriding the Optimizer with Hints
Optimizing Sort Operations
Picking or Creating the Right Index
Filter Strategies
Not Equals Conditions
Range Queries
OR or IN Operations
Array Queries
Regular Expressions
exists Queries
Optimizing Collection Scans
Chapter 7: Tuning Aggregation Pipelines
Tuning Aggregation Pipelines
Optimizing Aggregation Ordering
Automatic Pipeline Optimizations
Optimizing Multi-collection Joins
Join Order
Optimizing Graph Lookups
Aggregation Memory Utilization
Sorting in Aggregation Pipelines
Indexed Aggregation Sorts
Disk Sorts
Optimizing Views
Materialized Views
Chapter 8: Inserts, Updates, and Deletes
Fundamentals
Filter Optimizations
Explaining a Data Manipulation Statement
Finding Unused Indexes
Write Concern
Inserts
Cloning Data
Loading from Files
Updates
Dynamic Value Bulk Updates
The multi:true Flag
Upserts
Bulk Upsert with merge.
Delete Optimizations
Chapter 9: Transactions
Transaction Theory
MongoDB Transactions
Transaction Limits
TransientTransactionErrors
Transactions in the MongoDB Drivers
The Performance Implications of TransientTransactionErrors
Transaction Optimization
Avoiding Transactions
Ordering of Operations
Partitioning Hot Documents
Chapter 10: Server Monitoring
Host-Level Monitoring
Network
CPU
Memory
Disk IO
MongoDB Server Monitoring
Compass
Free Monitoring
Ops Manager
MongoDB Atlas
Third-Party Monitoring Tools
Part IV: Server Tuning
Chapter 11: Memory Tuning
MongoDB Memory Architecture
Host Memory
Measuring Memory
WiredTiger Memory
Cache Size
Determining the Optimum Cache Size
The Database Cache "Hit" Ratio
Evictions
Blocking Evictions
Checkpoints
WiredTiger Concurrency
Reducing Application Memory Demand
Document Design
Indexing
Chapter 12: Disk IO
IO Fundamentals
Latency and Throughput
Queuing
Sequential and Random IO
Disk Hardware
Magnetic Disks (HDD)
Solid State Drives
SSD Storage Hierarchy
Write Performance
Write Endurance
Garbage Collection and Wear Levelling
SATA vs. PCI
Recommendations for SSDs
Storage Arrays
RAID Levels
The RAID 5 Write Penalty
Non-volatile Caches in RAID 5 Devices
Do It Yourself Arrays
Hardware Storage Arrays
Cloud Storage
Disk Devices in MongoDB Atlas
MongoDB IO
Temporary File IO
The Journal
Moving the Journal to a Dedicated Device
Datafile IO
Datafile Writes
Splitting Up Datafiles Across Multiple Devices
Detecting and Solving IO Problems
Increasing IO Subsystem Bandwidth
Dedicated Server with Dedicated Disks
MongoDB Atlas.
Summary
Chapter 13: Replica Sets and Atlas
Replica Set Fundamentals
Using Read Preference
Setting Read Preference
maxStalenessSeconds
Tag Sets
Journaling
The Write Concern w Option
Write Concern and Secondary Reads
Atlas Search
Atlas Data Lake
Chapter 14: Sharding
Sharding Fundamentals
Scaling and Sharding
Sharding Concepts
To Shard or Not to Shard?
Shard Key Selection
Range- vs. Hash-Based Sharding
Zone Sharding
Shard Balance
Rebalancing Shards
Modifying the Balancer Window
Disabling the Balancer
Changing the Chunk Size
Changing Shard Keys
Sharded Queries
Sharded Explain Plans
Shard Key Lookups
Accidental Shard Merge
Shard Key Range
Non-Shard Key Lookups
Aggregations and Sorts
Sharded lookup Operations
Index.
Notes:
Description based on print version record.
Includes index.
ISBN:
9781484268797
1484268792
OCLC:
1244806349

The Penn Libraries is committed to describing library materials using current, accurate, and responsible language. If you discover outdated or inaccurate language, please fill out this feedback form to report it and suggest alternative language.

Find

Home Release notes

My Account

Shelf Request an item Bookmarks Fines and fees Settings

Guides

Using the Find catalog Using Articles+ Using your account