Manosh Malai
CTO, Mydbops LLP
Mydbops MyWebinar Edition 34
What’s New In
MongoDB 8.0
About Me
Manosh Malai
❏ Interested in Open Source technologies
❏ Interested in MongoDB, DevOps & DevOpSec Practices
❏ Tech Speaker/Blogger
❏ MongoDB User Group Leader(Bangalore)
Consulting
Services
Consulting
Services
Managed
Services
❏ Database Management and consultancy
provider
❏ Founded in 2016
❏ Assisted 800+ happy customers
❏ AWS partners
❏ PCI & ISO certified
About Us
❏ Performance Enhancements
❏ Workload Specific Improvements
❏ Time Series Enhancements
❏ Command Path Optimization
❏ Express Path Efficiency
❏ Advanced Sharding Capabilities
❏ Moving unsharded collections
❏ Converting sharded collections to unsharded
❏ Queryable Encryption Enhancements
❏ Persistent Query Settings
Agenda
Performance
Enhancements
❏ Up to 54% improvement in write performance (YCSB Write Bulk Data)
❏ Read performance gains of up to 27% (YCSB Read-Heavy workloads)
❏ Mixed workload improvements (95% Read, 5% Write) see up to 25% gains
❏ Linkbench benchmarks suggest an 18% performance increase
❏ Time Series workloads (TSBS) benefit from up to a 60% boost
Performance Enhancements
Benchmark Improvement
YCSB Write-Heavy (100% Write) Up to 54%
YCSB Read-Heavy (95% Read) Up to 27%
Linkbench (if data available) Up to 18%
Time Series Workloads (TSBS) Up to 60%
Workload Specific
Improvements
MongoDB 5.0, 6.0 & 7.0
❏ Storage Engine: Classic —> SBE
❏ Significant improvements: $group, $project, $match, $sort, $lookup(in replica) Operation
❏ Columnar Storage: Boosts performance for aggregation, sorting, visualization(Time Series Enhancements)
❏ Game-Changer: Efficiently handles large volumes of time series data
MongoDB 8.0 (Expected)
❏ Block Processing: Faster queries $group 60% Improvement
❏ Awaiting Details: Confirmed improvements, documentation pending
Workload Specific Improvements
Command Path Optimization in MongoDB 8.0
❏ Overview: Major overhaul of the internal command path handling
❏ Performance: Significant enhancements for faster response times
❏ Efficiency: More efficient database operations guaranteed
References
➔ https://jira.mongodb.org/browse/SERVER-80296
➔ https://jira.mongodb.org/browse/SERVER-84283
➔ https://jira.mongodb.org/browse/SERVER-82831
Workload Specific Improvements
Express Path Latency Improvement
❏ Improvement: 17% Latency Reduction
❏ Key Enhancement: Introduction of SortedDataKeyValueView and seekForKeyValueView
Current Method
❏ Invocation: Uses SortedDataInterface::seek with index key
❏ Creation: Constructs underutilized BSONObj
❏ Data Retrieval: Fetches IndexKeyEntry with RecordId
Reference:
→ https://jira.mongodb.org/browse/SERVER-89445
→ mongo-r8.0.0-rc10/src/mongo/db/storage/key_string.h
→ mongo-r8.0.0-rc10/src/mongo/db/storage/sorted_data_interface.h
Express Path Efficiency
Express Path Latency Improvement
Proposed Method
❏ Direct Retrieval: Uses seekForKeyValueView
❏ Avoids BSONObj: Bypasses unnecessary BSONObj creation
❏ Efficient Data Access: Combines keystring and RecordId into a tuple
Benefits
❏ Reduced Overhead: Streamlines query process
❏ Enhanced Speed: Faster query execution in the Express Path
❏ Resource Efficiency: Better performance and resource allocation
Express Path Efficiency
❏ Google TCMalloc
❏ Per-CPU Cache: Faster data access and reduced latency.
❏ 18% Memory Fragmentation Reduction: More efficient use of memory.
❏ Enhanced Peak Load Performance: Better responsiveness and stability under high load.
Reduced Memory Fragmentation
Query Insight Features
❏ Detailed Namespace-Level Metrics: Fast issue resolution with performance comparison across
collections.
❏ Heatmap Panel: Visualize and understand query trends.
Improved Visibility In Query Insights: MongoDB Atlas
Query Shape and Rejection Filters
Query Shape Standardization:
❏ Uses kToRepresentativeParseableValue method to create a unified query shape.
❏ Focuses on structural patterns for optimization.
Reject Operations Using Query Shape:
❏ Query Shape and Operation Rejection:
❏ Standardizes query structure for optimization.
❏ Identifies and simplifies structurally similar queries.
❏ Rejects resource-consuming queries via their query shape.
Improved Visibility In Query Insights: MongoDB Atlas
db.adminCommand({
setQuerySetting: ‘xxxxxx’,
Settings: {
Reject: true
}
})
Challenges with Previous Methods
❏ Using planCacheSetFilter
❏ Configuration not persisted across restarts.
❏ Operational challenges in maintaining settings.
Code example:
Persistent Query Settings
db.runCommand(
{
planCacheSetFilter: <collection>,
query: <query>,
sort: <sort>,
projection: <projection>,
indexes: [ <index1>, <index2>, ...],
}
)
New Feature: Persistent Query Settings
Advantages:
❏ Applies index for specific query shapes matching hash.
❏ Replicates settings across replica set members.
❏ Persists configurations between restarts.
❏ No application code changes required.
Persistent Query Settings
db.adminCommand({
setQuerySettings: '<QueryShapeHash>',
indexFilters: '<Index Name>'
})
{
planSummary: "COLLSCAN",
queryShapeHash: '7F312F79FCOC3_*',
durationMilli s: 11123232 // Too long
}
Code Example slow query log entry:
Global Read Timeout Definition
❏ Set a default timeout (maxTimeMS) for all read operations across your cluster.
❏ Protects against resource-intensive queries.
❏ Ensures efficient query execution and cluster stability.
Code example:
Define Read Timeout Globally
db.adminCommans(
{
setClusterParameter: {
defaultMaxTimeMS: { readOperations: 20000}
}
}
}
Move Unsharded Collection
Simplified Process
❏ Use db.adminCommand({moveCollection: "mydbops.mongodb", toShard: "shard1"}) to relocate unsharded
collections.
❏ Ensures seamless transfer without disrupting operations.
Convert Sharded Collection to Unsharded
Streamlined Operation
❏ Utilize db.adminCommand({unshardCollection: "mydbops.mongodb", toShard: "shard1"}) for converting
sharded collections to unsharded.
❏ Enables faster resharding, reducing impact on workload significantly.
Advanced Sharding Capabilities
Example:
Resharding 500GB in a 1TB cluster now completes in hours, enhancing scalability and operational
efficiency.
Advanced Sharding Capabilities
Range Query Support
Enhanced Functionality:
❏ Introduces support for range queries within date ranges and numeric bounds.
❏ Includes Decimal 128 for accurate handling of financial values.
❏ Encrypted fields now support operators like $gt, $lt, $gte, and $lte.
Queryable Encryption Enhancements in MongoDB 8.0
Thank you!

