2

I am using command as

mongoimport -h m3 -d staging -c coll --upsert --upsertFields name < part1

I have mongoDB 64-bit installed on one machines, this is what I see in terms of upserts

        1300    433/second
        1900    316/second
        2400    266/second
        2800    233/second
        3100    206/second
        3400    188/second
        3700    168/second
        4000    160/second
        4200    150/second
        4400    141/second
        4600    135/second
        4800    129/second
        5100    124/second
        5300    120/second
        5500    117/second
        5700    114/second
        5900    109/second
        6100    107/second
        6300    105/second
        6500    101/second
        6700    100/second
        6900    97/second
        7100    94/second
        7300    92/second
        7500    90/second
        7700    88/second
        7900    86/second
        8000    85/second
        8200    83/second
        8400    81/second
        8600    80/second
        8700    79/second
        8900    77/second
        9100    75/second
        9300    74/second
        9500    73/second

and it goes much bad to almost 32/sec. My collection is initially empty

How can I increase the insert/upsert per second?

2
  • Do you have an index on name? If not, add one.
    – JohnnyHK
    Commented Dec 16, 2012 at 17:28
  • I added one and I get around 550/sec. Thanks
    – daydreamer
    Commented Dec 16, 2012 at 18:09

1 Answer 1

3

You could add an index on the field you're querying for, in the upsert.

This would improve the updates.

But it won't do it for the inserts. Anyway inserts are cheep and for an overall improvement in performance you could increase the RAM. (MongoDB is known to use a lot of RAM, and if the task exceeds the available RAM the performance will drop by a lot)

1
  • 1
    This came to my mind quickly and I tried adding index to my collection db.coll.ensureIndex({'name': 1}) and the inserts increased to 550/sec, thanks a lot for your help though
    – daydreamer
    Commented Dec 16, 2012 at 18:08

Not the answer you're looking for? Browse other questions tagged or ask your own question.