MongoDB Atlas Serverless Testing

Dhaval Nagar
AppGambit
Published in
4 min readJul 25, 2021

--

MongoDB recently launched the Atlas Serverless instances in the preview. The Serverless instances only need region as a base configuration.

[Driver Update] The updated NodeJS 4.1.0 drivers now allow you to connect to the MongoDB Atlas Serverless. Here is the full example — https://gist.github.com/dhavaln/cfc07aa6d1d7144ba6983fd2d3c5713c

The Serverless instance is billed based on the actual operations and storage. The pricing model is well-aligned with the Amazon DynamoDB pricing model.

Setup

MongoDB documentation shows that connectivity is possible from a number of languages like NodeJS, Python, and Java but I could not connect the instance through NodeJS 3.6 or 4.0 drivers.

[Driver Update] The updated NodeJS 4.1.0 drivers now allow you to connect to the MongoDB Atlas Serverless. Here is the full example — https://gist.github.com/dhavaln/cfc07aa6d1d7144ba6983fd2d3c5713c

The preview only supports AWS as a cloud provider and has limited regions.

The following tests are using the Python PyMongo latest drivers. The Lambda function and MongoDB Atlas Serverless both are in the AWS US-EAST-1 region.

Data Write

The write operations were clocking at 60–70 writes per second. The Lambda function pushed 10k records in each run with a cold start and it took ~161 average seconds to complete the writes.

Data Read

The read operations were showing double-digit latency with cold-start and almost single-digit latency with warm execution. This is given as both the Lambda function and the database is hosted into the same AWS region.

Reading 30k+ data in a single operation was taking consistently ~2 seconds.

Scaling

I didn’t scale the Lambda functions much but as per the documentation, Serverless instances can support up to 500 concurrent connections. Although at higher connections the overall throughput might have an impact.

Is It Good!!

MongoDB is a very popular database engine and I think the Serverless instance is a perfect example for the overall Serverless momentum.

While DynamoDB is one of the best choices for a Serverless NoSQL database, it is still (very) hard for many.

MongoDB Serverless instances will open up a new set of opportunities for serverless applications.

[UPDATE] Performance

I see some performance degradation on write queries with high throughput read queries.

Reading close to half a million data while writing 10k records.

[UPDATE] Billing

I ran the tests over two days and to see the cost utilization. To check the performance I made some heavy reads, crossed over 1 million reads in a short duration. You can see the write operation impact in the previous screenshot.

--

--

Dhaval Nagar
AppGambit

AWS Hero, 12x AWS Certified, AWS SME, Founder @ AppGambit