What's New in MongoDB 8.0 - Mydbops MyWebinar Edition 34

  • 1.
    Manosh Malai CTO, MydbopsLLP Mydbops MyWebinar Edition 34 What’s New In MongoDB 8.0
  • 2.
    About Me Manosh Malai ❏Interested in Open Source technologies ❏ Interested in MongoDB, DevOps & DevOpSec Practices ❏ Tech Speaker/Blogger ❏ MongoDB User Group Leader(Bangalore)
  • 3.
    Consulting Services Consulting Services Managed Services ❏ Database Managementand consultancy provider ❏ Founded in 2016 ❏ Assisted 800+ happy customers ❏ AWS partners ❏ PCI & ISO certified About Us
  • 4.
    ❏ Performance Enhancements ❏Workload Specific Improvements ❏ Time Series Enhancements ❏ Command Path Optimization ❏ Express Path Efficiency ❏ Advanced Sharding Capabilities ❏ Moving unsharded collections ❏ Converting sharded collections to unsharded ❏ Queryable Encryption Enhancements ❏ Persistent Query Settings Agenda
  • 5.
  • 6.
    ❏ Up to54% improvement in write performance (YCSB Write Bulk Data) ❏ Read performance gains of up to 27% (YCSB Read-Heavy workloads) ❏ Mixed workload improvements (95% Read, 5% Write) see up to 25% gains ❏ Linkbench benchmarks suggest an 18% performance increase ❏ Time Series workloads (TSBS) benefit from up to a 60% boost Performance Enhancements Benchmark Improvement YCSB Write-Heavy (100% Write) Up to 54% YCSB Read-Heavy (95% Read) Up to 27% Linkbench (if data available) Up to 18% Time Series Workloads (TSBS) Up to 60%
  • 7.
  • 8.
    MongoDB 5.0, 6.0& 7.0 ❏ Storage Engine: Classic —> SBE ❏ Significant improvements: $group, $project, $match, $sort, $lookup(in replica) Operation ❏ Columnar Storage: Boosts performance for aggregation, sorting, visualization(Time Series Enhancements) ❏ Game-Changer: Efficiently handles large volumes of time series data MongoDB 8.0 (Expected) ❏ Block Processing: Faster queries $group 60% Improvement ❏ Awaiting Details: Confirmed improvements, documentation pending Workload Specific Improvements
  • 9.
    Command Path Optimizationin MongoDB 8.0 ❏ Overview: Major overhaul of the internal command path handling ❏ Performance: Significant enhancements for faster response times ❏ Efficiency: More efficient database operations guaranteed References ➔ https://jira.mongodb.org/browse/SERVER-80296 ➔ https://jira.mongodb.org/browse/SERVER-84283 ➔ https://jira.mongodb.org/browse/SERVER-82831 Workload Specific Improvements
  • 10.
    Express Path LatencyImprovement ❏ Improvement: 17% Latency Reduction ❏ Key Enhancement: Introduction of SortedDataKeyValueView and seekForKeyValueView Current Method ❏ Invocation: Uses SortedDataInterface::seek with index key ❏ Creation: Constructs underutilized BSONObj ❏ Data Retrieval: Fetches IndexKeyEntry with RecordId Reference: → https://jira.mongodb.org/browse/SERVER-89445 → mongo-r8.0.0-rc10/src/mongo/db/storage/key_string.h → mongo-r8.0.0-rc10/src/mongo/db/storage/sorted_data_interface.h Express Path Efficiency
  • 11.
    Express Path LatencyImprovement Proposed Method ❏ Direct Retrieval: Uses seekForKeyValueView ❏ Avoids BSONObj: Bypasses unnecessary BSONObj creation ❏ Efficient Data Access: Combines keystring and RecordId into a tuple Benefits ❏ Reduced Overhead: Streamlines query process ❏ Enhanced Speed: Faster query execution in the Express Path ❏ Resource Efficiency: Better performance and resource allocation Express Path Efficiency
  • 12.
    ❏ Google TCMalloc ❏Per-CPU Cache: Faster data access and reduced latency. ❏ 18% Memory Fragmentation Reduction: More efficient use of memory. ❏ Enhanced Peak Load Performance: Better responsiveness and stability under high load. Reduced Memory Fragmentation
  • 13.
    Query Insight Features ❏Detailed Namespace-Level Metrics: Fast issue resolution with performance comparison across collections. ❏ Heatmap Panel: Visualize and understand query trends. Improved Visibility In Query Insights: MongoDB Atlas
  • 14.
    Query Shape andRejection Filters Query Shape Standardization: ❏ Uses kToRepresentativeParseableValue method to create a unified query shape. ❏ Focuses on structural patterns for optimization. Reject Operations Using Query Shape: ❏ Query Shape and Operation Rejection: ❏ Standardizes query structure for optimization. ❏ Identifies and simplifies structurally similar queries. ❏ Rejects resource-consuming queries via their query shape. Improved Visibility In Query Insights: MongoDB Atlas db.adminCommand({ setQuerySetting: ‘xxxxxx’, Settings: { Reject: true } })
  • 15.
    Challenges with PreviousMethods ❏ Using planCacheSetFilter ❏ Configuration not persisted across restarts. ❏ Operational challenges in maintaining settings. Code example: Persistent Query Settings db.runCommand( { planCacheSetFilter: <collection>, query: <query>, sort: <sort>, projection: <projection>, indexes: [ <index1>, <index2>, ...], } )
  • 16.
    New Feature: PersistentQuery Settings Advantages: ❏ Applies index for specific query shapes matching hash. ❏ Replicates settings across replica set members. ❏ Persists configurations between restarts. ❏ No application code changes required. Persistent Query Settings db.adminCommand({ setQuerySettings: '<QueryShapeHash>', indexFilters: '<Index Name>' }) { planSummary: "COLLSCAN", queryShapeHash: '7F312F79FCOC3_*', durationMilli s: 11123232 // Too long } Code Example slow query log entry:
  • 17.
    Global Read TimeoutDefinition ❏ Set a default timeout (maxTimeMS) for all read operations across your cluster. ❏ Protects against resource-intensive queries. ❏ Ensures efficient query execution and cluster stability. Code example: Define Read Timeout Globally db.adminCommans( { setClusterParameter: { defaultMaxTimeMS: { readOperations: 20000} } } }
  • 18.
    Move Unsharded Collection SimplifiedProcess ❏ Use db.adminCommand({moveCollection: "mydbops.mongodb", toShard: "shard1"}) to relocate unsharded collections. ❏ Ensures seamless transfer without disrupting operations. Convert Sharded Collection to Unsharded Streamlined Operation ❏ Utilize db.adminCommand({unshardCollection: "mydbops.mongodb", toShard: "shard1"}) for converting sharded collections to unsharded. ❏ Enables faster resharding, reducing impact on workload significantly. Advanced Sharding Capabilities
  • 19.
    Example: Resharding 500GB ina 1TB cluster now completes in hours, enhancing scalability and operational efficiency. Advanced Sharding Capabilities
  • 20.
    Range Query Support EnhancedFunctionality: ❏ Introduces support for range queries within date ranges and numeric bounds. ❏ Includes Decimal 128 for accurate handling of financial values. ❏ Encrypted fields now support operators like $gt, $lt, $gte, and $lte. Queryable Encryption Enhancements in MongoDB 8.0
  • 21.