This application claims the benefit of Chinese Patent Application No. 201611185726.2, filed Dec. 20, 2016.
The present disclosure relates to a loading balance system and a method thereof, more particularly to a loading balance system which two-stage processes requests, and a method thereof
In recent years, while internet network is being rapidly developed and popularized, various network services are available in market. Among the network services, electronic commerce attracts the most attention.
In general, for promotional or popularization purpose, an electronic commerce company may usually hold time-limit buy or quantity-limit buy activity to improve consumers' attention and desire to buy. However, the limit-buy promotion may cause a significant number of request packets transmitted to a server system in short time, which results in significantly-increasing load which the server system may not withstand, even the server system may crash because computing resources are exhausted. As a result, existing system for limit-buy promotion has the problem of poor loading capability of the system.
For this reason, some manufacturers develop loading balance technology in which multiple servers configured to distribute loading to prevent computing resources from being exhausted. However, the exiting loading balance technology may require more servers when the number of the request packets is increased, it increases a lot of hardware cost, so implementation and management of this technology is still limited and unable to effectively solve the problem of poor loading capability of the system.
Therefore, what is need is to develop a loading balance system to solve the problem of poor loading capability of the system.
In order to solve the problem of poor system loading capability, the present disclosure is to provide a loading balance system for segmented processing request and a method thereof.
According to an embodiment, the present disclosure provides a loading balance system for segmented processing request, and the system includes at least one browsing end, a plurality of receiving ends, a loading balance end and a processing end. Each browsing end is configured to transmit at least one request and query a result file. Each receiving end is configured to add each request to a task queue, and transmit a confirmation message corresponding to the request to the browsing end corresponding to the request after the each request is added to the task queue. The loading balance end is configured to receive the at least one request from the at least one browsing end, and continuously transmit the at least one request to one of the plurality of receiving end respectively. The processing end includes the task queue and is configured to process each request in the task queue by a first-in first-out manner, and generate and write a success message corresponding to the request into the result file after the processing end confirms that a resource quota is not full, and generate and write a failure message corresponding to the request into the result file after the processing end confirms that the resource quota is full, wherein the processing end is configured to permit the browsing end to query the result file for checking result.
According to an embodiment, the present disclosure provides a loading balance method for segmented processing request, applicable to network environment comprising at least one browsing end, a loading balance end, a plurality of receiving ends and a processing end. The loading balance method includes following steps: transmitting at least one request from the at least one browsing end; in the loading balance end, receiving the at least one request from the at least one browsing end and continuously transmitting the at least one request to one of the plurality of receiving end respectively; in the receiving end, adding each of the at least one request to a task queue of the processing end in sequential order, and transmitting a confirmation message corresponding to the at least one request to the browsing end corresponding to the at least one request after each of the at least one request is added to the task queue; in the processing end, processing each request in the task queue by a first-in first-out manner, and generating and writing a success message corresponding to the request to the result file after the processing end confirms that a resource quota is not full, and generating and writing a failure message corresponding to the request to the result file after the processing end confirms that the resource quota is full; and in the processing end, permitting the at least one browsing end to query the result file for checking result.
According to above content, the difference between the present disclosure and the conventional technology is that, in the system and method of the present disclosure, the loading balance end dispenses the requests, which are transmitted from the at least one browsing end, to each of the receiving end respectively, and each receiving end adds the request to the task queue of the processing end, and the processing end executes the request in the task queue by the first-in first-out manner, and generates and writes the corresponding message into the result file according to whether the resource quota is full, and the at least one browsing end may query the result file to check the execution result for the request.
By using above technical means, the technical effect of improving the load capacity of server system may be achieved.
The structure, operating principle and effects of the present disclosure will be described in detail by way of various embodiments which are illustrated in the accompanying drawings.
The following embodiments of the present invention are herein described in detail with reference to the accompanying drawings. These drawings show specific examples of the embodiments of the present invention. It is to be understood that these embodiments are exemplary implementations and are not to be construed as limiting the scope of the present invention in any way. Further modifications to the disclosed embodiments, as well as other embodiments, are also included within the scope of the appended claims. These embodiments are provided so that this disclosure is thorough and complete, and fully conveys the inventive concept to those skilled in the art. Regarding the drawings, the relative proportions and ratios of elements in the drawings may be exaggerated or diminished in size for the sake of clarity and convenience. Such arbitrary proportions are only illustrative and not limiting in any way. The same reference numbers are used in the drawings and description to refer to the same or like parts.
It is to be understood that, although the terms ‘first’, ‘second’, ‘third’, and so on, may be used herein to describe various elements, these elements should not be limited by these terms. These terms are used only for the purpose of distinguishing one component from another component. Thus, a first element discussed herein could be termed a second element without altering the description of the present invention. As used herein, the term “or” includes any and all combinations of one or more of the associated listed items.
Before illustration of the loading balance system segmented processing request and a method thereof of the present disclosure, the term defined in the present disclosure is described. A resource quota described in the present disclosure means a quantity of a preset product or service, which may be called limited product or service, such as a quantity of coupons, the number of massage services, and so on.
The following describes a loading balance system for segmented processing request and a method thereof of the present disclosure, with reference to the accompanying drawings.
Each of the receiving ends 120 is configured to add each request to a task queue of the processing end 140 in sequential order, and transmit a confirmation message, which corresponds to the added request, to the browsing end 110 corresponding thereto after each request is added to the task queue. Particularly, the receiving end 120 does not execute the received request but transmits the received request to the processing end 140 to add the request to a task queue; and, after the request is added to the task queue, the receiving end 120 responds the confirmation message to the browsing end 110 which sends the request. As a result, the browsing end 110 may know that the request is accepted. It is to be noted that at this stage the browsing end 110 merely know that request is accepted, but may not confirm that the request is approved. In actual implementation, when the receiving end 120 fails to add the request to the task queue of the processing end 140, the receiving end 120 may generate and transmit a cancel message to the browsing end 110 corresponding to the request to inform the browsing end 110 that the request is accepted but may not be processed.
The loading balance end 130 is configured to receive the request from the browsing end 110, and continuously transmit the request to one of the receiving ends 120 separately. In actual implementation, the loading balance end 130 may perform a scheduling algorithm, such as round-robin (RR) algorithm, weight round-robin (WRR) algorithm, or waiting time (WT) algorithm, to dispense the request to one of the receiving ends 120. It is to be noted that any scheduling algorithm applicable to loading balance application is covered by the application field of the present disclosure. Furthermore, the request may include a source address and an identifier (ID), to facilitate the loading balance end 130 to select one of the receiving ends 120 according to the source address and the ID, and the loading balance end 130 may transmit the request to the selected receiving end 120. For example, suppose that there are three receiving ends, and when the source address is Taiwan and the ID is determined to be a VIP member, the loading balance end 130 transmits the request to the first receiving end; When the source address is Taiwan and the ID is determined to be a general member, the request is transmitted to the second receiving end; if none of above, the request is transmitted to the third receiving end.
The processing end 140 is configured to have a task queue, and process the request in the task queue by first-in first-out manner. After the processing end 140 confirms that resource quota thereof is not full, the processing end 140 generates a success message corresponding to the request, and writes the success message into a result file; when the processing end 140 confirms that the resource quota is full, the processing end 140 generates a failure message corresponding to the request, and writes the failure message into the result file. Furthermore, the processing end 140 permits the browsing end 110 to query the result file to check result. In actual implementation, the resource quota is predetermined as a value, and when the number of occurrence that the success message is generated is equal to the value, the resource quota is set to be full. For example, suppose that the resource quota is predetermined as five, and after the success message is generated by five times, the resource quota is changed from five to full. Furthermore, after the processing end 140 confirms that the resource quota is full, the processing end 140 may permit the receiving end 120 to write the request into the task queue, or not permit the receiving end 120 to add the request to the task queue, and delete all requests in the task queue.
The following refers to
The following refers to an embodiment for illustration in cooperation with
Please refer to
To summarize, the difference between the present disclosure and the conventional technology is that, in the system and method of the present disclosure, the loading balance end dispenses the request from the browsing end to one of the receiving ends, and the receiving end adds the request to the task queue of the processing end, and the processing end executes the requests in the task queue by the first-in first-out manner, and generates and writes the corresponding message into the result file according to whether the resource quota is full, and the browsing end may query the result file to check the execution result for the request. By using above technical means, the conventional technology problem may be solved, and the technical effect of improving the load capacity of server system.
The present disclosure disclosed herein has been described by means of specific embodiments. However, numerous modifications, variations and enhancements can be made thereto by those skilled in the art without departing from the spirit and scope of the invention set forth in the claims.
| Number | Date | Country | Kind |
|---|---|---|---|
| 201611185726.2 | Dec 2016 | CN | national |