CN110489694A - For handling the method and system of high concurrent request - Google Patents

For handling the method and system of high concurrent request Download PDF

Info

Publication number
CN110489694A
CN110489694A CN201910694039.0A CN201910694039A CN110489694A CN 110489694 A CN110489694 A CN 110489694A CN 201910694039 A CN201910694039 A CN 201910694039A CN 110489694 A CN110489694 A CN 110489694A
Authority
CN
China
Prior art keywords
request
caching
response
hashed value
write
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910694039.0A
Other languages
Chinese (zh)
Inventor
林世荣
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201910694039.0A priority Critical patent/CN110489694A/en
Publication of CN110489694A publication Critical patent/CN110489694A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
    • G06F16/972Access to data in other repository systems, e.g. legacy data or dynamic Web page generation

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

This disclosure relates to provide a kind of for handling the method and system of high concurrent request.The described method includes: receiving the request from requesting party, the request includes the request to dynamic resource;The hashed value of the request is calculated, the hashed value can uniquely identify the request;The hashed value is written in the way of optimistic locking and is cached;If said write success, it is for processing to forward the request to dynamic resource server;And if said write fails, it tries read the response to the request from caching.

Description

For handling the method and system of high concurrent request
Technical field
The present invention relates to the method and systems for handling high concurrent request.
Background technique
The form that the system developments such as current web server generally use front and back end to separate, wherein back-end server is responsible for Serving data, and page jump and data call are controlled by front-end server.In the undesirable scene of system development specification, Page rendering, which may result in, repeatedly sends identical request of data, so as to cause back-end server computing resource, memory source Waste.
In addition, the system link that externally calls of web server system is too long or system business processing logic is excessively complicated, it will It will lead to the request processing to client to take a long time.In this case, if identical request is repeatedly issued simultaneously, The equal Pending The Entry Into Force of caching at web server causes the waste of back-end server resource so that repeatedly handling the identical request.
In addition, malicious requests side also can be instantaneously to some dynamic resource (for example, Dynamic Networks in malicious attack scene Page) high frequency request is initiated, so as to cause back-end server resource exhaustion or database corruption, so that service is unavailable.
The disclosure is exactly directed to but is not limited to the improvement that drawbacks described above is made.
Summary of the invention
According to the disclosure in a first aspect, providing a kind of method for handling high concurrent request, comprising: reception comes from The request of requesting party, the request include the request to dynamic resource;The hashed value of the request is calculated, the hashed value can be only One ground identifies the request;The hashed value is written in the way of optimistic locking and is cached;It, will be described if said write success It is for processing that request is transmitted to dynamic resource server;And if said write fails, it tries read from caching to described The response of request.
According to an embodiment, the request is HTTP request, and the method is executed by web server.
According to another embodiment, the hashed value is at least to hash to the following certain applications for including in the HTTP request Function obtains: requesting method, request URL and request body.
According to yet another embodiment, said write includes: that the version number of the hashed value is set as 1 the caching is written, And if there are the same Hash value that version number is more than or equal to 1, said write failures in the caching;Otherwise, described to write Enter success.
According to yet another embodiment, the request further includes the request to static resource.
According to yet another embodiment, the method also includes being taken in the successful situation of said write from the dynamic resource Business device receives requested dynamic resource, by the dynamic resource and requested static resource together as to the request Response be stored in the caching, and by it is described response be sent to the requesting party.
According to yet another embodiment, described the method also includes the hashed value and the response to be stored in association with In caching.
According to yet another embodiment, the hashed value stored in the caching has corresponding life span, and the existence Time is scheduled or is determined according to the attribute of requested dynamic resource.
According to yet another embodiment, the method also includes delaying after the life span of respective Hash value is expired from described Deposit middle removing respective Hash value and associated response.
According to yet another embodiment, the method also includes in the case where said write failure, executing described attempt up to pre- Number is determined, until the response to the request is successfully read from described cache, wherein the pre-determined number is equal to the request Time-out time handles the time divided by single request.
According to yet another embodiment, if the method also includes not reading successfully to described in the pre-determined number The response of request then sends request timed out notice to the requesting party;Otherwise, the response read is sent to the request Side.
According to the second aspect of the disclosure, a kind of system for handling high concurrent request is provided, comprising: reception group Part is configured to receive the request from requesting party, wherein the request packet includes the request to dynamic resource;Computation module, Its hashed value for being configured to calculate the request, wherein the hashed value can uniquely identify the request;Component is written, It is configured to that the hashed value is written in the way of optimistic locking and caches;Transfer assembly, if being configured to said write group The hashed value is successfully written the caching by part, then it is for processing to forward the request to dynamic resource server;And Reading assembly, if being configured to the write-in failure of said write component, it tries read the response to the request from caching.
According to an embodiment, the request is HTTP request.
According to another embodiment, the hashed value is at least to hash to the following certain applications for including in the HTTP request Function obtains: requesting method, request URL and request body.
According to yet another embodiment, said write component is further configured to the version number of the hashed value being set as 1 to be written The caching, and if there are the same Hash value that version number is more than or equal to 1, said write failures in the caching;It is no Then, said write success.
According to yet another embodiment, the request further includes the request to static resource.
According to yet another embodiment, the receiving unit is further configured in the successful situation of said write, is moved from described State Resource Server receives requested dynamic resource, and the dynamic resource and requested static resource one are acted as To be stored in the caching to the response of the request, and the transfer assembly is further configured to for the response being sent to The requesting party.
According to yet another embodiment, the hashed value is also stored in association in the caching with the response.
According to yet another embodiment, the hashed value stored in the caching has corresponding life span, and the existence Time is scheduled or is determined according to the attribute of requested dynamic resource.
According to yet another embodiment, after the life span of respective Hash value is expired, it is corresponding that this is removed from the caching Hashed value and associated response.
According to yet another embodiment, the reading assembly is further configured in the case where said write failure, described in execution It attempts to reach pre-determined number, until the response to the request is successfully read from described cache, wherein the pre-determined number is equal to institute The time-out time for stating request handles the time divided by single request.
According to yet another embodiment, if the transfer assembly is further configured to the reading assembly in the pre-determined number The response to the request is not read successfully, then sends request timed out notice to the requesting party;Otherwise, the transmission group The response that part is configured to read is sent to the requesting party.
According to the third aspect of the disclosure, a kind of system for handling high concurrent request is provided, comprising: processor; And it is arranged to the memory of storage computer executable instructions, the executable instruction makes the processor when executed Execute the method as described in the first aspect according to the disclosure.
Various aspects generally comprise as substantially herein by reference to described by attached drawing and the method as explained by attached drawing, Equipment, system, computer program product and processing system.
Foregoing teachings have sketched the contours of the exemplary feature and technical advantage according to the disclosure broadly so that following is detailed Thin description can be better understood.Additional feature and advantage will describe hereafter.Disclosed concept and specific example can It is easily used as modifying or being designed to carry out the basis of the other structures of purpose identical with the disclosure.Such equivalent constructions Without departing from the scope of the appended claims.The characteristic of concepts disclosed herein two aspect of its organizing and operating method with And associated advantage is better understood due to will be described below because being considered in conjunction with the accompanying.Each attached drawing is for explaining and retouch It states purpose to provide, and does not define limitations on the claims.
Detailed description of the invention
Mode used in the feature set forth above of the disclosure in order to understand in detail, can refer to various aspects and comes to the above letter The content to be summarized is more particularly described, and some of aspects explain in the accompanying drawings.It should be noted, however, that attached drawing only explains Certain typical patterns of the disclosure, therefore should not be considered as limiting its scope, because this description has allowed other equivalent effective Aspect.Same reference numerals in different attached drawings can identify the same or similar element.
Fig. 1 is the exemplary timing chart for being used to handle client request explained in existing system.
Fig. 2 is the flow chart for explaining the exemplary method for handling high concurrent request according to all aspects of this disclosure.
Fig. 3 is explained according to all aspects of this disclosure for handling the example timing diagram of high concurrent request.
Fig. 4 is the block diagram for explaining the example system for handling high concurrent request according to all aspects of this disclosure.
Fig. 5 is the signal for explaining another example system for handling high concurrent request according to all aspects of this disclosure Figure.
Specific embodiment
It is intended as the description of various configurations below in conjunction with the attached drawing 1-5 detailed description illustrated, and is not intended to indicate to practice Only configuration of concept described herein.This detailed description includes detail to provide the thorough reason to each conception of species Solution.However, it will be apparent to those skilled in the art that, these concepts can be practiced without these specific details.
Term is explained:
Static resource: the resource being generally referred to as stored at web server, such as website pattern file, js resource, Html Static web page documents, picture file, etc.;
Dynamic resource: it is opposite with static resource, generally referred to as need web server to calculate by program internal memory to return All resources returned.Dynamic resource, which is generally required, could return to institute to user by database manipulation or program internal memory calculation processing The resource of request.It typically is provided with following essential characteristic: 1. interactivity: webpage can be moved with selection acording to the requirement of user Changes and respond to state;2. automatically updating: html document need not be updated manually, new page will be automatically generated, it can be significantly Save workload;3. because when become because of people: will appear the different pages when different time, different user access same network address.
CDN:CDN is that the content distributing network constructed on network passes through by the Edge Server for being deployed in various regions The functional modules such as load balancing, content distribution, the scheduling of central platform, content needed for obtaining user nearby reduce network and gather around Plug improves user's access response speed and hit rate;
In existing web system, static resource is such as distributed to using CDN by the general access only accelerated to static resource Different networks.When user requests resource, nearest network node is looked for be responded.It is common for dynamic resource Scheme is on interface using caching.In response to client initiate first time request, by based on input parameter key assignments with ask Response is asked to store in caching together.For subsequent same request, then response is read directly from caching, to protect downstream Resource.
But when the client same time initiating a large amount of same requests, does not respond still, will lead to accordingly in caching All requests all can execute a rear end process by server, so as to cause the wasting of resources.For single request processing when Between it is especially true for longer situation.In the case where serious waste of resources, this may result in server resource exhaust or Database corruption, so that system is unavailable.
For example, as shown in Figure 1, it illustrates in existing web system to the processing timing diagram of the request from client.This Field technical staff is it will be appreciated that for clarity, static resource is not shown in Fig. 1.
With reference to Fig. 1, firstly, client (for example, web client) by resource request (such as comprising to dynamic resource Request) it is sent to server (for example, web server).Web server upon receipt of the request, for web client to dynamic State Resource Server issues resource acquisition request.Dynamic resource server is asked receiving the resource acquisition from web server After asking, corresponding business processing is executed to generate requested resource.Then, dynamic resource server is by resource generated (that is, result of business processing) returns to web server.Web server is then by the response (example from dynamic Resource Server Such as, web client requested resource or fail to generate web client requested resource in dynamic resource server In the case of failure notification) return to web client.Web client is then rendered based on the response received to mention Supply user.
It can be seen that existing system shown in FIG. 1 (not exists each request from web client in web server In the case where finding respective response in caching) all send dynamic resource server to, this initiates big in the web client same time When measuring same request, will lead to all requests all can execute a business processing flow by dynamic Resource Server, to lead Cause the wasting of resources.
The system and method for the disclosure can be identified when server (for example, web server) receives client request Whether it is high frequency same request, and only handles one in these same requests request, and processing result is shared to these Other requests in same request, to protect server end to calculate, memory source, safeguards system service is continuously available.Therefore, The system and method for the disclosure are particularly suitable for that single call (for example, web call) takes a long time and there may be continuous simultaneously The scene of calling.
2-5 describes each example embodiment of the system and method for the disclosure with reference to the accompanying drawing.
As shown in Fig. 2, it illustrates the exemplary methods 200 requested for handling high concurrent according to all aspects of this disclosure Flow chart.
With reference to Fig. 2, in frame 210, method 200 may include receiving the request from requesting party, and the request includes to dynamic The request of resource.For example, in one example, requesting party is web client, and web server reception is sent out by the web client The access request to the webpage comprising dynamic resource out.In this example, which can be HTTP request, generally at least Including each portion such as requesting method (for example, POST, GET, etc.), request URL, http protocol and version, request header, request body One or more of point.
For example, as shown in figure 3, when it illustrates according to all aspects of this disclosure for handling the example of high concurrent request Sequence figure.As can be seen, web client 305 can send out resource request (for example, the request includes the request to dynamic resource) Give web server 310.Web server 310 can receive this request from web client 305 and carry out subsequent place Reason.
Later with continued reference to Fig. 2, in frame 220, method 200 may include calculating the hashed value of the request received.On continuing State example, web server the request can be parsed after the HTTP request received with find out including each field Part, and at least using include in HTTP request requesting method, request URL and request body portion by hash function come Calculate hashed value corresponding with the request.For example, web server 310 can parse the money from web client with reference to Fig. 3 Source request, and using the various pieces of the request that parses (for example, parameters, i.e. requesting method, request URL and asking Seek body, etc.) one or more of calculate the hashed value of the request, using the hashed value being calculated as the request Globally unique identifier.It will be understood by those skilled in the art that hashed value is only a kind of exemplary forms of globally unique identifier, may be used also The request is uniquely identified in a manner of taking any other suitable, such as each section of the request is serially connected, etc. Deng.Additionally, it is to be appreciated that hashed value is that various known or exploitation in the future hashing algorithm can be used to be calculated, it is all Such as MD4, MD5, SHA-1.Those skilled in the art are to be further understood that web server can be used in the request received Including any part and/or combination thereof calculate corresponding hashed value, as long as these parts and/or combination thereof is used to calculate Obtained hashed value can be used to uniquely identify the request.
Fig. 2 is referred back to, and in frame 230, method 200 may include the hashed value being calculated being write in the way of optimistic locking Enter (that is, storage is arrived) caching.
It will be understood by those skilled in the art that optimistic locking is a kind of locking mechanism of data access, it is based on number mostly It is realized according to colophon mechanism, as data increase a version number.In the version solution based on database table, one As be to be realized by increasing " version (version) " field for database table.When reading data, together by this version number It reads, then when submitting data to be updated, this version number adds one.At this point, version number and database table that data will be submitted The current version number of corresponding record is compared.If the versions of data number submitted is greater than database table current version number, give To update;Otherwise it is assumed that being stale data and abandoning.
Specifically, continue the example presented above, web server after the hashed value for calculating the HTTP request received, The hashed value being calculated can be written in the way of optimistic locking and be cached.In this example, said write may include will be described The version number of hashed value is set as 1 the caching is written, rather than writes direct in the caching.
In this example, if the request received is the first request in multiple same requests, caching in there has been no The hashed value, therefore there is no the hashed values that version number is more than or equal to 1 in the caching.In this case, the hash Value is written successfully.
Otherwise, if the request received is not first request in multiple same requests, in the caching There are identical hashed values, and its version number is at least 1.In this case, according to optimistic lock mechanism, the write-in of this hashed value Since its version number's (that is, set value 1) is less than or equal to the version number (for example, 1) of stored same Hash value in caching And fail.As a result, in the presently disclosed embodiments, optimistic lock mechanism is employed to ensure that in multiple same requests only by one quilt Server (for example, web server) is transmitted to dynamic resource server, and make in these same requests other it is each request not It is forwarded to dynamic resource server.
In one embodiment, in the case where caching is separated with web server, web server can will be calculated Hashed value sends caching in a manner of by caching come by optimistic locking to execute storage operation.
For example, with reference to Fig. 3, schematically illustrate that caching is implemented as separating with web server 310 with caching number According to library 315.It will be understood by those skilled in the art that cache database 315 can be realized using database technology, however its It can be any other realization that can pay optimistic lock mechanism, and it can also be realized as being located at web server 310 Place.
With continued reference to Fig. 3, for web server 310 after the hashed value for calculating the request received, can attempt should Hashed value (together with the version number for being set as 1) is written in cache database 315.Cache database 315 is receiving the hashed value Later, the return value for storing the hashed value and returning to storage success or not to web server can be attempted.
If said write success, method 200 can proceed to frame 240, here, forwarding the request to dynamic resource clothes Business device is for processing.For example, continuing the example presented above, in the case where being written successfully, web server can determine that the request is It requests for the first time, forwards the request to dynamic resource server to be made by the dynamic resource server to the request Response, and the response to the request is received from the dynamic resource server.
For example, with reference to Fig. 3, dotted line frame 350 show successfully stored in cache database 315 it is related to resource request The sequence of operation after the hashed value of connection.In the case where hashed value is written successfully (that is, cache database 315 successfully stores Hashed value), web server 310 requests to obtain resource to dynamic resource server 320 based on described, such as the request is turned It is for processing to issue dynamic resource server 320.Corresponding business processing can be performed then to prepare in dynamic resource server 320 The good requested dynamic resource of requesting party, and return to web server 310 as processing result, i.e., to web server 310 make a response.Web server 310 then receives the processing result returned from dynamic Resource Server 320 and (rings that is, receiving It answers).
In this embodiment, method 200 may also include response storage in the buffer.For example, in HTTP request In example, web server can receive response (wherein response bag to HTTP request from dynamic resource server Include requested dynamic resource) after, it stores it in caching.
In another embodiment, in the case where web client also requests static resource, method 200 may also include by Associated static resource and the response (that is, dynamic resource) from dynamic resource server are collectively stored in caching.
In this embodiment, method 200 may also include hashed value and the requested dynamic resource of web client and static state Resource (in the case where web client requests static resource) stores in association.In this way, after web server receives After continuous same request, the hashed value being calculated can be used and come from caching directly to search accordingly as key word of the inquiry Response, deal with without request dynamic Resource Server again.
For example, it illustrates receiving the processing result from dynamic resource server 315 (that is, corresponding with reference to Fig. 3 Dynamic resource) after, web server 310 is related to the hashed value being calculated by 305 requested resource of web client Connection ground write-in cache database 315, for being used for subsequent same request.Cache database 315 perform storage operation after, It can notify 310 processing result of web server (for example, storage is completed).
Although those skilled in the art, which are to be further understood that in Fig. 3 using single cache database 315, stores hashed value With the response to request, but for store hashed value caching and physical cache can be different to the caching of the response of request And they can also be located at one or separate each other by any means with web server, such as storing the slow of hashed value Depositing can be located at one with web server, and the caching for being used to store the response to request can be located at another equipment, or Both of which is located at web server.
Then, method 200, which may also include to web client, returns to its resource requested.For example, as shown in figure 3, web takes Being engaged in device 310 can be to the return requested resource of web client 305.
With continued reference to Fig. 2, if said write fails, method 200 can proceed to frame 250, here, attempting to read from caching Response to the request.For example, continue the example presented above, in the case where failure is written, web server can determine with it is described It requests to be processed before identical request or just processed, and therefore there may be ask before identical in caching The response asked.In this case, web server can be used the hashed value being calculated attempted as key word of the inquiry from Caching reads the response to the request, without forwarding the request to dynamic resource server, to save Internet resources With the process resource of dynamic resource server.
For example, Fig. 3 shows the sequence of operation in the case where caching failure is written at frame 360.In web services In the case that device 310 receives the notice (that is, write-in failure) of the storage failure from cache database 315, web server 310 can determine that this request from web client 305 received is not the request for the first time in multiple same requests, and And the response for the request may be stored in cache database 315.In this way, web server 310 can be to cache database For 315 sending read requests to read the response for being directed to the request, cache database 315 executes corresponding read operation simultaneously in turn Its response stored is returned to web server 310.Web server 310 can be returned after receiving respective response Back to the web client 305 for issuing request.Web client 305 carries out subsequent processing, such as wash with watercolours to the resource received in turn Dye.
In one embodiment, if the trial for the first time for reading response does not succeed, method 200, which may also include, to be continued to attempt to The response to the request is read from caching and reaches pre-determined number, until successfully reading the response to the request from described cache. For example, continuing the example presented above, each trial time of web server can be the processing time of single request.For example, web takes Business device can handle the time according to the history of all previous request to determine the trial time for reading response from caching.
In a preferred embodiment, when the time-out time that the pre-determined number is equal to the request is handled divided by single request Between.In this way, web server can notify request timed out to requesting party after the time-out time of the request expires, without It is further continued for attempting.
However, in this embodiment, if not reading the response to the request successfully in the pre-determined number, Then method 200 may include that request timed out notice is sent to the requesting party.For example, for the example of HTTP request, it is assumed that time-out Time is 500ms, and the time that web server and dynamic resource server process are once requested is 50ms, then pre-determined number can quilt It is arranged to 500/50=10 times.In this example, if web server attempts to read response from caching up to 10 times, web services Device abandons the request, and sends time-out notification to the web client for issuing request.
In the another embodiment of the disclosure, the hashed value stored in the caching has corresponding life span, and After the life span is expired, corresponding hashed value is removed from hash caching, to vacate the sky of hash caching Between.In a further embodiment, the life span is the attribute according to requested dynamic resource (for example, dynamic resource Renewal frequency, etc.) come what is determined.As an example, assume that requested dynamic resource is the public accumalation fund for housing construction data of user, It is usually monthly carried out due to the update of the data, so life span can be configured to one month or shorter.In the implementation In example, if the life span of respective Hash value is expired, the respective Hash value is removed from the caching.For example, in house In the example of public accumulation fund data, if hashed value is stored over one month in the buffer (is configured to one in life span In the case where a month), then the hashed value is removed, so that it is guaranteed that the dynamic resource that requesting party obtains is effective.In addition, in phase Answer hashed value life span expire and from caching remove after, associated response can also be removed from caching, to rise The space cached out.
Fig. 4 is the block diagram for explaining the example system 200 for handling high concurrent request according to all aspects of this disclosure.
As shown in figure 4, system 400 includes: receiving unit 401, it is configured to receive the request from requesting party, wherein The request includes the request to dynamic resource;Computation module 403 is configured to calculate the hashed value of the request, wherein The hashed value can uniquely identify the request;Component 405 is written, is configured to the hash in the way of optimistic locking Value write-in caching;The hashed value is successfully written described delay if being configured to said write component by transfer assembly 407 It deposits, then it is for processing to forward the request to dynamic resource server;And reading assembly 409, if being configured to institute State write-in component write-in failure, it tries read the response to the request from caching.
According to an embodiment, the request is HTTP request.
According to another embodiment, the hashed value is at least to hash to the following certain applications for including in the HTTP request Function obtains: requesting method, request URL and request body.
According to yet another embodiment, write-in component 405 is further configured to the version number of the hashed value being set as 1 to be written Caching is stated, and if there are the same Hash value that version number is more than or equal to 1, said write failures in the caching;Otherwise, Said write success.
According to yet another embodiment, the request further includes the request to static resource.
According to yet another embodiment, receiving unit 401 is further configured in the successful situation of said write, from the dynamic Resource Server receives requested dynamic resource, and by the dynamic resource and requested static resource together as The response of the request is stored in the caching, and transfer assembly 407 is further configured to the response being sent to institute State requesting party.
According to yet another embodiment, the hashed value is also stored in association in the caching with the response.
According to yet another embodiment, the hashed value stored in the caching has corresponding life span, and the existence Time is scheduled or is determined according to the attribute of requested dynamic resource.
According to yet another embodiment, after the life span of respective Hash value is expired, it is corresponding that this is removed from the caching Hashed value and associated response.
According to yet another embodiment, reading assembly 409 is further configured to taste described in execution in the case where said write failure Examination reaches pre-determined number, until the response to the request is successfully read from described cache, wherein the pre-determined number is equal to described The time-out time of request handles the time divided by single request.
According to yet another embodiment, if transfer assembly 407 is further configured to reading assembly 409 and does not have in the pre-determined number Have and successfully read the response to the request, then sends request timed out notice to the requesting party;Otherwise, transfer assembly 407 The response for being configured to read is sent to the requesting party.
Fig. 5 is to explain showing for another example system 500 according to all aspects of this disclosure for handling high concurrent request It is intended to.
As shown, system 500 includes processor 505 and memory 510.It is executable that memory 510 is stored with computer Instruction 515, these instructions can be executed to realize the above method described in conjunction with Fig. 1 by processor 505.
As described above, disclosed method and system are raw by using the key mark in request (for example, HTTP request) Identify whether requested content is identical at signature (for example, hashed value), and by optimistic lock mechanism come identical ask of only letting pass Thus first request in asking protects the dynamic of back-end server so that back-end server only handles a service request State resource.
For example, for web services, disclosed method and system while retaining web site high concurrent characteristic, Protect the efficient utilization rate of the dynamic resource of back-end server.
It will be understood by those skilled in the art that although specifically combining web resource access to describe according to each reality in the disclosure The method and system of example is applied, but these method and systems are not only applicable to web resource access, but being suitable for includes to dynamic Any scene of the access of resource.
The above specific embodiment includes the reference to attached drawing, and attached drawing forms the part of specific embodiment.Attached drawing passes through Illustrate to show the specific embodiment that can be practiced.These embodiments are referred to herein as " example ".Such example may include Element in addition to those of shown or described element.However, also contemplating the example including shown or described element.In addition, What is also contemplated is the example of any combination or arrangement using those of shown or described element, or referring to shown herein or The particular example (or one or more in terms of) of description, or referring to other shown or described herein examples (or one Or many aspects).
In the dependent claims, term " includes " and "comprising" are open, that is to say, that in the claims System, equipment, product or the process of element in addition to those of enumerating element after such term are regarded as falling in that In the scope of the claims.In addition, in the dependent claims, term " first ", " second " and " third " etc. are merely used as Label, and it is not intended to the numerical order shown to their object.
In addition, the order respectively operated explained in this specification is exemplary.In an alternate embodiment, each operation can To execute by from different order shown in the drawings, and each operation can be merged into single operation or split into more multioperation.
Above description is intended to illustrative and not restrictive.For example, in combination with other embodiments come using retouching above The example (or in terms of one or more) stated.Can such as by those of ordinary skill in the art check above description it is later Use other embodiments.Abstract allows reader to quickly determine the nature of the disclosure of the art.The abstract is submitted, and understands that this is plucked It will not be used to interpret or limit the scope of the claims or meaning.In addition, various features can in the above specific embodiment Jointly in groups so that the disclosure is smooth.However, claim can not state each feature disclosed herein, because implementing Example can characterize the subset of the feature.In addition, embodiment may include feature more less than feature disclosed in particular example. Therefore, the appended claims are hereby incorporated into specific embodiment, a claim as individual embodiment and It is individually present.The range of embodiment disclosed herein should be assigned referring to the appended claims and such claim The full breadth of the equivalence of right determines.

