"Spike system architecture analysis and practical" --- Reading

The article quoted Lead: With the vigorous development of electronic business, buying and spike activity as an important means of marketing, but also electricity supplier system put forward higher requirements. When the two-eleven to let the people stay up all night Peoples spike headline event has evolved from a simple gimmick, complicated by high pressure system electric providers face no less Chinese New Year red envelopes of micro-channel system.

The annual two-eleven is certainly no stranger to everyone, then the two-eleven servers every year we care about in the end sawed it, was able to support such a large number, to support such a large number of concurrent users, of course, also sometimes spelled network speed. Then for a similar annual Spring Festival rush ticket system. The architecture of these systems in the end how to design?

In fact, the premise is so much the number of concurrent most concerned about the issue of how to handle the load? The article gives the answer:

Users spike before the start, by constantly refresh the browser page to ensure that the spike will not miss, if these requests in accordance with the general architecture of web applications, access the application server, connect to the database, application server and database server will cause the load pressure.

Solution : Redesign spike product page, the site does not use the original product detail page 页面内容静态化,用户请求不需要经过应用服务.

How to determine the order that the case?

Direct orders

Rules of the game is to spike a spike to begin the next commodity purchase orders before this point in time, only browse product information, not orders. The single page is an ordinary URL, if get this URL, you can not start until the following single spike up.

Solution : To avoid users directly access the orders page URL, you need to change the dynamic URL, even if the spike system developers can not access before the start of the next spike single page URL. Way is 下单页面URL加入由服务器端生成的随机数作为参数,在秒杀开始的时候才能得到.

That question again, how to allow only the first submission of the order is sent to the order subsystem

Because ultimately successful commodity spike to only one user, it is necessary when the user submits the order to check whether the order has been submitted. If you already have an order submitted successfully, you need to update JavaScript file, update start flag is no spike, buy button is grayed out. In fact, since the final user can successfully submit an order only one, in order to reduce the single page server load pressure can be controlled entrance into the next single page, users can enter only a few single-page, other users can go directly to spike the end of the page.

 

Solution : Suppose there are 10 single-server cluster servers, each server only accepts up to 10 single request. Prior to submitting an order no one is successful, if a server has been more than a single, while others did not deal with a single, poor user experience possible scenario is the first time the user clicks the button to enter the purchase page has ended, and then refresh the page, there may be a single processing server are not processed into filling the order page 可以考虑通过cookie的方式来应对,符合一致性原则. Of course it can 采用最少连接的负载均衡算法probability, the above situation is greatly reduced.

It says only a few issues of process, the most important thing spike is usually timed shelves: This function is achieved in many ways. But now is a better way: set in advance product was added to time, the user can see the merchandise in the foreground, but can not click on the button "Buy It Now '. But need to consider is that 有人可以绕过前端的限制,直接通过URL的方式发起购买, which requires the back-end database product pages at the front desk, as well as bug page, every clock synchronization. In the back-end control, the higher the security.

The timing spike, then we should avoid sellers do editing brings unexpected impact on the commodity before the spike. This particular change we need the assessment. General ban editing, additional changes may take more data revision process.

So a good architecture determines the success or failure of a system!

Guess you like

Origin www.cnblogs.com/mm20/p/11032939.html