Performance issue loading data into MongoDB

I want to add 3 things.

Field names

Field names are part of each JSON/BSON documents so in this case to reduce the amount of data sent and stored, you may want to use user and team rather than username and teamnumber.

The field hash

If the hash field is only present to be able to use an hash shard key, you could remove it and let the system hash user and team. Like I mentioned earlier, I think you incur the cost of computing the hash even if you supply a field that is a hash value.

Day to day use-cases

Loading the data in the system is one use-case. Before throwing out your shard setup you should consider your day to day use-cases, which are probably more important to optimize. Would your typical queries better served on a monolithic server or shard server? This shard key also has impact on you day to day use-cases. With a hash shard key you end with most queries being a scatter/gather.

1 Like