In a typical web server / database scenario, db is almost always guaranteed to boot the machine first. This is due to the fact that data storage requires more resources. Before you start looking at load balancing on your web server, you need to think about how to load the database balance.
Distributing a single database across multiple servers is much more complicated than balancing the load on a web server. One method that you can use is sharding (or horizontal splitting). Here, some records are stored on one server, and other records on another server. For example, records with identifier 1-900000 are on server 1 and records 900001- are on server 2.
Compared to database load balancing, load balancing across multiple ASP.NET servers is not overly complex. Most session problems can be easily mitigated by using a processing session and / or never talking directly to Application.Cache . On the other hand, balancing data load is complex and requires a lot of planning, trial and error. In most cases, talking to a load-balanced database requires the use of an ORM that supports it (for example, NHibernate) or your own level of data access. The reason is that you need to remove the connection from the code that uses the database, so the solution the database is talking to is processed in one place.
Igor Zevaka
source share