We have a collection with about 121 million documents that results in following stats.
{
"ns" : "my_collection",
"size" : 499941088660,
"count" : 121981837,
"avgObjSize" : 4098,
"storageSize" : 178798247936,
"capped" : false,
"nindexes" : 1,
"totalIndexSize" : 1713725440,
"indexSizes" : {
"_id_" : 1713725440
},
"ok" : 1
}
We are trying to create an index on an existing field that all documents have. For trying this out, we have created an isolated mongo instance with following specs:
VM Spec: n1-highmem-8 (8 vCPUs, 52 GB memory) -- Google Cloud
Disk: 500GB SSD with random IOPS limit at 15000/15000 (read & write each) and max throughput at 240 MB/S.
Index creation seems to running very slow (by our estimate it would take to a day or two).
We tried different values for maxIndexBuildMemoryUsageMegabytes
(default 500, 800, 1000, 5000, 10000, 30000) But this didn’t seem to affect the speed. (Even with high values here, VM still had free memory apart from used + cache, so we believe it didn’t cause insufficient working set memory leading to higher disk I/O).
Checking on iotop
, we noticed reads happening (avg 10MB/S) but almost no writes.
Are there any other parameters we should be looking at?