Spike system architecture design

 1, spike scene core is to ensure three things: steady, accurate and fast; the corresponding technical floor is high availability, consistency, high performance;

 2, the five principles of architecture design

         2.1 To minimize data: the network transmission time-consuming, and the character server compression encoding, serialization and deserialization consumption cpu

         2.2 To minimize the number of requests: page-dependent CSS / JavaScript, images, and Ajax, to do three-way handshake to establish a connection

         2.3 the path as short as possible: request for shortening the path can not only increase the availability, the same can effectively improve performance (reduction of the intermediate node can be reduced and deserialize serial data), and to reduce delay (to reduce network transmission time consuming)

         2.4 To minimize dependence: a complete system must rely on a user request or service, dependent herein refers to a strong dependency, the system may be classified.

         2.5 do not have a single point: a single point means there is no backup, the risk is not controllable. The status of the service and to avoid binding machine, i.e., the state of no service, and the machine-dependent dynamic configuration; storage service generally to solve the problem by way of a single point of the plurality of redundant backup.

           Optimization point: spike alone system independent; make a separate machine cluster; hotspot data (such as inventory data) into a single buffer system to improve the "read performance"; answer spike increases, single grab prevent spike device; page thorough static and dynamic separation, so that the user does not need to spike refresh the entire page; cached locally on the spike in commodity server, relying on a system of background do not need to get calls; increase the current limit protection system, prevent the worst from happening.

 3, how to do static and dynamic separation, what program.

         3.1 concept: the "dynamic data" and "static data," the main difference is to see whether the data output of the page and URL, visitors, time, place-related, and whether it contains Cookie and other private data.

         3.2 How do caching for static data: Understand the concept of movement data, we can easily think of doing static data caching to improve system performance.

                 1, the static data cache to the nearest place from the user, the user browser cache, the Cache CDN or at the end of the service

                 2, it is to direct the transformation of static cache HTTP connection.

                 3, who is going to cache static data is also very important, the cache can be placed on a Web server (such as Nginx, Apache, Varnish) better at handling large concurrent static file requests.

         Scheme 3.3: 1, to deploy single physical machine; 2, unified cache layer; 3, the CDN

4, the hot data processing: 28 principles

         4.1 Concepts: Hot Hot into operation and hotspot data. The so-called "hot action", such as a large number of refresh the page, add a large number of shopping cart; hot data "is better understood, it is the user's request hot hot data corresponding to the data is divided into." Static hot data "and" dynamic hot spots data".

         4.2 Static hot data "is able to predict in advance hotspot data. For example, we can sift through the seller enlists way out ahead, be marking these hot commodity by the registration system. In addition, we can also be found in advance through big data analysis hot commodity, such as our analysis of historical transaction records, user's shopping cart record, to discover which products may be more popular, sell better, these are the hot spots can be analyzed out in advance.

         4.3 Dynamic hot data "that can not be predicted in advance, the hotspot system during operation temporarily produced. For example, sellers in the vibrato advertised, then click on the merchandise fire, causing it to be a lot in a short time buy.

         4.4 hot data found:

                  4.4.1 Static find hot data: mandatory registration sellers, commodity activities marking; large commodity data to calculate statistics top N

                  4.4.2 Dynamic hot data found: 1, to build an asynchronous system that can collect on all aspects of the transaction middleware product link hotspots Key; 2, the establishment of a hot spot reporting and can subscribe to the service on demand hot under hair specification; 3, hot transmitting data collected by the system to an upstream hot desk, and a downstream system (e.g., the trading system) will know which items will be frequently called, and then do the hot protection.

          4.5 Hot processing data:

                  4.5.1 Optimization: cached, LRU replacement algorithm can then be eliminated using.

                  4.5.2 Restrictions: e.g. made consistency Hash ID to access the product, and then do the points according Hash bucket, each bucket is provided a sub-processing queue, which can limit the hot commodity in a request queue, to prevent hot spots due to some commodity take up too much server resources, so that other requests are not always the server's processing resources.

                  4.5.3 Isolation:

                          4.5.3.1 service isolation: the former went on sale, the seller registration alone, to do the warm-up ahead of hot data

                          4.5.3.2 Isolation System: by way of a packet can be deployed separately and additional 99%, to kill can apply a separate domain, the request object is let fall into different clusters.

                          4.5.3.3 Data Isolation: spike called the data mostly hot data, such as Cache enables single or clustered MySQL database to put hot data, the purpose of the data also do not want to 0.01% 99.99% have the opportunity to influence the data.

 

 

                  To be continued ~ ~ ~ ~

 

Guess you like

Origin www.cnblogs.com/enchaolee/p/11579576.html