ApsaraDB for MongoDB fully supports the MongoDB protocol and is based on the distributed Apsara system and high-reliability storage engine. ApsaraDB for MongoDB provides solutions such as multiple-node high-availability architecture, elastic scaling, disaster recovery, backup and rollback, and performance optimization.
Test environment
Item | ECS instance | ApsaraDB for MongoDB instance that uses the physical server | ApsaraDB for MongoDB instance that uses the cloud disk |
Region and zone | Hangzhou Zone H | Hangzhou Zone H | Hangzhou Zone H |
Network type | VPC | VPC | VPC |
Instance category | c6e, compute-optimized instance family with enhanced performance | General-purpose and dedicated | Dedicated |
Instance type | ecs.c6e.2xlarge(8 cores, 16 GB) | A variety of specifications are available. For more information, see Test results. | A variety of specifications are available. For more information, see Test results. |
Storage type | ESSD PL1 | Local SSD | ESSD PL1 |
Topology | - | Standard replica set instance (three nodes: one primary node, one secondary node, and one hidden node) | Standard replica set instance (three nodes: one primary node, one secondary node, and one hidden node) |
Image version | Alibaba Cloud Linux 3.2104 LTS 64-bit | 3.10.0-327.ali2017.alios7.x86_64 | 4.19.81-17.2.al7.x86_64 |
Database engine version | - | MongoDB 4.2 (baseline of minor version 4.2.13) | MongoDB 4.4 (baseline of minor version 4.4.1) |
Consistency | - | Default read/write concern | Default read/write concern |
If the ECS instance and ApsaraDB for MongoDB instance are deployed in the same region and zone, the round-trip time (RTT) value is approximately 0.104ms.
Test tool
The open-source YCSB 0.17.0 tool is used for stress testing.
YCSB is a Java tool that can be used in performance testing for multiple databases. For more information about its installation and usage, see YCSB.
Test procedure
Add the primary private IP address of the ECS instance to a whitelist of the ApsaraDB for MongoDB instance. For more information, see Modify an IP address whitelist for an instance.
NoteYou can log on to the ECS console and view the Primary Private IP Address of the ECS instance in the Network Information section of the Instance Details page.
Connect to the ECS instance. For more information, see Create and manage an ECS instance by using the ECS console (express version).
Use the Yahoo Cloud Serving Benchmark (YCSB) tool to load test data.
./bin/ycsb load mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=1000000 -p mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin" -threads 8
You can modify the following items:
recordcount=1000000
: the total number of data records loaded to instance.mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin"
: the endpoint of the instance. The database account is test and the database is admin.NoteYou can obtain the endpoint in the Internal Connections - VPC section of the Database Connections page in the ApsaraDB for MongoDB console.
threads 8
: the number of concurrent threads on the client.
Run the following command to perform performance stress testing:
./bin/ycsb run mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=1000000 -p operationcount=5000000 -p insertproportion=0 -p readproportion=50 -p updateproportion=50 -p requestdistribution=zipfian -p mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin" -threads 8
You can modify the following items:
recordcount=1000000
: the total number of data records loaded to instance.operationcount=5000000
: the total number of read and write operations.insertproportion=0
: the ratio of load operations.readproportion=50
: the ratio of read operations.updateproportion=50
: the ratio of update operations.mongodb.url="mongodb://test:****@dds-bp13e84d11****.mongodb.rds.aliyuncs.com:3717/admin"
: the endpoint of the instance. The database account is test and the database is admin.Note You can obtain the endpoint in the Internal Connections - VPC section of the Database Connections page in the ApsaraDB for MongoDB console.threads 8
: the number of concurrent threads on the client.
Test results
Scenarios
r:w=100:0
: The ratio of read requests to write requests is 100:0.r:w=95:5
: The ratio of read requests to write requests is 95:5.r:w=50:50
: The ratio of read requests to write requests is 50:50.r:w=5:95
: The ratio of read requests to write requests is 5:95.r:w=0:100
: The ratio of read requests to write requests is 0:100.
Metrics
recordcount
: the total number of data rows uploaded to the ApsaraDB for MongoDB instance.operationcount
: the total number of read/write operations.threads
: the number of concurrent threads on the client.throughput
: the throughput of the ApsaraDB for MongoDB instance. Unit: Operation per second (OPS).RAL
: the average latency of read operations. Unit: microseconds.WAL
: the average latency of write operations. Unit: microseconds.
In this topic, if RAL
or WAL
is set to 0, no read or write operations are involved.
The following sections show the test results and performance comparison between an instance that uses a physical server and an instance that uses cloud disks at different read/write ratios.
Instance that runs MongoDB 4.2 and uses a physical server
Instance that runs MongoDB 4.4 and uses cloud disks
Performance comparison
Result analysis
CPU:Memory=1:2
: The performance of the instance that uses the physical server architecture is better than that of the instance that uses cloud disks. The performance difference is about 7% to 50% at different read/write ratios. The maximum difference exists on instances that have 4 CPU cores and 8 GB of memory.CPU:Memory=1:4
: The performance difference between the instance that uses the physical server and the instance that uses cloud disks is reduced to about 10%. The instance that uses the physical server is suitable for write scenarios, and the instance that uses cloud disks is suitable for read scenarios.CPU:Memory=1:8
:The instance that uses the physical server provides almost the same performance as the instance that uses cloud disks.
With the increase of memory, the instance that uses the cloud disk provides better performance than the instance that uses the physical server. The maximum difference exists on instances of 4 cores, 32 GB.
The instance that uses the cloud disk has the following benefits:
All resources are dedicated and can avoid the resource intention that occurs on the instance that uses the physical server.
Compute and storage resources can be automatically scaled. No data migration is required.
Enhanced SSDs (ESSDs) have performance levels such as PL1, PL2, and PL3. These levels are more cost-effective for pay-as-you-go instances.