CN109391588B - Request processing method and device - Google Patents

Request processing method and device Download PDF

Info

Publication number
CN109391588B
CN109391588B CN201710661217.0A CN201710661217A CN109391588B CN 109391588 B CN109391588 B CN 109391588B CN 201710661217 A CN201710661217 A CN 201710661217A CN 109391588 B CN109391588 B CN 109391588B
Authority
CN
China
Prior art keywords
request
account
queue
target
service platform
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.)
Active
Application number
CN201710661217.0A
Other languages
Chinese (zh)
Other versions
CN109391588A (en
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.)
Beijing Gridsum Technology Co Ltd
Original Assignee
Beijing Gridsum Technology Co 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 Beijing Gridsum Technology Co Ltd filed Critical Beijing Gridsum Technology Co Ltd
Priority to CN201710661217.0A priority Critical patent/CN109391588B/en
Publication of CN109391588A publication Critical patent/CN109391588A/en
Application granted granted Critical
Publication of CN109391588B publication Critical patent/CN109391588B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L63/00Network architectures or network communication protocols for network security
    • H04L63/10Network architectures or network communication protocols for network security for controlling access to devices or network resources
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Computer Hardware Design (AREA)
  • Computer Security & Cryptography (AREA)
  • Computing Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Telephonic Communication Services (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the invention provides a request processing method and a request processing device, which are used for improving the access capacity of an access service platform, and the method comprises the following steps: determining a queue level of a pre-stored request queue, wherein the request queue comprises requests; acquiring a target account from an account pool, wherein the account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by a service platform, and the target account belongs to the plurality of active accounts; obtaining a request from a request queue; and sending a request to the service platform by using the target account. Therefore, the capacity of accessing the service platform is enlarged through the account number pool expansion, and the target account number for sending the request can be selected according to specific requirements according to the matching of the queue level and the account number level, so that the target account number can adapt to the specific situation of the request to be sent, and the processing efficiency of the request is improved.

Description

Request processing method and device
Technical Field
The present invention relates to the field of data processing, and in particular, to a request processing method and apparatus.
Background
At present, services for calling a service platform are limited by access of the service platform to a user request, some services are limited by an IP address of a requester, and some services are limited by an account number carried by the requester.
When a service platform restricts access to an account, for example, for a request of one account, the maximum permitted number of accesses Per Second (QPS) of the account is usually set for restriction, and if the service platform restricts that the account can only send a request to the service platform 5 times Per Second at most, the QPS is 5. If the frequency of sending requests to the service platform by using the account by the user exceeds the QPS, the service platform freezes the account for a period of time, namely the service platform does not process the requests sent by the account within the period of time so as to punish the account.
Therefore, when the service platform limits the account carried by the requester, and the user sends a request to the service platform through the account to call the service of the service platform, the service platform is excessively limited, and the number of the requests sent to the service platform by the user is limited within a period of time.
Disclosure of Invention
The embodiment of the invention provides a request processing method and device, a processor and a storage medium, which are used for improving the access capacity of an access service platform.
In order to solve the above technical problem, an embodiment of the present invention provides a request processing method, including:
determining a queue level of a pre-stored request queue, the request queue comprising requests;
acquiring a target account from an account pool, wherein the account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by a service platform, and the target account belongs to the plurality of active accounts;
obtaining the request from the request queue;
and sending the request to the service platform by using the target account.
In order to solve the above technical problem, an embodiment of the present invention further provides a request processing apparatus, including:
a determining unit, configured to determine a queue level of a pre-stored request queue, where the request queue includes requests;
a first obtaining unit, configured to obtain a target account from an account pool, where an account level of the target account corresponds to the queue level, the account pool prestores a plurality of active accounts of different account levels, the active accounts are accounts that are not frozen by a service platform, and the target account belongs to the plurality of active accounts;
a second obtaining unit, configured to obtain the request from the request queue;
a sending unit, configured to send the request to the service platform using the target account.
In order to solve the technical problem, an embodiment of the present invention further provides a processor, where the processor is configured to execute a program, and the program executes the request processing method as described above.
In order to solve the above technical problem, an embodiment of the present invention further provides a storage medium having a program stored thereon, where the program is executed by a processor to implement the request processing method as described above.
According to the technical scheme, the embodiment of the invention has the following advantages:
a queue level of a pre-stored request queue is determined, the request queue including requests. And then, acquiring a target account from an account pool, wherein the account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by the service platform, and the target account belongs to the plurality of active accounts. And then, acquiring the request from the request queue, and sending the request to the service platform by using the target account.
In this way, through the request queue saving request, the active account which is not frozen by the service platform is saved in the account pool, and after the target account corresponding to the account level and the queue level of the request queue is obtained from the account pool, the target account can be used for sending the request in the request queue to the service platform. The account number is expanded through the account number pool, a plurality of account numbers which can be accessed to the service platform can be used, compared with the condition that only one account number is used, the capacity of accessing the service platform is enlarged, and according to the matching of the queue grade and the account number grade, the target account number for sending the request can be selected according to specific requirements, so that the target account number can adapt to the specific condition of the request to be sent, and the processing efficiency of the request is improved.
Drawings
Fig. 1 is a diagram of a network architecture according to an embodiment of the present invention;
FIG. 2 is a flowchart of a method for processing a request according to another embodiment of the present invention;
FIG. 3 is a flowchart of a method for processing a request according to another embodiment of the present invention;
FIG. 4 is a schematic diagram of another implementation of the embodiment shown in FIG. 3;
fig. 5 is a schematic structural diagram of a request processing apparatus according to another embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a request processing method and device, which are used for improving the access capacity of an access service platform.
The request processing method and device can be applied to calling of services of a service platform, and refer to fig. 1, which is a network architecture diagram provided by an embodiment of the invention. The network architecture includes a client 101, a server 102, and a service platform 103. The client 101 includes, but is not limited to, a computer, a mobile phone, and a tablet computer, and a user may use the client 101 to send a request to the server 102, so that the server 102 performs processing according to the request, and sends the request to the service platform 103 to invoke a service of the service platform, and after obtaining an execution result of the request by the service platform 103, the server 102 may feed back the execution result to the client 101. The service platform 103 may be a mail service platform, a social service platform, or other third-party service platform.
The request processing method provided by the embodiment of the invention can be applied to the server 102, and the request processing device provided by the embodiment of the invention can be integrated on the server 102. In some embodiments, the request processing method can be applied to the client 101, and the request processing apparatus can be integrated on the client 101.
It is to be understood that the network architecture diagram is only an exemplary illustration of the embodiments of the present invention, and is not to be construed as a specific limitation of the embodiments of the present invention.
Referring to fig. 2, which is a flowchart of a method for processing a request according to an embodiment of the present invention, the method may be applied to the server shown in fig. 1, and the method for processing a request according to an embodiment of the present invention includes:
step 201: a queue level of a pre-stored request queue is determined.
The request queue includes requests.
Step 202: and acquiring the target account from the account pool.
The account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by the service platform, and the target account belongs to the plurality of active accounts;
step 203: the request is obtained from a request queue.
Step 204: and sending a request to the service platform by using the target account.
Alternatively,
the active accounts with different account grades correspond to different maximum access times QPS allowed per second, and the QPS is used for indicating the times of allowing the accounts to access the service platform within one second;
obtaining a request from a request queue, comprising:
and acquiring requests with the number less than or equal to the total number of QPSs of the target account from the request queue.
Alternatively,
the request queue comprises a plurality of request queues, and the queue grades of the plurality of request queues are different;
before determining the queue level of the pre-stored request queue, the method of the embodiment of the present invention further includes:
acquiring a target request and a request grade of the target request;
and adding the target request into a target request queue, wherein the request grade of the target request corresponds to the queue grade of the target request queue, and the target request queue is one of a plurality of request queues.
Alternatively,
before acquiring the target account from the account pool, the method of the embodiment of the present invention further includes:
acquiring a frozen list and current time, wherein the frozen list comprises frozen accounts and frozen time, the frozen accounts are the accounts frozen by the service platform at the frozen time, and the current time is the time when the frozen list is acquired;
when the difference value between the current time and the freezing time is greater than or equal to the preset unfreezing time, adding the frozen account number into an account number pool;
the frozen account number is deleted from the frozen list.
Alternatively,
after the target account is used to send a request to the service platform, the method of the embodiment of the present invention further includes:
acquiring freezing information sent by a service platform, wherein the freezing information is used for representing that the service platform freezes a target account;
recording the target freezing time of the target account frozen by the service platform;
adding the target account and the target freezing time into a freezing list;
acquiring another target account from the account pool;
and sending a request to the service platform by using another target account number.
Alternatively,
the request queue comprises a plurality of request queues, and the queue grades of the plurality of request queues are different;
after determining the queue level of the pre-stored request queue, the method according to the embodiment of the present invention further includes:
generating a working module corresponding to the module grade and the queue grade for each request queue;
acquiring a target account from an account pool, comprising:
acquiring a target account from an account pool through each working module, wherein the account level of the target account corresponds to the module level of the working module;
obtaining a request from a request queue, comprising:
acquiring a request from a request queue corresponding to a queue grade and a module grade of a working module through each working module;
sending a request to a service platform by using a target account, wherein the request comprises:
and sending a request to the service platform by using the target account through each working module.
In summary, by storing the request in the request queue, the active account not frozen by the service platform is stored in the account pool, and after the target account corresponding to the account level and the queue level of the request queue is obtained from the account pool, the target account can be used to send the request in the request queue to the service platform. The account number is expanded through the account number pool, a plurality of account numbers which can be accessed to the service platform can be used, compared with the condition that only one account number is used, the capacity of accessing the service platform is enlarged, and according to the matching of the queue grade and the account number grade, the target account number for sending the request can be selected according to specific requirements, so that the target account number can adapt to the specific condition of the request to be sent, and the processing efficiency of the request is improved.
Referring to fig. 3, which is a flowchart of a method for processing a request according to an embodiment of the present invention, the method is applied to the server shown in fig. 1, and with reference to the foregoing embodiments, the method for processing a request according to an embodiment of the present invention includes:
step 301: and acquiring the target request and the request level of the target request.
The server obtains a target request and a request level of the target request.
The request level may be set according to a preset rule, for example, the server prestores a correspondence between a URL of a request source and the request level, and after the server acquires the target request, the server determines a corresponding request level from the correspondence according to the URL of the target request, so as to obtain the request level of the target request; or, user identifiers are set for different requesters in advance, the corresponding relation between the user identifiers and the request levels is prestored in the server, and after the server acquires the target request, the corresponding request level is determined from the corresponding relation according to the user identifier of the user sending the target request, so that the request identifier of the target request is obtained. Alternatively, the request identification of the target request is customized by the user sending the request, and so on.
For example, a user sends an inquiry information request to a server at a client, and the server determines that the request level of the inquiry information request is level 1 from the pre-stored corresponding relationship between the IP address and the request level according to the IP address of the client.
Step 302: and adding the target request into a target request queue.
In the server, the request queue includes a plurality of request queues having different queue levels. The request level of the target request corresponds to a queue level of a target request queue, the target request queue being one of the plurality of request queues. The queue level can be preset in accordance with the request level. Among the plurality of request queues, there may be more than one request queue of the same rank.
After the server acquires the target request, the server adds the target request into a request queue for caching, specifically, the server prestores a corresponding relation between a request level and a queue level, and according to the corresponding relation, the server adds the target request into the target request queue of which the queue level corresponds to the request level of the target request for caching.
After performing step 301 and step 302 multiple times, the server allocates multiple requests to corresponding request queues for caching.
The request queue can ensure the stability of the service provided by the server, and when the processing capacity of the server is limited, when the operation of the server for processing the request reaches an extreme value, if no queue exists, the request sent to the server by the user later is discarded or abnormal operation is generated.
In some embodiments of the present invention, in order to provide more services for a user, after obtaining a request, a server generates a unique request identifier for the request, associates a request callback address with the request identifier, and returns the request identifier to a client, where a user of the client may query a processing result and a progress of the request according to the request identifier, or wait for a callback. The server processes the request to obtain a request result, determines the request callback address according to the corresponding relation between the request callback address and the request identifier, and sends the request result to the client according to the request callback address.
Step 303: a queue level of a pre-stored request queue is determined.
After the request queue includes the request, the server determines a queue level of the request queue to perform the following operations according to the queue level of the request queue including the request.
Step 304: and unfreezing the frozen account number.
In some embodiments of the present invention, the request processing method may include step 304. The frozen account is the account frozen by the service platform at the freezing time. After the service platform freezes the account number, the frozen account number cannot access the service platform, and the service platform does not process the request sent by the frozen account number.
The specific implementation of step 304 may be as follows:
step A1: a frozen list and a current time are obtained.
The frozen list comprises frozen accounts and freezing time, wherein the frozen accounts are the accounts frozen by the service platform at the freezing time. The current time is the time when the server acquired the frozen list.
Before processing the request, the server acquires a frozen list and traverses data of the frozen list, and each frozen account has corresponding freezing time in the frozen list.
Step A2: and when the difference value between the current time and the freezing time is greater than or equal to the preset unfreezing time, adding the frozen account into the account pool.
The account numbers stored in the account number pool are account numbers which are not frozen by the server, when the difference value between the current time and the freezing time is larger than or equal to the preset thawing time, namely the difference value between the current time and the freezing time is larger than or equal to the thawing time, the frozen account numbers are unfrozen by the service platform, so that the unfrozen account numbers can be used for sending requests to the service platform, and in order to fully utilize account number resources, the unfrozen account numbers are added into the account number pool to wait for use.
Step A3: the frozen account number is deleted from the frozen list.
It is understood that step 304 may not be included in embodiments of the present invention.
Step 305: and acquiring the target account from the account pool.
The account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by the service platform, and the target account belongs to the plurality of active accounts.
The corresponding relation between the queue level and the account number level is preset, and after the server determines the queue level of the request queue, the target account number corresponding to the account number level and the queue level is obtained from the account number pool according to the corresponding relation.
The active account can access the service platform, and the service platform processes a request sent by the active account. The account pool stores a plurality of active accounts having different account levels, and of course, the active accounts of the same account level in the account pool may include one or more active accounts.
There are various rules for setting the account level, for example, the number of times the request is sent by the account, the authority given by the service platform to the account, and the like, which is not specifically limited in the embodiment of the present invention. The account level of the account is divided by QPS (queries per second, maximum number of allowed accesses per second), where QPS is used to indicate the number of times the account is allowed to access the service platform in one second. For example, QPS ═ 5, which means that the service platform can be accessed at most 5 times per second. The QPSs owned by accounts of different levels are different; such as account QPS of account level 1 being 5, account QPS of account level 2 being 10, and so on.
For example, the server determines that a queue level of a request queue including the request is 1, the account pool includes a plurality of active accounts, and the preset queue level 1 corresponds to the account level 1, so that the server determines a target account with the account level 1 from the account pool.
It can be understood that the server may obtain one or more target accounts from the account pool, and specific data is determined according to business requirements, for example, when the number of requests in the request queue is large, a plurality of target accounts are obtained. If the account is not acquired from the account pool once, the acquisition operation can be repeatedly executed for a plurality of times according to the preset time interval.
In some embodiments of the present invention, after the target account is acquired by the server, the target account is deleted from the account pool to prepare for the subsequent step B4.
Step 306: the request is obtained from a request queue.
The server also needs to obtain the request from the request queue in step 303, so that the request of the request queue and the target account establish a corresponding relationship through the queue level and the account level. By setting and matching the queue level and the account number level, the target account number sending the request to the service platform can be adaptively selected, so that more practical scenes can be met.
In some embodiments of the present invention, when a request is added to a request queue according to a correspondence between a request level and a queue level, the correspondence between the request and an account will be more specific.
It can be understood that there are various specific implementation manners of step 306, and in some embodiments of the present invention, when active accounts with different account levels correspond to different QPSs, step 306 specifically includes: and acquiring requests with the number less than or equal to the total number of QPSs of the target account from the request queue. That is, the server obtains a certain number of request tasks from the request queue whose queue level corresponds to the account level of the target account, where the certain number corresponds to the total number of QPS of the target account, and for example, when QPS is 3, the server obtains 3 requests from the request queue within 1 second. In this way, requests processed by the server can be prevented from exceeding the QPS of the target account. In some embodiments of the present invention, if the total number of requests in the request queue of the currently fetched requests is smaller than the total number of QPS of the target account, the server may obtain the remaining number of requests from other request queues. The other request queue is not particularly limited in the embodiment of the present invention, and is not the current request queue. More preferably, the server obtains the remaining number of request tasks from a request queue with a queue level lower than the account level of the target account. Thus, the QPS resource of the target account can be fully utilized.
Step 307: and sending a request to the service platform by using the target account.
The server acquires the request and the target account, namely, the target account can be used for sending the request to the service platform, namely, the service platform is accessed, and the service platform is enabled to process the request.
In this way, through the request queue saving request, the active account which is not frozen by the service platform is saved in the account pool, and after the target account corresponding to the account level and the queue level of the request queue is obtained from the account pool, the target account can be used for sending the request in the request queue to the service platform. The account number is expanded through the account number pool, a plurality of account numbers which can be accessed to the service platform can be used, compared with the condition that only one account number is used, the capacity of accessing the service platform is enlarged, and according to the matching of the queue grade and the account number grade, the target account number for sending the request can be selected according to specific requirements, so that the target account number can adapt to the specific condition of the request to be sent, and the processing efficiency of the request is improved.
In some embodiments of the present invention, punishment processing may be performed on an account frozen by the service platform, and guarantee processing may be performed on successful execution of the request, where after the step of sending the request to the service platform using the target account, the method of the embodiments of the present invention further includes:
step B1: and acquiring the freezing information sent by the service platform.
The freezing information is used for indicating that the target account number is frozen by the service platform, and the target account number cannot send a request to the service platform again. The freeze information may be RateExceeded, for example, and represents an overspeed exception returned by the service platform for accessing an account exceeding the QPS.
For example, the QPS of the target account is 3, but the target account sends 4 requests to the service platform within 1 second, so that the service platform considers that the target account is abnormal, and sends freeze information to the server to indicate that the service platform freezes the target account.
Step B2: and recording the target freezing time of the target account frozen by the service platform.
In order to do more work on frozen accounts, the freezing time needs to be recorded.
Step B3: and adding the target account and the target freezing time into a freezing list.
The frozen list may be the frozen list of step a1 described above. The generation of the frozen list of step a1 can be realized through steps B1 to B3.
Step B4: and acquiring another target account from the account pool.
In order to continue processing the acquired request, the server also needs to acquire an active account from the account pool, where the account level of the active account corresponds to the queue level of the request queue to which the request to be sent belongs. That is, the server needs to acquire another target account, or the server re-executes steps 305 to 307.
Step B5: and sending a request to the service platform by using another target account number.
In some embodiments of the invention, after step 307, the service platform returns the result of the request processing for the request. At this time, the server may return the target account sending the request to the account pool, so that the target account continues to process other requests. And when the service platform returns a request processing result, the server determines a request identifier of a request corresponding to the request processing result according to the established corresponding relation between the request callback address and the request identifier, acquires the corresponding request callback address according to the request identifier of the request, and sends the acquired request processing result to the client according to the request callback address or informs a request user of the client of completing the request execution.
In some embodiments of the present invention, since the server may obtain a plurality of requests, there may be a plurality of request queues, so that the server may repeatedly perform steps 303 to 307.
In some embodiments of the present invention, a work module may be generated for the request queue to perform specific request processing, so as to improve the processing efficiency of the request. At this time, the request queue includes a plurality of request queues, and queue levels of different request queues of the plurality of request queues are different. After the step of determining the queue class of the pre-stored request queue, the method according to the embodiment of the present invention further includes: and generating a working module with a module grade corresponding to the queue grade for each request queue. That is, the server generates a work module for each request queue including requests, the generated work module includes module levels, the queue levels of the request queues are different, and the module level of the work module corresponds to the queue level of the request queue. If a request queue has no requests, the corresponding work module may not be generated. One or more work modules of corresponding module classes may also be generated for a request queue. The specific way of generating the working module may be to use the module generating unit to perform the generating operation.
Correspondingly:
step 305 specifically includes: and acquiring a target account from the account pool through each working module, wherein the account grade of the target account corresponds to the module grade of the working module. For details, reference is made to the above detailed description of step 305.
Namely, each working module acquires a target account from the account pool, and the account level of the target account corresponds to the module level of the working module. The number of the acquired target account numbers may be one or more.
Step 306 specifically includes: and acquiring the request from the request queue corresponding to the queue grade and the module grade of the working module through each working module.
That is, each work module obtains a request from the corresponding request queue, and the module level of the work module corresponds to the queue level of the request queue. For details, reference is made to the above detailed description of step 306.
Step 307 specifically includes: and sending a request to the service platform by using the target account through each working module.
That is, each working module sends a request to the service platform by using the acquired target account, and the details can be referred to the detailed description of step 307 above.
The steps are specifically executed through the working modules, and one working module corresponds to one processing resource, such as a corresponding thread, so that the multithread processing of the request is realized, and the processing efficiency is improved. The specific execution flow can be seen in fig. 4. After the work modules are generated for the request queues with different queue levels, because the work modules comprise module levels, the account level of the target account acquired by one work module from the account pool corresponds to the module level of the work module, and because the module level corresponds to the queue level, the target account also corresponds to the queue level.
Regarding generation of work modules, when the account level is related to the QPS, the server may generate one or more work modules for a request queue every second, in some embodiments, the work modules may be generated according to other time granularities, and the generation number of the work modules may also be determined according to a service.
In some embodiments of the present invention, a plurality of working modules with different module grades may be preset, and when a server needs a working module, the working module with the corresponding module grade may be obtained according to the queue grade of the request queue, so that a new working module does not need to be generated each time, resources are reasonably utilized, and execution efficiency is improved.
According to the description of the request processing method provided by the embodiment of the invention, different accounts have different account grades, so that the requests of the request queues corresponding to the queue grades can be processed according to the accounts of different account grades, for example, the account with a high grade preferentially processes the requests in the request queues with a high grade. In addition, according to the use condition, the active accounts in the account pool can be dynamically increased and decreased, and punishment is carried out on the frozen accounts according to the abnormal condition through the frozen list. Therefore, aiming at the problems of large operation amount and long time consumption of a single request, the method avoids the condition that the caller waits for overtime for a long time and simultaneously adds a queue mode for preventing the caller from wasting a large amount of system resources due to waiting. All requests are queued up for processing and the caller is notified after processing is complete.
The request processing method of the embodiment of the invention can expand the access capacity and speed by using the account pool under the condition that the service platform has limited access to the single account. And simultaneously, the request queues with different priorities are used, so that a caller is not blocked, and when the operation amount of a single request of the caller is large and time-consuming operation is executed, the caller does not waste system resources or have overtime exception due to long-time waiting for a processing result. Under the condition of frequent service calling of the service platform, the access capacity and speed of the request can be improved, the stability of the service is ensured, and the processing efficiency is improved.
Fig. 5 is a schematic structural diagram of a request processing device according to an embodiment of the present invention, where the request processing device can execute the request processing method according to the embodiments shown in fig. 2 and fig. 3, and the request processing device can be integrated on the server according to the embodiment shown in fig. 1.
Referring to fig. 5, the request processing apparatus according to the embodiment of the present invention includes:
a determining unit 501, configured to determine a queue level of a pre-stored request queue, where the request queue includes requests;
a first obtaining unit 502, configured to obtain a target account from an account pool, where an account level of the target account corresponds to a queue level, the account pool prestores a plurality of active accounts of different account levels, the active accounts are accounts that are not frozen by a service platform, and the target account belongs to the plurality of active accounts;
a second obtaining unit 503, configured to obtain a request from the request queue;
a sending unit 504, configured to send a request to the service platform using the target account.
Alternatively,
the active accounts with different account grades correspond to different maximum access times QPS allowed per second, and the QPS is used for indicating the times of allowing the accounts to access the service platform within one second;
the second obtaining unit 503 is further configured to obtain, from the request queue, a number of requests that is less than or equal to the total number of QPS of the target account.
Alternatively,
the request queue comprises a plurality of request queues, and the queue grades of the plurality of request queues are different;
the device of the embodiment of the invention also comprises:
a third obtaining unit 505, configured to obtain the target request and a request level of the target request;
the request adding unit 506 is configured to add the target request into a target request queue, where a request level of the target request corresponds to a queue level of the target request queue, and the target request queue is one of the plurality of request queues.
Alternatively,
the device of the embodiment of the invention also comprises:
a fourth obtaining unit 507, configured to obtain a freeze list and a current time, where the freeze list includes a freeze account and a freeze time, the freeze account is an account frozen by the service platform at the freeze time, and the current time is a time when the freeze list is obtained;
an account adding unit 508, configured to add the frozen account into an account pool when a difference between the current time and the freezing time is greater than or equal to a preset thawing time;
a deleting unit 509, configured to delete the frozen account from the frozen list.
Alternatively,
the device of the embodiment of the invention also comprises:
a fifth obtaining unit 510, configured to obtain freezing information sent by the service platform, where the freezing information is used to indicate that the service platform freezes the target account;
the recording unit 511 is configured to record a target freezing time when the target account is frozen by the service platform;
a frozen account adding unit 512, configured to add the target account and the target freezing time into a frozen list;
a first obtaining unit 502, configured to obtain another target account from the account pool;
the sending unit 504 is further configured to send a request to the service platform using another target account.
Alternatively,
the request queue comprises a plurality of request queues, and the queue grades of the plurality of request queues are different;
the apparatus of an embodiment of the present invention further comprises a generating unit 513,
a generating unit 513, configured to generate a work module corresponding to the module class and the queue class for each request queue;
the first obtaining unit 502 is further configured to obtain, by each work module, a target account from the account pool, where an account level of the target account corresponds to a module level of the work module;
the second obtaining unit 503 is further configured to obtain, through each work module, a request from a request queue whose queue level corresponds to the module level of the work module;
the sending unit 504 is further configured to send, through each work module, a request to the service platform by using the target account.
In summary, the determining unit 501 determines a queue level of a pre-stored request queue, which includes requests. Then, the first obtaining unit 502 obtains a target account from an account pool, where an account level of the target account corresponds to the queue level, the account pool pre-stores a plurality of active accounts with different account levels, the active accounts are accounts that are not frozen by the service platform, and the target account belongs to the plurality of active accounts. Subsequently, the second obtaining unit 503 obtains the request from the request queue, and the sending unit 504 sends the request to the service platform by using the target account. In this way, through the request queue saving request, the active account which is not frozen by the service platform is saved in the account pool, and after the target account corresponding to the account level and the queue level of the request queue is obtained from the account pool, the target account can be used for sending the request in the request queue to the service platform. The account number is expanded through the account number pool, a plurality of account numbers which can be accessed to the service platform can be used, compared with the condition that only one account number is used, the capacity of accessing the service platform is enlarged, and according to the matching of the queue grade and the account number grade, the target account number for sending the request can be selected according to specific requirements, so that the target account number can adapt to the specific condition of the request to be sent, and the processing efficiency of the request is improved.
The request processing device comprises a processor and a memory, wherein the determining unit, the first acquiring unit, the second acquiring unit, the sending unit and the like are stored in the memory as program units, and the processor executes the program units stored in the memory to realize corresponding functions.
The processor comprises a kernel, and the kernel calls the corresponding program unit from the memory. The kernel can be set to be one or more, and the access capacity of the service platform is improved by adjusting the kernel parameters.
The memory may include volatile memory in a computer readable medium, Random Access Memory (RAM) and/or nonvolatile memory such as Read Only Memory (ROM) or flash memory (flash RAM), and the memory includes at least one memory chip.
An embodiment of the present invention provides a storage medium on which a program is stored, the program implementing the request processing method when executed by a processor.
The embodiment of the invention provides a processor, which is used for running a program, wherein the request processing method is executed when the program runs.
The embodiment of the invention provides equipment, which comprises a processor, a memory and a program which is stored on the memory and can run on the processor, wherein the processor executes the program and realizes the following steps:
determining a queue level of a pre-stored request queue, wherein the request queue comprises requests;
acquiring a target account from an account pool, wherein the account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by a service platform, and the target account belongs to the plurality of active accounts;
obtaining a request from a request queue;
and sending a request to the service platform by using the target account.
Optionally, the active accounts with different account levels correspond to different maximum access times per second QPS, where QPS is used to indicate the number of times that an account allows access to the service platform in one second, and the processor executes the program and further implements the following steps:
and acquiring requests with the number less than or equal to the total number of QPSs of the target account from the request queue.
Optionally, the request queue includes a plurality of request queues, the queue levels of the plurality of request queues are different, and the processor executes the program to further implement the following steps:
acquiring a target request and a request grade of the target request;
and adding the target request into a target request queue, wherein the request grade of the target request corresponds to the queue grade of the target request queue, and the target request queue is one of a plurality of request queues.
Optionally, the processor executes the program to further implement the following steps:
acquiring a frozen list and current time, wherein the frozen list comprises frozen accounts and frozen time, the frozen accounts are the accounts frozen by the service platform at the frozen time, and the current time is the time when the frozen list is acquired;
when the difference value between the current time and the freezing time is greater than or equal to the preset unfreezing time, adding the frozen account number into an account number pool;
the frozen account number is deleted from the frozen list.
Optionally, the processor executes the program to further implement the following steps:
acquiring freezing information sent by a service platform, wherein the freezing information is used for representing that the service platform freezes a target account;
recording the target freezing time of the target account frozen by the service platform;
adding the target account and the target freezing time into a freezing list;
acquiring another target account from the account pool;
and sending a request to the service platform by using another target account number.
Optionally, the request queue includes a plurality of request queues, the queue levels of the plurality of request queues are different, and the processor executes the program to further implement the following steps:
generating a working module corresponding to the module grade and the queue grade for each request queue;
acquiring a target account from an account pool through each working module, wherein the account level of the target account corresponds to the module level of the working module;
acquiring a request from a request queue corresponding to a queue grade and a module grade of a working module through each working module;
and sending a request to the service platform by using the target account through each working module.
The device herein may be a server, a PC, a PAD, a mobile phone, etc.
The present application further provides a computer program product adapted to perform program code for initializing the following method steps when executed on a data processing device:
determining a queue level of a pre-stored request queue, wherein the request queue comprises requests;
acquiring a target account from an account pool, wherein the account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by a service platform, and the target account belongs to the plurality of active accounts;
obtaining a request from a request queue;
and sending a request to the service platform by using the target account.
Optionally, the program code further comprises:
the active accounts with different account grades correspond to different maximum access times QPS allowed per second, and the QPS is used for indicating the times of allowing the accounts to access the service platform within one second;
and acquiring requests with the number less than or equal to the total number of QPSs of the target account from the request queue.
Optionally, the program code further comprises:
the request queue comprises a plurality of request queues, and the queue grades of the plurality of request queues are different;
prior to determining the queue level of the pre-stored request queue,
acquiring a target request and a request grade of the target request;
and adding the target request into a target request queue, wherein the request grade of the target request corresponds to the queue grade of the target request queue, and the target request queue is one of a plurality of request queues.
Optionally, the program code further comprises:
acquiring a frozen list and current time, wherein the frozen list comprises frozen accounts and frozen time, the frozen accounts are the accounts frozen by the service platform at the frozen time, and the current time is the time when the frozen list is acquired;
when the difference value between the current time and the freezing time is greater than or equal to the preset unfreezing time, adding the frozen account number into an account number pool;
the frozen account number is deleted from the frozen list.
Optionally, the program code further comprises:
acquiring freezing information sent by a service platform, wherein the freezing information is used for representing that the service platform freezes a target account;
recording the target freezing time of the target account frozen by the service platform;
adding the target account and the target freezing time into a freezing list;
acquiring another target account from the account pool;
and sending a request to the service platform by using another target account number.
Optionally, the program code further comprises:
the request queue comprises a plurality of request queues, and the queue grades of the plurality of request queues are different;
generating a working module corresponding to the module grade and the queue grade for each request queue;
acquiring a target account from an account pool through each working module, wherein the account level of the target account corresponds to the module level of the working module;
acquiring a request from a request queue corresponding to a queue grade and a module grade of a working module through each working module;
and sending a request to the service platform by using the target account through each working module.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In a typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include forms of volatile memory in a computer readable medium, Random Access Memory (RAM) and/or non-volatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). The memory is an example of a computer-readable medium.
Computer-readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), Digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium that can be used to store information that can be accessed by a computing device. As defined herein, a computer readable medium does not include a transitory computer readable medium such as a modulated data signal and a carrier wave.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in the process, method, article, or apparatus that comprises the element.
As will be appreciated by one skilled in the art, embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The above are merely examples of the present application and are not intended to limit the present application. Various modifications and changes may occur to those skilled in the art. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.

