×

Sharding

Sharding is all about horizontal scaling which means adding more servers.

Single server or machine will not be able to handle read and write requests after a limit even if you increase GPU, CPU and memory etc.

In sharding, we have multiple computers which runs mongo server together.

Many computers or systems are there but only one mongo server.

They all will work together and data is distributed across those systems or computers or shards.

Queries run across all shards but that query will be processed by that shard which can process it.

How sharding works?

In the above diagram, mongo (router) functions using the shard key which is a field added to every document that is needed by the server to understand where the document belongs to.

Shard key configuration is not simple because shard key must be evenly distributed. It must be chosen wisely.

Query working with sharding

If find method contains shard key information then option 2 will be followed which is efficient one because it directly send the query to its unique shard.

But if you didn’t specify the shard key information then it will be distributed to all and responses will be given back.

So as a developer if you are using then you and your admin should choose shard key wisely on application needs.


Related Topics

Largest State of India

There are twenty-eight states and eight union territories in India. Each of these states and territories has its geographical location and population. In this article, we are going to look...

4 minutes read.

The Longest River in India

India is known as the "Land of Rivers" because of the many rivers run here. Himalayan Rivers, the rivers that originate in the Himalayas, and Peninsular Rivers, the rivers that...

6 minutes read.

Top 7 programming languages for backend web development

Web Development is primarily divided into two facets: front-end and back-end development. They each have their own set of technology and tools. For instance, when discussing front-end development, HTML, CSS,...

4 minutes read.

Interesting Facts about Computers

Computers have gained enormous value in the modern world since their introduction. According to the experts, businesses would have found it difficult to operate in the manner they do in...

3 minutes read.

List of Cricket World Cup Winners

Introduction Cricket is one of the games, the craze of which is unbeatable. Love for cricket can be seen amongst children, teenagers and even adults. The craziness and love are not...

9 minutes read.

What is Competitive Programming?

Competitive programming is a technique that makes you a master in coding. Competitive programming provides some advantages. These advantages are as follows: It helps us in getting a job. It also improves...

6 minutes read.

Examples of Biodegradables Waste

Biodegradability and Examples of Biodegradable Waste Understanding biodegradability is important if you want to know what happens to the trash when it enters our trash cans. The process by which bacteria naturally...

4 minutes read.

List of Antibiotics

Introduction Antibiotics deal with bacterial infection by killing micro-organisms or preventing reproduction and spread. Antibiotics are poor against viral illnesses, such as the common cold, flu, severe coughs, and sore throats....

7 minutes read.

List of Presidents in India

Introduction After years of colonized British control, our country was eventually able to break free in 1947. The year of independence, 1947, was when the entire country came together into a...

5 minutes read.

List of Countries and Capitals

Introduction The modern world is divided into several countries based on various historical and political reasons. Some countries in the modern world have democracy, monarchy, dictatorship, etc. All these countries have...

4 minutes read.

Top Programming Languages for Android App Development

Our daily lives are completely dependent on smartphone apps.They can be utilized to establish contacts, gather information,or just have fun. While developing a mobile app is entertaining as well, it...

5 minutes read.

List of Food Items

Food is an integral part of our life. It is required not just for human beings for their survival but also for other living organisms. Some people say they live...

14 minutes read.

Best Tech Movies That Every Programmer Must Watch

Every person lives their life as if it was a movie, and every programmer enjoys viewing their work lives through the lens of films. Hollywood, as we all know, is...

4 minutes read.

List of South American Countries

South America got its name because it encompasses the whole southern portion of the supercontinent of the Americas. The Pacific Ocean encircles it on its western side, the Atlantic Ocean...

8 minutes read.

Highest Waterfall in India

India's waterfalls are among the world's most well-known tourist spots. They are ideal places for spending and enjoying the true glory of the natural world due to their freshness, sound,...

4 minutes read.

Top 5 Programming Languages for Backend Development

What is Backend Development? As we all know that a website has two important components, which are frontend and backend. The frontend is the part where the user directly interacts with and...

3 minutes read.

List of Colleges in Pune

About Pune: Maharashtra's state capital is the city of Pune. It is a city formerly known as Poona, where the rivers Mutha and Mula converge. Additionally, it receives the moniker "Queen...

20 minutes read.

What is a Burp Suite?

A set of tools for web application penetration testing is called the Burp Suite. It was created by a business called Portswigger, which is also the alias of the company's...

4 minutes read.

How to become a software engineer

Software developers, also known as software engineers, develop innovative software for clients and businesses. From a personal banking app to a business project management workflow system, many of the essential...

3 minutes read.

Top 15 Popular Data Warehouse Tools

A data warehouse is a data management system for data reporting, analysis, and storage. It serves as the main basic business intelligence foundation and is also an enterprise data warehouse....

11 minutes read.