How to use code and habits to improve the site's concurrent access performance and some of their own doubts

Source: Internet
Author: User
Tags domain name server

Recent company because of website concurrency problem. to version. NET into PHP. Although I am not satisfied, but people say slightly ╮(╯▽╰)╭. Long Story

The concurrency performance of the site is low. Have a fur ball relationship with language?!

Specifically to Baidu a bit, about how to improve the website concurrency performance problems. Add some of your own insights here. Everybody take a look. Pat on the tap.

Please look at the Niang on the first to get the Daniel answer:

1, HTML Static In fact, we all know that the most efficient, the least expensive is the pure static HTML page, so we try to make the page on our site using static pages to achieve, the simplest method is actually the most effective method. But for a lot of content and frequently updated sites, we can not all manually to achieve, so we have a common information distribution system CMS, like we often visit the various portals of the news channel, and even their other channels, are through the information distribution system to manage and implement,  Information Publishing system can achieve the simplest information input automatically generated static pages, but also with channel management, rights management, automatic capture and other functions, for a large web site, has a set of efficient, manageable CMS is essential. In addition to the portal and the type of information publishing site, for the interactive requirements of the Community type site, as much as possible static is also to improve the performance of the necessary means, the community posts, articles in real-time static, updated time and then re-static is a lot of use of the strategy,   A hodgepodge like mop is the use of such strategies, such as the NetEase community. At the same time, HTML static is also the use of some caching policies, for the system frequently using database queries but the content of small updates, you can consider the use of HTML static to implement. For example, forums in the Forum's public settings information, the current mainstream forum can be managed backstage and stored in the database, which is actually a large number of reception program calls, but the update frequency is very small, you can consider this part of the background update the time to static, so as to avoid a large number of database access requests. 2, Image server separation you know, for the Web server, whether it is Apache, IIS or other containers, the picture is the most consumption of resources, so we need to separate the picture and the page, which is basically a large web site will adopt the strategy, they have independent, Even a lot of picture servers.  Such architectures can reduce the pressure on the server system that provides page access requests and ensure that the system does not crash due to picture problems. In the application server and picture server, can be different configuration optimization, such as Apache in the configuration of contenttype can be as little as possible to support, as few loadmodule, to ensure higher system consumption and execution efficiency. 3, database cluster, library table hashing large sites have complex applications, these applications must use the database, then in the face of large-scale access, the bottleneck of the database can be quickly revealed, then a database will soon be unable to meet the application, so we need to use the database cluster or library table hash. In the database cluster, many databases have their own solutions, Oracle, Sybase and so on have a good solution, the common MySQL provided by the master/slave is a similar scenario, you use what kind of db, you can refer to the corresponding solution to implement.  The database cluster mentioned above is constrained by the DB type used in architecture, cost, and extensibility, so we need to consider improving the system architecture from the perspective of the application, and the library table hashing is the most common and effective solution. We install the business and application in the application or function module to separate the database, different modules corresponding to different databases or tables, and then according to a certain policy on a page or function of a smaller database hash, such as the user table, according to user ID for the table hash,  This makes it possible to improve the performance of the system at a low cost and has a good scalability. Sohu Forum is the use of such a framework, the Forum users, settings, posts and other information database separation, and then to the post, the user in accordance with the plate and ID hash database and table, finally can be configured in the configuration file simple configuration will allow the system at any time to add a low-cost database to supplement the system performance. 4, Cache caching the word technology has been touched, many places use the cache. Caching in the Web site architecture and Web development is also very important. Here we first describe the two most basic caches.  The advanced and distributed caches are described later.   Architecture cache, people familiar with Apache can know that Apache provides its own cache module, can also use the addition of Squid module for caching, both of which can effectively improve the access response of Apache. Web application development cache, the memory cache provided on Linux is a common cache interface, can be used in web development, such as Java development can call MemoryCache to some data caching and communication sharing, some large communities use such a framework. In addition, in the use of web language development, all kinds of languages have their own cache modules and methods, PHP has pear cache module, Java more,. NET is not very familiar with, I believe there is certainly. 5, mirror image is often used in large-scale web site to improve performance and data security, the mirror technology can solve the different network access providers and geographical user access speed differences, such as the difference between chinanet and edunet prompted a lot of websites in the education network to build mirror site, Data is scheduled to be updated or updated in real time. In terms of mirror detail technology, this is not too deep, there are many professional ready-made solution architectures and products to choose from. There are also inexpensive ways to implement software, such as the tools of Rsync on Linux. 6, load balancing load balancing will be a high-end solution for large web sites that address high-load access and a large number of concurrent requests. Load balancing technology has developed for many years, there are many professional service providers and products can be selected, I personally contacted a number of solutions, including two architecture can give you a reference. (1), the hardware layer four switch layer fourth switch uses the header information of the third layer and fourth layer packets, according to the application interval to identify the business flow, the entire interval segment of the business flow is allocated to the appropriate application server for processing. The layer fourth switch function is like a virtual IP, pointing to the physical server. It transmits services that comply with a variety of protocols, such as HTTP, FTP, NFS, Telnet, or other protocols. These operations are based on physical servers and require complex load balancing algorithms.  In the IP world, the business type is determined by the terminal TCP or UDP port address, and the application interval in layer fourth switching is determined by the source and endpoint IP addresses, TCP, and UDP ports. In the hardware four-layer switching product area, there are some well-known products to choose from, such as Alteon, F5, etc., these products are expensive, but value for money, can provide very good performance and very flexible management capabilities. "Yahoo China" at the beginning of nearly 2000 servers, only the use of three or four alteon will be done. (2), software four-layer exchange when you know the principle of the hardware four layer switch, the software four layer exchange based on the OSI model comes into being, so the solution is the same, but the performance is slightly worse.   But to meet a certain amount of pressure or comfortable, some people say that the software implementation is actually more flexible, the ability to handle the full look at your configuration of the familiar ability. Software four-layer switching we can use the common LVS on Linux to solve, LVs is Linux Virtual Server, he provides a real-time disaster response based on the Heart Line heartbeat solution, improve the system robustness,  At the same time, the flexible virtual VIP configuration and management functions can meet a variety of application requirements, which is necessary for distributed systems.  A typical use of load balancing strategy is to build a squid cluster on the basis of software or hardware four-layer switching, which is adopted on many large Web sites including search engines, which have low cost, high performance and strong extensibility, and it is easy to add or subtract nodes to the architecture at any time. For large web sites, each of the previously mentioned methods may be used at the same time, here is relatively simple introduction, the implementation of a lot of details in the process need to be familiar with and experience. Sometimes a small squid parameter or Apache parameter setting can have a significant impact on system performance. 7, Latest: CDN Acceleration Technology What is a CDN? The full name of the CDN is the content distribution network.   The goal is to add a new layer of network architecture to the existing Internet, publish the content of the site to the "Edge" of the network closest to the user, so that users can get the content they need and improve the responsiveness of users to the site. A CDN is different from mirroring because it is smarter than mirroring, or it can be used as a metaphor: CDN= more intelligent Mirror + cache +flow Diversion. Therefore, CDN can obviously improve the efficiency of information flow in Internet network. From the technical comprehensive solution due to network bandwidth is small, user access is large, dot distribution is not equal problem, improve the response speed of users to visit the site.  CDN Type features the implementation of CDN is divided into three categories: mirroring, caching, and leased line. Mirror sites (Mirror site), which are the most common, allow content to be published directly for static and quasi-Dynamic Data synchronization. However, the cost of purchasing and maintaining a new server is high, and a mirror server must be set up in each region with professional technicians for management and maintenance.   For large web sites, the bandwidth cost of updating is also greatly increased. Cache, low cost, suitable for static content. Statistics on the Internet show that more than% of users often access the content of the 20% site, under this rule, the cache server can handle most of the client's static requests, while the original server only needs to process about 20%of non-cached requests and dynamic requests, which greatly accelerates the response time of customer requests and reduces the load on the original server.  CDN Services typically place cache servers on key nodes across the country. Dedicated line, allowing users to directly access the data source, you can achieve dynamic synchronization of data.   Examples of CDN For example, when a user visits a website, the site uses global load balancing technology to direct the user's access to a cache server that is closest to the user's work and responds directly to the user's request. When a user accesses a website that has already used a CDN service, the most important difference between the parsing process and the traditional parsing method is that the site's authoritative domain name server does not respond to the local DNS resolution request in the traditional polling mode, but takes full account of the location where the user initiated the request and the current network situation.  The decision to direct the user's request to a node cache server that is relatively light on the user's last load.  Through the combination of user location algorithm and server health detection algorithm, the user's request can be directed to a cache server distributed on the edge of the network to ensure the user's access can be more timely and reliable response. Since a large number of user accesses are directly responded by the CDN Node cache server distributed at the network edge, this not only improves the user's access quality, but also effectively reduces the load pressure of the source server. 
View Code

