Brief discussion on architecture design of second kill system

Source: Internet
Author: User

Second kill is a common e-commerce site of a marketing tool.

The principle is not to have the entire system downtime. Do not show the error data even if the system fails. Try to remain fair and impartial.

To achieve the effect of the second kill before the start, snapping button for the activity did not start. Second kill start, snapping button can click on the order. After the second Kill, the button button becomes a second kill is over.

Technical tackling

The impact of the large amount of traffic in a short period of time on the existing Web site business.

Second Kill is a website marketing an additional activity, the time is short, the concurrent quantity is big.

If the site with the original application deployment together, will inevitably impact on existing business, a little careless may cause the entire website paralysis.

High concurrency under the server database caused by the great load pressure.

User seconds to kill before the start, by constantly refreshing the browser to ensure that you do not miss the second kill activity.

Frequent access to programs and databases can load pressure on application servers and database servers.

The problem of network bandwidth is many times more than usual.

If the size of the second kill page is 200K, if the maximum concurrency number is 10,000, then the required network and server bandwidth is 2G (200kx10000).

These network bandwidth is due to the second kill activity added, more than the usual use of the site bandwidth.

Avoid direct orders.

Seconds to kill the rules of the game is to the second kill to start the purchase of goods, before this point in time, only browsing information can not be a single.

And the next single page is also a common URL, if you get this URL, do not have to wait until the second kill start can be a single.

Coping strategies

Second kill system Independent deployment

In order to avoid a short period of large access to the existing Web site business impact, you can kill the system to deploy the second.

You can also use a separate domain name if necessary to completely isolate it from the site.

Even if the second kill system crashes, it will not affect the site.

Second Kill merchandise page static

The product description, parameters, details, all written to a static page, do not have to do the logical process of the program, do not need access to the database.

You do not need to deploy dynamic servers and database servers.

Leased second kill activity network bandwidth

Because the second kill the new network bandwidth, the operator must purchase or lease the bandwidth.

In order to reduce the pressure on the server, you need to cache the Second product page in the CDN, the same CDN server also need to temporarily rent bandwidth.

Dynamically generate a random URL for a single page

In order to avoid the user directly access to the next single URL, you need to dynamic URL, with random numbers as parameters, only seconds to kill the beginning of the generation.

Architecture Design

How to control the seconds Kill merchandise page Snapping button available/disabled.

The purchase button can only be lit at the start of the second kill, which is grayed out before the display activity has not started.

If the page is dynamically generated, the server must be requested for each refresh, and the load pressure on the service side is bound to be caused.

If the page is a static page, you can cache the page on a CDN, reverse proxy Server, or even a user's browser.

But in this case, when the second kill begins, the user refreshes the page and the application server is not requested at all.

Solution:

Use JS script control, in the page to refer to a JS file (small file), but the file should not be cached.

The JS function is to include the second kill start flag, modify the style, generate the next single page URL and random parameters.

The JS file is not cached practice: xxx.js?v= random number.

There will be a server for monitoring (timer up and down racks):

Push the file when the second kill activity starts.

When the second kill activity at the end of the push file, mark the end of the flag, modify the style.

The following figure.
Brief discussion on the architecture design of Second kill system-1

How to only allow the first to submit a single entry into the order system.

Because only one user can kill a product in seconds, a single front check is required when submitting an order.

If an order has been submitted successfully, indicate the end of the activity and enter the second Kill end page.

In fact, the number of orders can only have one, in order to reduce the load pressure of the next single page server, you can control the entry to the next single page.

Only a few users can enter the next single page, other users directly into the second Kill end page.

(Pre-check logic) to check the number of orders that have been processed on this machine:

If more than 10, the end page is returned to the user directly.

If not more than 10, users can enter the order and confirmation page.

(Pre-check logic) Check the number of globally committed orders:

More than seconds to kill the total number of items, return seconds to kill the end page.

No more than seconds to kill the total number of items submitted to the child order system.

The following figure.
Brief discussion on the architecture design of Second kill system-2

Operations to reduce inventory

Take down inventory (user experience is good)

Reduce inventory by payment

The order is as simple as possible, the purchase data is 1 and not editable, the shipping address and payment method is null or the user defaults, allowing the order to be submitted after modification.

Article/Gecko (Jane book author)
Original link: http://www.jianshu.com/p/cf82e1f44b2b
Copyright belongs to the author, reproduced please contact the author to obtain authorization, and labeled "Jane book author."

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.