Claims (10)

1. A method for processing a request, comprising:
determining a queue level of a pre-stored request queue, the request queue comprising requests;
acquiring a target account from an account pool, wherein the account level of the target account corresponds to the queue level, a plurality of active accounts with different account levels are prestored in the account pool, the active accounts are not frozen by a service platform, and the target account belongs to the plurality of active accounts;
obtaining the request from the request queue;
and sending the request to the service platform by using the target account.
2. The method of claim 1,
the active accounts with different account grades correspond to different maximum access times per second QPS, and the QPS is used for representing the times that the accounts are allowed to access the service platform within one second;
the obtaining the request from the request queue includes:
obtaining requests with the number less than or equal to the total number of QPS of the target account from the request queue.
3. The method of claim 1,
the request queue comprises a plurality of request queues, and the queue levels of the plurality of request queues are different;
before determining the queue level of the pre-stored request queue, the method further includes:
acquiring a target request and a request grade of the target request;
and adding the target request into a target request queue, wherein the request level of the target request corresponds to the queue level of the target request queue, and the target request queue is one of the request queues.
4. The method of claim 1,
before the obtaining of the target account from the account pool, the method further includes:
acquiring a frozen list and current time, wherein the frozen list comprises frozen accounts and frozen time, the frozen accounts are accounts frozen by the service platform at the frozen time, and the current time is the time when the frozen list is acquired;
when the difference value between the current time and the freezing time is greater than or equal to the preset unfreezing time, adding the frozen account into the account pool;
deleting the frozen account number from the frozen list.
5. The method of claim 4,
after the request is sent to the service platform by using the target account, the method further includes:
acquiring freezing information sent by the service platform, wherein the freezing information is used for indicating that the service platform freezes the target account;
recording the target freezing time of the target account frozen by the service platform;
adding the target account and the target freezing time into the freezing list;
acquiring another target account from the account pool;
and sending the request to the service platform by using the other target account.
6. The method of claim 1,
the request queue comprises a plurality of request queues, and the queue levels of the plurality of request queues are different;
after determining the queue level of the pre-stored request queue, the method further includes:
generating a working module corresponding to the module grade and the queue grade for each request queue;
the obtaining of the target account from the account pool includes:
acquiring a target account from an account pool through each working module, wherein the account level of the target account corresponds to the module level of the working module;
the obtaining the request from the request queue includes:
acquiring the request from a request queue corresponding to the queue grade and the module grade of the working module through each working module;
the sending the request to the service platform using the target account number includes:
and sending the request to the service platform by using the target account through each working module.
7. A request processing apparatus, comprising:
a determining unit, configured to determine a queue level of a pre-stored request queue, where the request queue includes requests;
a first obtaining unit, configured to obtain a target account from an account pool, where an account level of the target account corresponds to the queue level, the account pool prestores a plurality of active accounts of different account levels, the active accounts are accounts that are not frozen by a service platform, and the target account belongs to the plurality of active accounts;
a second obtaining unit, configured to obtain the request from the request queue;
a sending unit, configured to send the request to the service platform using the target account.
8. The apparatus of claim 7,
the active accounts with different account grades correspond to different maximum access times per second QPS, and the QPS is used for representing the times that the accounts are allowed to access the service platform within one second;
the second obtaining unit is further configured to obtain, from the request queue, a number of requests that is less than or equal to the total number of QPS of the target account.
9. A request processing apparatus comprising a processor, a memory and a program stored on the memory and executable on the processor, the program when executed by the processor implementing the method of any one of claims 1 to 6.
10. A storage medium, having stored thereon a program which, when executed by a processor, carries out the method of any one of claims 1 to 6.
CN201710661217.0A 2017-08-04 2017-08-04 Request processing method and device Active CN109391588B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710661217.0A CN109391588B (en) 2017-08-04 2017-08-04 Request processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710661217.0A CN109391588B (en) 2017-08-04 2017-08-04 Request processing method and device

