Those are interesting stats. I think you might be suffering from document size growth in your updates, where the document needs to be copied to a new spot on the disk. If this is indeed the case, you might be able to recover some of that lock percentage by manually padding your documents. It adds a bit more complexity on the first insert, but isn't too bad. See this document from the official docs: http://www.mongodb.org/display/DOCS/Padding+Factor#PaddingFactor-ManualPadding
Just an idea...
The delay you are seeing when loading from a snapshot is not cause by how indexes are laid out on disk, it's far more likely that you are seeing the delay because when you start an instance from a snapshot, the data is loaded only on first use, and will be significantly slower than subsequent uses - that is a basic limitation of using snapshots in this way and really has little to do with the application that is trying to access disk. That's why you will see guides on "how to warm up an EBS volume" and the like (there are penalties on writing for the first time too). If you do that (warm up the disk with another application like dd
for example) and the performance issue goes away, then you have pretty decent proof that the layout of data has nothing to do with the issue.
Along those lines, MongoDB has the touch command that will allow you to warm up the data before you use it in anger (you can touch data, data and indexes or just indexes). Again, after you initially attach the volume, it will be slow, and touch is going to take a while, but at least after that warming up phase, your results should be somewhat consistent.
In terms of how things are stored on disk, you have the basics correct in terms of file allocation but there is a logical structure within the files, extents, that are the real units of storage. That and far more is covered in detail by this presentation by Mathias Stearn - one of the kernel developers at MongoDB.
Indexes are just another (structured) form of data in MongoDB and they are stored in linked extents throughout the file. Fragmentation can become an issue (that's what the compact command is for) as can disk space used (the repair command is used to reclaim) but you haven't described a workload that would immediately make me think you are hitting a fragmentation issue which is why I suspect something else (like the first use penalty) is your root cause.
Best Answer
what exactly are you trying to accomplish? do you want to have all db on another machine?
then you have to use these export and import it
you can also use --collection , -c for exporting/importing individual collections