i have just reading MongoDB.came across sharding but not getting what exactly is it .watever i understood is its better to have more small servers than a huge one for data storage and when data exceeds capacity of one server you can use another machine to store data.can anyone give soem more idea about sharding?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
In a database a shard is when you break up a set of data across multiple servers. So for example if you had users could you put those with a name starting with A-E on one, server, F - K on a second and so on. That way the load of dealing with the operations on those users will be broken up across several servers. The reason you want to do this is because it is possible that you have too many users to put them all on one machine. By doing this it is possible to scale the system as large as you need by just adding more shards. If everything was one one server then you would be limited in scale to how big a server you can buy.
Of course you don't really want to break it up by letters of the alphabet you would want to use something that would on average make each shard have an approximately equal share of the work, but that is a detail (If an important one)