Windows platform Web site Picture Server architecture Evolution

Source: Internet
Author: User
Tags relative backup

Websites built on Windows platforms are often considered "conservative" by many architects in the industry. A large part of the reason is due to the closure of Microsoft's technology system and the myopia of some technical personnel. Because the long-term lack of open source support, so can only "behind closed doors", so it is easy to form the limitations of thinking and short board. Take picture Server For example, if there is no capacity planning and scalable design, then with the increasing picture files and the increase in traffic, due to performance, fault tolerance/disaster tolerance, scalability and other aspects of the design, the follow-up will be to the development, operation and maintenance work brings many problems, Serious even affect the normal operation of the website business and the development of Internet companies (this is not alarmist).

The choice of a Windows platform to build Web sites and picture servers is largely determined by the technical background of the founding team, and early technicians may be more familiar with. NET, or the person in charge thinks windows/. NET ease of use, "Chanping" development model, the cost of human resources are more in line with the early start of the team, naturally chose windows. Later business development to a certain scale, it is difficult to easily transfer the overall structure to other platforms. Of course, for the construction of large-scale internet, the preferred open source architecture, because there are a lot of mature cases and open source ecosystem support, to avoid duplication of wheel-making and expense authorization costs. For the migration of more difficult applications, compared to recommend Linux, Mono, Mysql, memcahed ... A mix-and-match architecture can also support high concurrent access and large data volumes.

Image server architecture in stand-alone era (centralized)

The start-up period due to time constraints, the level of developers are also very limited, and other reasons. Therefore, usually directly in the directory where the website file, create 1 upload subdirectories, to save the user uploaded image files. If subdivided by business, it can be differentiated by establishing different subdirectories in the upload directory. For example: Upload\qa,upload\face and so on.

A relative path such as "Upload/qa/test.jpg" is saved in a database table.

The user accesses the following methods:

Http://www.yourdomain.com/upload/qa/test.jpg

program upload and write mode:

Programmer a writes the file by configuring the physical directory D:\Web\yourdomain\upload in Web.config and then through the stream;

Programmer B obtains the physical directory based on relative paths and then writes the file through the stream, Server.MapPath, etc.

Advantages: The simplest implementation, without any complex technology, can successfully write the user uploaded files to the specified directory. It is also convenient to save database records and access.

Disadvantage: The way of uploading is messy, which is bad for the expansion of website.

For the most primitive architectures mentioned above, the following problems are mainly faced:

With more and more files in the upload directory, the partition (for example, D disk) is difficult to expand if there is insufficient capacity. Replace the larger capacity storage devices only after downtime, and then import the old data.

When you deploy a new version (by requiring a backup before deploying a new version) and daily backup website files, you need to manipulate the files in the upload directory at the same time, if you consider the increase in traffic, a load-balanced cluster of multiple Web servers that is deployed behind. It is difficult to do real-time synchronization of files between cluster nodes.

Image server architecture in cluster era (real-time sync)

Under the website site, a new virtual directory named upload, because of the flexibility of the virtual directory, to a certain extent to replace the physical directory, and compatible with the original image upload and access methods. The way users access is still:

Http://www.yourdomain.com/upload/qa/test.jpg

Advantages: More flexible configuration, but also compatible with the old version of the upload and access methods.

Because of the virtual directory, you can point to any directory under any local letter. As a result, the capacity of a single machine can be expanded by accessing external storage.

Disadvantages: Deployed into a cluster composed of several Web servers, each Web server (the cluster node) between (under the virtual directory) need to synchronize files in real time, due to the synchronization efficiency and real-time constraints, it is difficult to ensure that at a moment the files on the nodes are exactly the same.

The basic architecture is shown in the following illustration:

As you can see from the figure above, the entire Web server architecture is already "scalable, highly available," and the main problems and bottlenecks are focused on file synchronization between multiple servers.

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.