Publications (2)

Publication Number Publication Date
CN109391588A CN109391588A (en) 2019-02-26
CN109391588B true CN109391588B (en) 2021-03-12

Family

ID=65413705

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710661217.0A Active CN109391588B (en) 2017-08-04 2017-08-04 Request processing method and device

Country Status (1)

Country Link
CN (1) CN109391588B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001052518A1 (en) * 2000-01-07 2001-07-19 Vesta Corporation Fraud prevention system and method
CN103136056A (en) * 2013-03-04 2013-06-05 浪潮电子信息产业股份有限公司 Cloud computing platform scheduling method
CN103973691A (en) * 2014-05-09 2014-08-06 北京智谷睿拓技术服务有限公司 Resource access method and resource access device
CN104243405A (en) * 2013-06-08 2014-12-24 华为技术有限公司 Request processing method, device and system
CN104270362A (en) * 2014-09-29 2015-01-07 广州华多网络科技有限公司 Request handling method and device
CN104506584A (en) * 2014-12-08 2015-04-08 畅捷通信息技术股份有限公司 Request processing method and request processing device

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2001052518A1 (en) * 2000-01-07 2001-07-19 Vesta Corporation Fraud prevention system and method
CN103136056A (en) * 2013-03-04 2013-06-05 浪潮电子信息产业股份有限公司 Cloud computing platform scheduling method
CN104243405A (en) * 2013-06-08 2014-12-24 华为技术有限公司 Request processing method, device and system
CN103973691A (en) * 2014-05-09 2014-08-06 北京智谷睿拓技术服务有限公司 Resource access method and resource access device
CN104270362A (en) * 2014-09-29 2015-01-07 广州华多网络科技有限公司 Request handling method and device
CN104506584A (en) * 2014-12-08 2015-04-08 畅捷通信息技术股份有限公司 Request processing method and request processing device

