Skip to content

kizzx2/mongolab

master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 

mongolab

Example source code for the blog post Slow batch insert with MongoDB sharding and how I debugged it

Usage

sh mongolab.sh

# Default settings -- verify that sharding+batch insert is slow
mongo localhost:37017/shard_test test.js

# Default settings -- verify that non-sharding+batch insert is fast
mongo localhost:47017/shard_test test.js

# Change test.js to run sequential and/or using the rnd key

Test Results

Time in ms (lower is better):

                        | No-Shard   | No-Shard (with `rnd`)   | Shard `{ id: "hashed" }`   | Shard `{ rnd: 1 }`   

----------------------------|------------|-------------------------|----------------------------|---------------------- Batch insert | 640 | 740 | 21038 (!) | 1004
Normal (sequential) insert | 1404 | 1468 | 1573 | 1790

About

Example source code for the blog post "Slow batch insert with MongoDB sharding"

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published