Claims (23)

1. a kind of method for handling high concurrent request, comprising:
The request from requesting party is received, the request includes the request to dynamic resource;
The hashed value of the request is calculated, the hashed value can uniquely identify the request;
The hashed value is written in the way of optimistic locking and is cached;
If said write success, it is for processing to forward the request to dynamic resource server;And
If said write fails, it tries read the response to the request from caching.
2. the method as described in claim 1, which is characterized in that the request is HTTP request, and the method is by web services Device executes.
3. method according to claim 2, which is characterized in that the hashed value at least to including in the HTTP request Following certain applications hash function obtains: requesting method, request URL and request body.
4. the method as described in claim 1, which is characterized in that said write includes: that the version number of the hashed value is set as 1 Be written the caching, and if there are the same Hash value that version number is more than or equal to 1 in the caching, said write is lost It loses;Otherwise, said write success.
5. method as claimed in claim 4, which is characterized in that the request further includes the request to static resource.
6. method as claimed in claim 5, which is characterized in that further include being moved in the successful situation of said write from described State Resource Server receives requested dynamic resource, by the dynamic resource and requested static resource together as right The response of the request is stored in the caching, and the response is sent to the requesting party.
7. method as claimed in claim 6, which is characterized in that further include depositing the hashed value and the response in association Storage is in the caching.
8. the method for claim 7, which is characterized in that when the hashed value stored in the caching has corresponding existence Between, and the life span is scheduled or is determined according to the attribute of requested dynamic resource.
9. method according to claim 8, which is characterized in that after the life span of respective Hash value is expired, from described The respective Hash value and associated response are removed in caching.
10. the method as described in claim 1, which is characterized in that further include in the case where said write failure, described in execution It attempts to reach pre-determined number, until the response to the request is successfully read from described cache, wherein the pre-determined number is equal to institute The time-out time for stating request handles the time divided by single request.
11. method as claimed in claim 10, which is characterized in that if further including not read successfully in the pre-determined number The response to the request is got, then sends request timed out notice to the requesting party;Otherwise, the response read is sent to The requesting party.
12. a kind of system for handling high concurrent request, comprising:
Receiving unit is configured to receive the request from requesting party, wherein the request packet includes the request to dynamic resource;
Computation module is configured to calculate the hashed value of the request, wherein the hashed value can uniquely identify described ask It asks;
Component is written, is configured to that caching is written in the hashed value in the way of optimistic locking;
The hashed value is successfully written the caching if being configured to said write component by transfer assembly, will be described It is for processing that request is transmitted to dynamic resource server;And
Reading assembly, if being configured to the write-in failure of said write component, it tries read from caching to the request Response.
13. system as claimed in claim 12, which is characterized in that the request is HTTP request.
14. system as claimed in claim 13, which is characterized in that the hashed value is at least to including in the HTTP request Following certain applications hash function obtain: requesting method, request URL and request body.
15. system as claimed in claim 12, which is characterized in that said write component is further configured to the hashed value Version number is set as 1 to be written the caching, and if there are the same Hash value that version number is more than or equal to 1 in the caching, Then said write fails;Otherwise, said write success.
16. system as claimed in claim 15, which is characterized in that the request further includes the request to static resource.
17. system as claimed in claim 16, which is characterized in that the receiving unit is further configured in said write success In the case where, requested dynamic resource is received from the dynamic resource server, and by the dynamic resource and asked The static resource asked is stored in the caching together as the response to the request, and the transfer assembly is also configured The requesting party is sent at by the response.
18. system as claimed in claim 17, which is characterized in that the hashed value is also stored in association with the response In the caching.
19. system as claimed in claim 18, which is characterized in that the hashed value stored in the caching has corresponding existence Time, and the life span is scheduled or is determined according to the attribute of requested dynamic resource.
20. system as claimed in claim 19, which is characterized in that after the life span of respective Hash value is expired, from institute It states in caching and removes the respective Hash value and associated response.
21. system as claimed in claim 12, which is characterized in that the reading assembly is further configured to fail in said write In the case where, execute it is described attempt to reach pre-determined number, until from described cache successfully read the response to the request, wherein institute The time-out time that pre-determined number is stated equal to the request handles the time divided by single request.
22. system as claimed in claim 21, which is characterized in that if the transfer assembly is further configured to the reading group Part does not read the response to the request successfully in the pre-determined number, then it is logical to send request timed out to the requesting party Know;Otherwise, the response that the transfer assembly is configured to read is sent to the requesting party.
23. a kind of system for handling high concurrent request, comprising:
Processor;And
It is arranged to the memory of storage computer executable instructions, the executable instruction makes the processor when executed Execute the method as described in any one of claim 1-11.
CN201910694039.0A 2019-07-30 2019-07-30 For handling the method and system of high concurrent request Pending CN110489694A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910694039.0A CN110489694A (en) 2019-07-30 2019-07-30 For handling the method and system of high concurrent request

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910694039.0A CN110489694A (en) 2019-07-30 2019-07-30 For handling the method and system of high concurrent request