Also Published As

Publication number Publication date
CN109391588A (en) 2019-02-26

Similar Documents

Publication Publication Date Title
US11431794B2 (en) Service deployment method and function management platform under serverless architecture
US10248467B2 (en) Code execution request routing
US10528390B2 (en) Idempotent task execution in on-demand network code execution systems
CN109375872B (en) Data access request processing method, device and equipment and storage medium
US10725826B1 (en) Serializing duration-limited task executions in an on demand code execution system
TWI752994B (en) Application expansion method, device and system
US10789085B2 (en) Selectively providing virtual machine through actual measurement of efficiency of power usage
JP5744707B2 (en) Computer-implemented method, computer program, and system for memory usage query governor (memory usage query governor)
CN110383764B (en) System and method for processing events using historical data in a serverless system
CN107026879B (en) Data caching method and background application system
US20180196603A1 (en) Memory Management Method, Apparatus, and System
CN109582649B (en) Metadata storage method, device and equipment and readable storage medium
CN108475201B (en) Data acquisition method in virtual machine starting process and cloud computing system
CN103399791A (en) Method and device for migrating virtual machines on basis of cloud computing
US11144359B1 (en) Managing sandbox reuse in an on-demand code execution system
CN111338803B (en) Thread processing method and device
CN109391588B (en) Request processing method and device
US20220217097A1 (en) Method and system for allocating and managing cloud resources
CN115048186A (en) Method and device for processing expansion and contraction of service container, storage medium and electronic equipment
CN115686746A (en) Access method, task processing method, computing device, and computer storage medium
US10992743B1 (en) Dynamic cache fleet management
CN113961586A (en) Control method and device for SQL (structured query language) statements
US20170063976A1 (en) Dynamic record-level sharing (rls) provisioning inside a data-sharing subsystem
CN112583862A (en) Data concurrent processing method and device, storage medium and equipment
CN109391589B (en) Request processing 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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 100080 No. 401, 4th Floor, Haitai Building, 229 North Fourth Ring Road, Haidian District, Beijing

Applicant after: Beijing Guoshuang Technology Co.,Ltd.

Address before: 100086 Beijing city Haidian District Shuangyushu Area No. 76 Zhichun Road cuigongfandian 8 layer A

Applicant before: Beijing Guoshuang Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant