1 option
High Performance with MongoDB : Best Practices for Performance Tuning, Scaling, and Architecture.
- Format:
- Book
- Author/Creator:
- Kamsky, Asya.
- Language:
- English
- Subjects (All):
- MongoDB.
- Physical Description:
- 1 online resource (407 pages)
- Edition:
- 1st ed.
- Place of Publication:
- Birmingham : Packt Publishing, Limited, 2025.
- Summary:
- Practical strategies to help you design, optimize, and operate MongoDB deployments for performance, resilience, and growth Key Features Identify and fix performance bottlenecks with practical diagnostic and optimization strategies Optimize schema design, indexing, storage, and system resources for real-world workloads Scale confidently with.
- Contents:
- Intro
- FM
- Copyright
- Acknowledgements
- Contributors
- Table of Contents
- Preface
- Chapter 1: Systems and MongoDB Architecture
- What are systems?
- Characteristics of systems
- Changing systems is a risky business
- A system with no delays is simple
- A system with delays can behave in unexpected ways
- Trying to fix oscillations
- Systems surprise us
- A typical software system
- Algorithmic efficiency (complexity)
- Avoid premature optimization
- Amdahl's law (limit of parallel speedup)
- Locality and caching
- Little's law (throughput versus latency)
- Understanding MongoDB architecture
- The document model: MongoDB's foundation
- Key architectural components of MongoDB
- The data services system
- Query engine
- Storage engine/WiredTiger
- Libraries
- Other system components that mongod uses
- Managing complexity in modern data platforms
- Flexible data model with rigorous capabilities
- Built-in redundancy and resilience
- Horizontal scaling with intelligent distribution
- Performance tools
- Finding bottlenecks
- An incremental process for optimization
- Summary
- References
- Chapter 2: Schema Design for Performance
- Understanding the core principles of schema design
- There is no single right way
- Data collocation
- Read and write trade-offs
- Small versus large documents
- Common myths
- Key strengths of the MongoDB schema design
- One-to-many relationships
- Embedding weak entities
- Dynamic attributes
- Caches and snapshots
- Optimization for common use cases
- Schema evolution
- Schema validation
- Common schema design mistakes
- Overnormalizing
- Overembedding
- Other common anti-patterns
- Schema design patterns by benefit
- Patterns for read performance optimization
- Patterns for write performance optimization
- Patterns for query and analytics optimization.
- Archive pattern for storage optimization
- Real-world application: The Socialite app
- Scenario 1: User profile and activity feed
- Scenario 2: Chat system
- Chapter 3: Indexes
- Introduction to indexes
- What is an index?
- Resource efficiency and trade-offs
- Resource usage
- Common misconceptions about indexes in MongoDB
- Types of indexes in MongoDB
- Single-field indexes
- Compound indexes
- Multikey indexes
- Sparse indexes
- Wildcard indexes
- Partial indexes
- Designing efficient indexes
- Cardinality and selectivity
- Constructing compound indexes
- Equality queries
- Sorts and range queries
- The ESR guideline
- Maximizing resources with partial indexes
- Covered queries: the performance holy grail
- Ascending versus descending index order
- Indexing and aggregation pipelines
- Chapter 4: Aggregations
- MongoDB's aggregation framework
- Core concepts of the aggregation pipeline
- Performance considerations
- Aggregation pipeline flow
- Optimizing aggregation pipelines
- Optimization techniques
- Filter data early
- Avoid unnecessary unwind and group
- Design efficient group operations
- Avoid common lookup performance issues
- Efficient use of project and addFields
- Working with large datasets
- Aggregation pipeline limits
- Managing memory constraints with allowDiskUse
- Aggregation in distributed environments
- Optimizing aggregation for sharded collections
- Understanding shard-local versus merged operations
- Monitoring and profiling aggregation performance
- Utilizing materialized views
- Chapter 5: Replication
- Understanding MongoDB replica sets
- Components of a replica set
- Replication and high availability
- Understanding the MongoDB election process
- Replica set configuration
- Chained replication
- Replica set tags and analytics nodes.
- Replication internals and performance
- Flow control
- Replication and the oplog
- Managing replication lag
- Read and write strategies
- Read preference
- Write concern and durability
- Chapter 6: Sharding
- Understanding core sharding architecture
- Architectural components of a sharded cluster
- Sharding a collection and selecting a shard key
- Why scatter-gather is bad
- Strategic shard key selection
- Shard key for targeting operations
- Shard key with good granularity
- Avoid increasing or decreasing shard key values
- Types of sharding
- Range-based sharding
- Hashed sharding
- Zone-based sharding
- Advanced sharding administration
- Resharding: Whether, when, and how
- Balancer considerations
- Pre-splitting: Whether, when, and how
- Moving unsharded collections
- Colocating sharded collection chunks together
- Chapter 7: Storage Engines
- Exploring storage engines
- Overview of WiredTiger
- A lookup operation
- An update operation
- An insert operation
- Eviction, checkpointing, and recovery
- Compression and encryption
- Configuration for improving performance
- Changing the size of the WiredTiger cache
- Changing syncdelay
- Changing minSnapshotHistoryWindowInSeconds
- Changing how eviction works
- Switching to the in-memory storage engine
- Changing the max leaf page size
- Chapter 8: Change Streams
- Understanding change streams architecture
- How change streams work: From write operations to events
- Event structure and life cycle
- Implementing change streams effectively
- Choosing the right scope and filtering strategy
- Server-side filtering with aggregation pipelines
- Document lookup strategies and performance
- Building a price monitoring service
- Managing performance and durability
- Resource optimization strategies.
- Handling high-volume event streams
- Special considerations for sharded deployments
- Advanced patterns and production readiness
- Transaction visibility and event batching
- Document size limitations and collection life cycle
- Monitoring and health checks
- Replica set considerations
- Performance-tuning recap
- Chapter 9: Transactions
- Understanding multi-document ACID transactions
- History and evolution of transactions in MongoDB
- Introduction to ACID properties in MongoDB
- Document-level atomicity versus multi-document transactions
- Document-level atomicity
- Multi-document transactions atomicity
- When to use multi-document transactions in MongoDB
- Transactions API and session management
- Core API
- Callback API
- Read/write concerns and transaction behavior
- Performance considerations with transactions
- Replica set versus sharded cluster transactions
- WiredTiger cache considerations
- Managing transaction runtime limits and errors
- Lock acquisition and contention management
- Optimizing transaction size and duration
- Common transaction anti-patterns and their performance costs
- Long-running transactions and their impact on system performance
- Unnecessary use of transactions where single-document atomicity would suffice
- Single-document transactions
- Transactions for read-only operations
- Misunderstanding transaction scope and atomicity
- Frequent small transactions on hot documents/collections
- Improper error handling and retry logic
- Insufficient monitoring of transaction metrics
- Chapter 10: Client Libraries
- What are drivers?
- How MongoDB drivers work
- Key features of MongoDB drivers
- Consistency and reliability through shared specifications
- Idiomatic experience
- Performance optimization
- What are object-document mappers (ODMs)?
- Understanding ODMs.
- Key features of ODMs
- Schema enforcement and data validation
- Intuitive query APIs
- Relationship management
- Middleware and life cycle hooks
- Type safety and IDE integration
- Impact on developer productivity
- When to use ODMs
- What are application frameworks?
- The value of application frameworks
- Leveraging ODMs and ORMs in frameworks
- Popular MongoDB-compatible frameworks
- Best practices when using frameworks with MongoDB
- Beyond the basics
- Asynchronous and non-blocking patterns
- Surfacing and handling failure conditions
- Connection management
- Read/write concerns and read preferences
- Compression and network performance
- Chapter 11: Managing Connections and Network Performance
- Understanding connection fundamentals
- Latency
- Connection churn
- Network saturation
- Understanding the connection lifecycle
- Connection establishment
- Connection utilization and pooling
- Connection termination
- MongoDB connection architecture
- TCP/IP and the MongoDB Wire Protocol
- Driver connection pooling
- MongoDB server connection handling
- Monitoring and troubleshooting connections
- Connection monitoring best practices
- Optimizing connection management
- Connection pool optimization
- Connection timeout configuration
- Server-side optimization
- Operating system configuration
- Performance optimization leveraging network compression
- Benefits and trade-offs of network compression
- Available compression algorithms
- Implementing network compression
- Connection strategies for serverless environments
- Chapter 12: Advanced Query and Indexing Concepts
- Understanding query execution
- Plan stages, or "how indexes can be used"
- Using the explain command
- The queryPlanner section
- The executionStats section
- Analyzing log messages.
- Identifying problematic patterns.
- Notes:
- Description based upon print version of record.
- Description based on publisher supplied metadata and other sources.
- ISBN:
- 1-83702-262-3
- 1-83702-263-1
- OCLC:
- 1535400671
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.