Nginx + IIS implements Load Balancing Session multi-site sharing and nginx Load Balancing

Source: Internet
Author: User
Tags nginx server nginx load balancing

Nginx + IIS implements Load Balancing Session multi-site sharing and nginx Load Balancing

The days have been too boring. I studied the so-called load balancing (mainly under windows Server IIS ). Let's take a look at the analysis diagram:

Environment:
Linux Server: centos 6.3
Windows server: windows server 2012 IIS 8.5
Database: SQL Server 2008 R2

I deployed nginx on centos for load balancing, and put two sites A and B on IIS (this design is unreasonable, it should be A server with A site, multiple application servers are deployed on the same site, but I really don't have many servers. The principle of deploying multiple sites on one IIS is similar to that on multiple IIS .) For multi-site shared sessions, I use the simplest session database provided by Microsoft.
First, deploy nginx. For more information, see <cloud platform development architecture Analysis Series 8: Nginx server first use guide ". Then, open VS2010 and create two web projects, then put it on IIS. For detailed deployment, see IIS deployment ASP. net mvc Project
Then we add the ASPStat database to SQL Server 2008 on windows Server, open the windows Server, and find aspnet_regsql.exe (under Framework64)
We can find the path of aspnet_regsql.exe, open the path with cd in cmd, and execute the command:

aspnet_regsql.exe -S . -u sa -p password p

Then create the ASPStat Database
Then we configure in web. config:

<sessionState mode="SQLServer" sqlConnectionString="Data Source=xxxxx; User ID=sa; Password=xxxxxxx;">  </sessionState>  <machineKey decryption="AES" decryptionKey="869BF3D585F39B25C032E42A51B9C8C6DBA5CAE6EEB6DC48,IsolateApps" validationKey="6080AA874E125C595E4A5986A754ABC67BC5D10DC39CCE2BBE0A1AF5B61D3E03C6BD5C97A812F6E160F37337EEEE2C27619A3B18C84A26D5BB417CA8969EF9F3,IsolateApps"/>

After the configuration, we can see the session information in the session database.
Next, let's test. First, I access the site on IIS in the browser:



In the session database:

Firefox browser testing:



In the session Database

The multi-site session sharing is indeed implemented, but this design performance is not good in the actual project. We recommend that you use redis and memcached to store sessions better. net's third-party session interface is also doing well.

Refer:

Simple Load Balancing using nginx and IIS

Nginx + IIS + Web Front-end (Spring MVC) -- Load Balancing (2)

Nginx load balancing, multi-site sharing Session

Asp.net multi-server Session sharing


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.