Tell me about the 630 marketing events.

Source: Internet
Author: User
Keywords Webmaster News
Tags address ajax button course get html key key factors

First of all, this time, 630, exposed the charm of the web in this piece of technology is a slag truth, of course, I can testify this is true marketing, is not a gimmick, but the charm of the people's technology really slag.

Since my N5 yesterday fell into the Geixiang, left turn to see the second day of the charm of the family to do the next day, or the country 20 to rob the lucky one of the special machine, I have to sigh a sentence ... N5 I didn't want you to die

Anyway, when I looked at that page last night, I simply analyzed the HTML, just a static page announcing 630 snapped up. And the next day 9 o'clock I went to the company, the content of the page changed, that a piece of ecstasy did not do any confusion of JS, exposing the snapping of all the key factors.

1. Time synchronization, due to the client differences, the charm of the practice is JS Ajax from the server-side remote synchronization time, time to, Snapped button class replaced with Go, which will be from the gray of xxx into a red snapping button.

2. Snapping, snapping is the essence of the click of the Snapping button, the launch of another AJAX request to a clear address (just add a random time at the end), 30 seconds timeout, who will return a json,value domain contains the purchase address, because this is a one-time marketing, I don't know what the address is.

Knowing these 2 key factors, as a proud programmer, you want me to use my hands to point? Naive, must script ah ... In addition to pull a sentence, according to the page program logic, crazy by the refresh is not as good as an honest 1 hours in advance to load the page, at that time the Phantom of the server is still normal, can get the server timer, you can normally wait until 12 o'clock button red ... In the future, if you can't get a timer, don't say you're robbing a cell phone.

So I wrote a script directly, up to 20 greenlet,2 process equals 40 concurrent, 0.2 second construction request to get JSON, set 0.1 seconds of timeout and discard 502 response. This amount I think has a conscience, QPS for the final charm of the concurrent amount can be ignored, and 95% Basic is 502 or timeout (fortunately I shielded).

Unexpectedly, the 11-point 40 began, the 502 rate of the Phantom of the Family began to rise dramatically ... The key is the timer. Go Server timer did not estimate the correct request quantity is dead. Considering the transmission overhead, I actually wanted to say that this server-side timer makes sense!? And precisely this timer, the first wave of flow estimated to drag down the charm of the family of the server, because the entire site began to exhaust up, this time I know, this snapped, hanging.

Given the 7-digit focus on only 100 special MX3 and microblogs, don't you tell me that you only estimate a hundred thousand of concurrency? 3 full nginx? Want me to do the budget, not to do a millions concurrent psychological preparation do not take this live, or sell 10K set of special machine to disperse the pressure, of course, this price you and I know impossible. A comparison of chestnuts, the Spring Festival when a train in accordance with the excess of 50% but 2000 people vote, to the death of a day to calculate the number of 6-digit ticket buyers enough, this proportion of the Ministry of Railways has put in the number of resources to solve, that is the industry's best hardware AH!

So 12 points is still 15 minutes, almost 99.9% of the loss rate I know, basically no one can buy, the middle of a small episode is you must restart the Nginx, in 2 requests (0.2 seconds) moment 502, then I was hehe. Micro Bo said that they have grabbed the eggs, honest to eat, more than 1 points back to see the results. Then more than 1, it should be the charm family did a traffic switch @ AW meow Meow Meow said that mx3_630 page address appeared in the response value domain, once also came two ...

Then LA, my colleague and I opened the address at the same time, he saw 1800, I saw 630, to join the order success, payment success, is the charm of this payment process Ah, ni-po payment will not jump back, with the order number still do not let me inquire, Nima if you can pick up the message also need to buy mobile phone!

In fact, you see, the script is useless, such a one-time second kill or see the RP, open mx3_630 that page when in fact you may not be able to seconds, the Silly Add button is also an AJAX Ah! Dry!

Finally, I have some ideas about the design of the second kill system. At present, the Railway Ministry's practice is actually the most reliable ... After a large number of concurrent, do not fall directly into the traditional storage. Redis with atomic operation Ah what to grass up, a good redis cluster can provide a single instance 2W QPS, with Twemproxy to do the front-end, the next thing I do not have to teach it. Of course, this is just a thought, in general to solve large concurrent large flow of a general direction is to disperse the pressure, delay processing.

So snapping up the process will generally become, the user point snapped up, queued up, waiting for the queue result, this experience, at least more than the exclusively 502 to be really much more right no, you do not have to immediately show whether you rob, but can demonstrate sincerity to tell users why you did not get. So ah, do not look down the technology, look down on the back end, the charm of this incident is not well before the estimate, snapped up the back-end design too pit dad, the result of a good marketing plan to make a bad result.

In addition, the protection of the front-end should be done in place, session and other service-side verification means to sacrifice, direct exposure to the address plus simple random time you're teasing me? The phones are selling so much. Web Development This is the same as college students do I do not know how to spit the groove ... Even my front-end scum like a dog can figure out ... The ox casually hires several people to be able to brush the charm clan to become the dog, said really this time still is your server to make the work.

P.S. Interest-related, to their favorite girl bought an evil family MX, at that time to consider is to worry, she does not like the iphone domestic only the Charm clan, but this year may give her a new iphone. The charm of the family in doing a package that with worry-saving mobile phone This is really more than millet or to be more than a lost (millet in recent years to catch up), but the decision of a business future, is often the wood of that short board.

Wen/Pengjove

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.