This topic shows how to use an Elastic Compute Service (ECS) instance to benchmark the connection capacity of an ApsaraDB for MongoDB standalone instance.
Prerequisites
Create an ECS instance and an ApsaraDB for MongoDB standalone instance. For more information, see Create a standalone instance and Create an ECS instance.
The following table lists the instance configurations for this benchmark test.
Parameter
ECS instance
Standalone MongoDB instance
Description
Region and zone
China (Hangzhou) Zone H
China (Hangzhou) Zone H
Both instances must be in the same region and zone.
Network type
VPC
VPC
Both instances must be in the same VPC.
CPU and memory
16 cores, 128 GB
Specifications: 8 cores, 32 GB
Disk space: 200 GB
N/A
Instance family
ecs.hfr6
General-purpose
Instance type
ecs.hfr6.4xlarge
dds.sn4.2xlarge.1
Storage type
ESSD
ESSD
Image or engine version
Alibaba Cloud Linux 3.2104 LTS 64-bit
MongoDB 4.0
Add the primary private IP address of the ECS instance to the whitelist of the ApsaraDB for MongoDB standalone instance. For more information, see Configure a whitelist for an instance.
Install the Yahoo! Cloud Serving Benchmark (YCSB) tool on your ECS instance. For more information about how to install and use YCSB, visit the YCSB GitHub repository.
Procedure
Log on to the ECS console and connect to your ECS instance. For more information, see Connect to an ECS instance.
Run the following command to load data into the ApsaraDB for MongoDB standalone instance.
./bin/ycsb load mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=30000000 -p mongodb.url="mongodb://root:123456Aa@dds-bp13e84d111a1a****.mongodb.rds.aliyuncs.com:3717/admin" -threads 8Replace the following parameters with your actual values:
123456Aa: The password of the root account for the ApsaraDB for MongoDB standalone instance.dds-bp13e84d111a1a****.mongodb.rds.aliyuncs.com:3717: The connection endpoint of the primary node for the ApsaraDB for MongoDB standalone instance.NoteYou can find the connection endpoint in the Internal connections - VPC section on the Database connections page of the ApsaraDB for MongoDB console.
Start the YCSB processes to perform read and write tests for different scenarios.
Scenario
Test command
Description
8 concurrent operations
./bin/ycsb run mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=30000000 -p operationcount=50000000 -p readproportion=0.5 -p updateproportion=0.5 -p requestdistribution=zipfian -p mongodb.url="mongodb://root:123456Aa@dds-bp13e84d111a1a****.mongodb.rds.aliyuncs.com:3717/admin" -threads 8Replace the following parameters with your actual values:
123456Aa: The password of the root account for the ApsaraDB for MongoDB standalone instance.dds-bp13e84d111a1a****.mongodb.rds.aliyuncs.com:3717: The connection endpoint of the primary node for the ApsaraDB for MongoDB standalone instance.NoteYou can find the connection endpoint in the Internal connections - VPC section on the Database connections page of the ApsaraDB for MongoDB console.
2,000 concurrent operations
./bin/ycsb run mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=30000000 -p operationcount=50000000 -p readproportion=0.5 -p updateproportion=0.5 -p requestdistribution=zipfian -p mongodb.url="mongodb://root:123456Aa@dds-bp13e84d111a1a****.mongodb.rds.aliyuncs.com:3717/admin" -threads 200010,000 concurrent operations
./bin/ycsb run mongodb -s -p workload=site.ycsb.workloads.CoreWorkload -p recordcount=30000000 -p operationcount=50000000 -p readproportion=0.5 -p updateproportion=0.5 -p requestdistribution=zipfian -p mongodb.url="mongodb://root:123456Aa@dds-bp13e84d111a1a****.mongodb.rds.aliyuncs.com:3717/admin" -threads 10000Monitor the number of connections to the ApsaraDB for MongoDB standalone instance.
Navigate to the Replica set instances page. In the top navigation bar, select the resource group and region, and then click the ID of the target instance.
In the left-side navigation pane of the instance details page, click Monitoring Data.
On the Basic monitoring tab, select a time range and view the CPU utilization (%), QPS, and connections metrics for the instance.
Test results
An ApsaraDB for MongoDB standalone instance with 8 cores and 32 GB of memory can handle 10,000 connections.
Connections to an instance consume CPU resources. Keep the number of connections within an appropriate range to manage CPU consumption.
Once the number of concurrent operations reaches a certain threshold, CPU utilization and QPS plateau. Therefore, control the number of concurrent operations based on your business requirements.