Web server processing in the Server Load balancer Environment

Source: Internet
Author: User
Tags how to use sql server how to use sql

The server Load balancer device allows you to easily expand a web server to a Web server cluster (provided that all Web servers must be configured completely the same, the device will send the request accordingAlgorithmTo a server in the web server cluster, which greatly increases the concurrent processing capability of the Web server.

In practical applications, multiple Web servers are usually deployed in the same data center and can be accessed from each other through a LAN.

1. file synchronization problems:

The website files on multiple Web servers must be identical. Otherwise, the content of pages accessed by the user's two requests may be different. Therefore, file synchronization is the primary concern.

Several common methods are introduced here:

A.Batch files + scheduled tasks: batch files use the DOS command to copy files in the LAN, and then the BAT files are automatically executed at a certain time in the scheduled task.

This method is suitable for application environments that are not updated frequently. If file updates are required to be updated in real time, this method will not work.

B.Using ready-made file sync software: there are some good file sync software available on the market, just use it directly. (Some powerful software supports two modes: timed synchronization and real-time synchronization)

C.If you want to DIY, you can actually use it. in. net, the filewatcher class can conveniently implement file synchronization by monitoring files in the source site directory. In addition, this method is flexible and can be implemented in real time or at regular intervals (completely controlled by developers ).
For examples of filewatcher usage, see my other blog: http://www.cnblogs.com/yjmyzz/archive/2009/06/07/1498221.html (using filewatcher for real-time file Monitoring)

2. Session Processing

By default, session is in inproc mode, that is, session is stored on the server where the website is located, so session synchronization on multiple servers is also a problem. This ASP era may be troublesome, but fortunately. net starts from 2.0 and allows sessions to be stored on a specific server or even a database. No matter how many web servers are there, all sessions can be stored in a dedicated database server.

The following describes how to use SQL Server as an example:
A.Stop IIS service first, enter net stop W3SVC or iisreset/stop in cmd environment (this step looks optional, see http://support.microsoft.com/kb/317604 for details)

B.Open the database and run \ winnt \ Microsoft. NET \ framework \ (. NET version) \ installsqlstate. SQL to configure the session database.

C.Modify the Web. config configuration of the website as follows:
<Sessionstate mode = "sqlserver" sqlconnectionstring = "Data Source = Server IP address; user id = ***; Password = ***; "cookieless =" false "timeout =" 20 "/>

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.