ASP. NET Website optimization database optimization measures use master/Slave databases (on)

Source: Internet
Author: User

After the website scale reaches a certain level, the score is also divided, and the optimization is also optimized, but it still cannot meet the performance requirements of the business. At this time, we can consider using the Master/Slave database.

The master-slave database is two databases on two servers. The master database performs addition, deletion, modification, and query of the latest data at the fastest speed. The slave database is responsible for querying older data, do some analysis that requires less effectiveness and report generation. In this way, the database pressure is shared to the two servers to ensure the timeliness of the system response.

SQL Server provides a replication mechanism to help us implement the master-slave database mechanism. Let's take a look at how to practice SQL Server 2005:

Before practice, you need to create a new test database, which creates a test table.

1. Open the SQL Server Enterprise Manager, select copy local release in the object Resource Manager, right-click to choose new release
 

2. Open the new release wizard, click Next, and select the database for data release.

 
3. Select the test database, click Next, and select the release type.
 
Here we choose transactional publishing, which ensures that data is distributed to the subscription server as quickly as possible after updates. For Use Cases of several other release types, see msdn
4. Click Next and select the object to be released. Here we only release the table.
 
5. Click "Next" to filter data settings. Here we will copy all the data in the table, so we will not set it.
 
6. Click Next to specify when to run the snapshot. We will select the initial session data and the default running snapshot frequency.
 
7. continue to the next step. Set the account for running the snapshot agent. Select SQL Server Agent account.
 
8. Click "Next" and select "create release". Click "Next" to set the release name.
 
9. Click "finish" to complete the release settings and create a release. Now we have added a new release to the local release.
 

Now we have successfully created a release. We also need to create a subscription: Right-click the local subscription folder and choose create subscription. You can easily create a subscription through the wizard, when creating a subscription, you can choose to create it by means of publisher push or subscriber initiative. The procedure is as follows:
1. Right-click the menu to open the new subscription, click Next, and select the release we just created as the subscription source.


2. choose whether to synchronize data through push or proactive requests.
 
3. Set the account for executing the distribution agent
 
4. Set the synchronization frequency of proxy requests
 
5. Set whether to initialize data immediately.
 
6. Complete subscription Creation

After creation, We can insert n pieces of data into the master database table, and then verify whether the replication is successful by querying from the database.

Replication in SQL server2005 is easy to create. We need to set the replication type and synchronization Frequency Based on business needs. Next we will talk about how to effectivelyProgramUse the master-slave database.

Related essays:

ASP. NET Website optimization database optimization measures use master/Slave databases (below)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.