Publications (1)

Publication Number Publication Date
CN110489694A true CN110489694A (en) 2019-11-22

Family

ID=68548658

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910694039.0A Pending CN110489694A (en) 2019-07-30 2019-07-30 For handling the method and system of high concurrent request

Country Status (1)

Country Link
CN (1) CN110489694A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111522836A (en) * 2020-04-22 2020-08-11 杭州海康威视系统技术有限公司 Data query method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030236857A1 (en) * 2002-03-07 2003-12-25 International Business Machines Corporation Network service system and program using data processing
CN103051706A (en) * 2012-12-19 2013-04-17 新浪网技术(中国)有限公司 Dynamic webpage request processing system and method for dynamic website
CN103780679A (en) * 2014-01-03 2014-05-07 电子科技大学 Long time delay remote invocation method based on HTTP protocol
CN108090058A (en) * 2016-11-21 2018-05-29 广东亿迅科技有限公司 A kind of high concurrent action interactions method
CN108133399A (en) * 2016-11-30 2018-06-08 北京京东尚科信息技术有限公司 The second of high concurrent fast-response kills the method, apparatus and system that inventory precisely reduces

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20030236857A1 (en) * 2002-03-07 2003-12-25 International Business Machines Corporation Network service system and program using data processing
CN103051706A (en) * 2012-12-19 2013-04-17 新浪网技术(中国)有限公司 Dynamic webpage request processing system and method for dynamic website
CN103780679A (en) * 2014-01-03 2014-05-07 电子科技大学 Long time delay remote invocation method based on HTTP protocol
CN108090058A (en) * 2016-11-21 2018-05-29 广东亿迅科技有限公司 A kind of high concurrent action interactions method
CN108133399A (en) * 2016-11-30 2018-06-08 北京京东尚科信息技术有限公司 The second of high concurrent fast-response kills the method, apparatus and system that inventory precisely reduces

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111522836A (en) * 2020-04-22 2020-08-11 杭州海康威视系统技术有限公司 Data query method and device, electronic equipment and storage medium
CN111522836B (en) * 2020-04-22 2023-10-10 杭州海康威视系统技术有限公司 Data query method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US11122067B2 (en) Methods for detecting and mitigating malicious network behavior and devices thereof
US10749990B1 (en) Automatic discovery of API information
US8676979B2 (en) Methods and systems for efficient API integrated login in a multi-tenant database environment
EP3837604B1 (en) In situ triggered function as a service within a service mesh
US10630758B2 (en) Method and system for fulfilling server push directives on an edge proxy
CN104714965B (en) Static resource De-weight method, static resource management method and device
CN104011701A (en) Content delivery network
CN107920094B (en) Data acquisition method and device, server and network equipment
CN109067936B (en) Domain name resolution method and device
CN104184832A (en) Data submitting method and device in network application
CN110020043B (en) Page crawling method, device, storage medium and processor
EP3633948B1 (en) Anti-attack method and device for server
CN113452780B (en) Access request processing method, device, equipment and medium for client
CN111083113A (en) Mimicry distribution system, method and medium
US20210096926A1 (en) Cloud computing platform that executes third-party code in a distributed cloud computing network and uses a distributed data store
CN111371585A (en) Configuration method and device for CDN node
US11777852B1 (en) System and method for web service atomic transaction (WS-AT) affinity routing
CN109327506A (en) A kind of resource allocation methods, device and readable storage medium storing program for executing
US11206302B2 (en) Method and device for feeding back a resource file
CN110489694A (en) For handling the method and system of high concurrent request
CN111600929B (en) Transmission line detection method, routing strategy generation method and proxy server
EP2901658B1 (en) Request-agnostic caching for a data resource collection
CN110233843B (en) User request processing method and device
CN115098528B (en) Service processing method, device, electronic equipment and computer readable storage medium
CN111367921A (en) Data object refreshing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200925

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman, British Islands

Applicant after: Advanced innovation technology Co.,Ltd.

Address before: A four-storey 847 mailbox in Grand Cayman Capital Building, British Cayman Islands

Applicant before: Alibaba Group Holding Ltd.

TA01 Transfer of patent application right
RJ01 Rejection of invention patent application after publication

Application publication date: 20191122

RJ01 Rejection of invention patent application after publication