M102 WEEK 6 QUIZ

Question: A field that has the boolean of value of either true or false would make for a good shard key:

  • True
  • False (Ans)

Question: It is possible to configure the size of each chunk which affects when they will be split. A large chunk size means chunks will be split less often as each chunk needs to grow larger before it is split, and a small chunk size means they will be split more often, for instance. Which of the following statements are true regarding a very small chunk size configuration as compared to a large chunk size configuration? Check all that apply.

  1. Fewer migrations would have to take place
  2. More migrations would have to take place (Ans)
  3. Each shard would be very balanced in terms of how much data they contain (Ans)
  4. Each server would be very balanced in terms of how much data they contain
  5. There is no difference in terms of migration and shard server balance

Question: db.foo.find(
{ name : { $gt : “Joe”, $lt : “John” } } )
is efficient if the collection is sharded on { name : 1 }

  • True (Ans)
  • False

Question: How many mongos processes should you run (generally)?

  1. One per config server
  2. One per mongod process
  3. One per shard
  4. One
  5. However many you want but usually much more than one (Ans)

Question: Which are false?

  1. Check via the mongo shell what’s in the config database of a MongoDB cluster, you must connect it directly to one of the config servers.
  2. Three config servers is typical in a MongoDB cluster with 1,000 total machines. (Ans)
  3. All the config servers have exactly the same data. (Ans)

Question: In MongoDB v2.6, by default (i.e., if shardCollection hasn’t been invoked) collections are:

  1. On the primary shard and not sharded (Ans)
  2. Not sharded but homed on different shards at random
  3. Automatically sharded on _id

Question: Your shard key for the people collection is { friends : 1, name : -1 }. You also have an index on { name : 1, phoneNumber : 1 } Which of the following queries will definitely be scatter gather queries?

  1. db.people.find( { name : “Alice” } ) (Ans)
  2. db.people.find( { friends : “Bob”, phoneNumber : “555-123-4444” } )
  3. db.people.find( { name : “Catherine”, phoneNumber : “555-123-4444” } ) (Ans)
  4. db.people.find( { friends : “Doug”, name : “Emily” } )
  5. db.people.find( { hobbies : “beekeeping” } ) (Ans)

Question: Suppose we are building an email server system and have a collection:
messages
——–
{_id:<message_id>, mailbox_id:___,
sender_id:___, subject:___, date:___,
body:___, read:<bool>, …
}
We have millions of users (email addresses / mailboxes) so want to shard this collection. Of the choices listed, what’s a good shard key?
Choose the best answer:

  1. {_id:1}
  2. {mailbox_id:1} (Ans)
  3. {sender_id:1}
  4. {sender_id:1,read:1}

Question: If I have 3 shards, 3 member replica sets, 3 config servers, and 6 mongos processes running, how many machines might we use for that?
Choose the best answer:

  1. While we could use more if we wanted, 9 machines would be just fine. (Ans)
  2. 9 machines works but is too low for best practice usage

Question: Generally speaking, shard keys with non-uniform key distributions are:
Check all that apply:

  1. Ok (Ans)
  2. Ok only if you “pre-split”
  3. Not ok

Leave a Reply

Your email address will not be published. Required fields are marked *