Well, in summary, it all seems to be a hardware solution. Too narrow a ~. These are not really what I want to care about. What I want to care about is what we need to pay attention to during the coding process, using our soft code to solve or avoid some of the problems caused by this advanced concurrency scenario.

1. Is there a concept of concurrency at the beginning of the program and how to deal with these events in the concurrency scenario? And keep the code robust and readable.

2. Why are there so many people doing projects with WebForm? I am very resistant to webform development. Most cases are directly ajax+ashx+ado.net. Of course I recently discovered the same mvc+ef as the new continent. Far, but the framework of the project is really important.

3. Bottom-level interaction. I'm looking at EF for the time being, I take the ADO. Separate SQL statement execution, after filtering out SQL injection, the feeling is really not fast. Of course. I came into contact with a new knowledge. Lock.

Http://www.cnblogs.com/qanholas/archive/2012/05/02/2479340.html

In the course of the project, I seldom consider this, it is probably my own experience and technical problems. Don't think about these things at all.

4. Look at the company concurrency of the site background code is very slag. Just for a query, table a modela table B modelb A and B are checked. This is how it is done in the program. Query to a result put in Modela,foreach Modela query B final result put into list. It was not calm at the time. ╮(╯▽╰)╭. In fact, the company site concurrency problem has been found. Isn't it?

I've been thinking about HTTP basics in recent days. Got a question. Hope to help me answer the small partners to help answer.

HTML static page Ajax submission or form submission-"Control Interface (ashx/asmx)--" ado.net/ef.

Disadvantage: Insufficient control over the page. HTML JS can not change the page source code, the search engine is not very friendly. Currently only one problem is found. Hope to help me to answer. My confusion.

Pros: Light ~~~~~~~ really super lightweight UI. As for the control+db. In fact, I feel, can change casually.

The problem is, after I looked at the MVC thing. Thought of. Am I this MVC? Why is MS MVC all that complicated? Tired or tired? --Can you crossing your doubts?

How to use code and habits to improve the site's concurrent access performance and some of their own doubts

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.