Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Situation Awareness
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
Help Center/ Document Database Service/ FAQs/ Product Consulting/ Q&A About Switching Storage Engine to RocksDB for DDS 4.2 and Later Versions

Q&A About Switching Storage Engine to RocksDB for DDS 4.2 and Later Versions

Updated on 2024-09-11 GMT+08:00

What Are the Differences Between RocksDB and WiredTiger?

  • Data write method
    • Data is in the B+ tree structure in WiredTiger. A key in the flushed data corresponds to a version. Inserting, updating, or deleting a key directly operates the corresponding data node.
    • Data is in the LSM-tree structure in RocksDB. Data is written in the log appending mode with a key, a value, as well as a version. A key corresponds to multiple versions on a disk. Inserting, updating, or deleting data at the service layer is converted to writing data in RocksDB. When data of multiple versions is stacked to a certain threshold, the data is merged automatically. This is how compaction in RocksDB works.
  • Data organization
    • In WiredTiger, data of a collection or index corresponds to a disk file. The size of the collection is the same as that of the disk file.
    • In RocksDB, files of 64 MB each are distributed on a disk.

What Are the Advantages of RocksDB?

Table 1 lists the advantages of RocksDB over WiredTiger in the following aspects: open-source ecosystem, storage space, customizability, high memory pressure, frequent update and deletion, and multi-table scenario.

Table 1 Comparison between RocksDB and WiredTiger

Storage Engine

RocksDB

WiredTiger

Open-source ecosystem

Compared with WiredTiger, RocksDB has a better open-source ecosystem (GitHub Star). Some well-known databases, such as TiDB, CRDB, and YUGADB, use RocksDB as the storage engine.

The open-source community ecosystem is not as good as RocksDB.

Storage space

During RocksDB data writing, data of multiple versions is temporarily stored in some service scenarios. The data of multiple versions will be asynchronously merged into the final version. The storage space may temporarily increase.

WiredTiger flushes only the latest version of data to disks, consuming less storage space.

Customizability

In RocksDB, there are many performance tuning parameters. You can modify the parameters based on the read and write requirements of your services.

In WiredTiger, there are a few performance tuning parameters.

High memory pressure

The read and write performance of RocksDB is stable and does not change with the memory pressure.

WiredTiger needs to frequently flush dirty pages and swap memory and disk data. As a result, the read and write performance fluctuates greatly.

Frequent update and deletion

After a certain amount of new data is accumulated, the compact thread is automatically triggered to merge and aggregate data of multiple versions to release redundant disk space. Disk fragmentation does not occur.

After deleting data, WiredTiger merges and aggregates data of multiple versions, causing disk space fragments. However, WiredTiger does not return the disk space to the operating system. WiredTiger marks the disk space for subsequent writes of the current collection. Disk fragmentation is severe.

Multi-table scenario

RocksDB supports more than 10,000 tables and indexes.

If there are more than 1,000 tables or indexes in WiredTiger, the read and write performance is affected.

Why Does Huawei Cloud DDS 4.2 or Later Use RocksDB as the Storage Engine?

According to Table 1, RocksDB has many advantages over WiredTiger. Using the community-friendly RocksDB, Huawei Cloud DDS is compatible with APIs of multiple MongoDB versions, such as MongoDB 4.2, 4.4, and 5.0.

Will Services Be Affected If the Storage Engine of Huawei Cloud DDS 4.2 or Later Is Switched to RocksDB?

  • Function: A storage engine is a component of a database and manages the storage mode of data in the memory and disks. Although RocksDB and WiredTiger are different storage engines, DDS encapsulates its storage engine and is compatible with community APIs. Developers are unaware of the usage differences and services are not affected.
  • Performance: RocksDB has experienced a long-term community evolution. Based on custom development by the DDS team, RocksDB has no obvious difference in performance with WiredTiger. In some query scenarios, RocksDB has better performance, and its storage or compute resource usage is slightly different from WiredTiger.

What Are the Performance Differences and Optimization Suggestions for the RocksDB Storage Engine in Typical Scenarios?

Table 2 describes the performance differences between RocksDB and WiredTiger and optimization suggestions in some typical service scenarios.

Table 2 RocksDB performance differences and optimization suggestions

Scenario

RocksDB Performance Differences

Optimization Suggestions

Example

Multi-document scanning

RocksDB consumes more CPU and I/O resources than WiredTiger in scenarios where many documents need to be scanned.

Add appropriate indexes for optimization to improve the scanning efficiency and reduce the consumption of resources such as CPU and I/O.

For example, if no index is added to field A in the coll table, run db.coll.find({A: 1}) to query based on the field.

Why Do Disk and CPU Usage Fluctuations Occur When Lots of Addition, Deletion, and Modification Operations Are Performed on Huawei Cloud DDS Using RocksDB?

  • In RocksDB, data is written in appending mode. Updating or deleting data will not modify the original data. Instead, the data is appended to the end. Therefore, the same key may have values of different versions on disks. This causes a piece of data may have multiple versions, increasing disk usage.
  • Values of different versions will be merged when the amount of newly written data reaches a certain threshold. This process calls compaction in RocksDB. Data is merged asynchronously. After a round of data merging completes, data of different versions is merged. After the data merging, a new single-version data file is generated and the old multiple-version data file is deleted. While a new file is being created and an old file is being deleted, both old and new files are stored and disk usage increases temporarily. After data merging completes, the disk usage decreases immediately.
  • Data merging occupies a small number of CPUs, and there may be a slight CPU usage fluctuation.

If the disk usage and CPU usage remain high, contact Huawei technical support.

Does DDS 4.2 or Later Support Customized Storage Engine Switchover?

No support plan is available. Please stay tuned for the service announcement.

We use cookies to improve our site and your experience. By continuing to browse our site you accept our cookie policy. Find out more

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback