Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-31020

Sharding database creation is slow because of shard disk-usage statistics gathering

    XMLWordPrintable

Details

    • ALL
    • Hide

      use anthony110920175
      db.test.insert({test:true})
      

      Show
      use anthony110920175 db.test.insert({test:true})

    Description

      Hi team,

      We are using a 10 shards (Primary / Secondary / Arbiter) cluster to host around 20k databases.
      We noticed that creating new databases take lot of time, around 10s :

      2017-09-11T09:48:52.763+0000 I SHARDING [conn641] distributed lock 'anthony110920175' acquired for 'createDatabase', ts : 59b65c04bb2f983e7e106b2c
      2017-09-11T09:49:02.438+0000 I SHARDING [conn641] Placing [anthony110920175] on: clust-1-sh1
      2017-09-11T09:49:02.448+0000 I SHARDING [conn641] distributed lock with ts: 59b65c04bb2f983e7e106b2c' unlocked.
      

      It looks like a

      db.runCommand({listDatabases:1})
      

      is launched on all shard, one by one, before creating the database on the config servers. This command take arount 1s per shard.
      Adding the "nameOnly:true" option make the query almost instantaneous. Maybe it should be added when a mongos check database existency ?

      Regards,
      Anthony

      Attachments

        Issue Links

          Activity

            People

              backlog-server-sharding-emea Backlog - Sharding EMEA
              anthony@sendinblue.com Anthony Brodard
              Votes:
              0 Vote for this issue
              Watchers:
              12 Start watching this issue

              Dates

                Created:
                Updated: