CN114338562A - Priority scheduler, gateway and scheduling device - Google Patents

Priority scheduler, gateway and scheduling device Download PDF

Info

Publication number
CN114338562A
CN114338562A CN202011062208.8A CN202011062208A CN114338562A CN 114338562 A CN114338562 A CN 114338562A CN 202011062208 A CN202011062208 A CN 202011062208A CN 114338562 A CN114338562 A CN 114338562A
Authority
CN
China
Prior art keywords
priority
queue
user service
module
scheduler
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
CN202011062208.8A
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.)
Mifu Shenzhen Network Technology Co ltd
Original Assignee
Mifu Shenzhen Network 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 Mifu Shenzhen Network Technology Co ltd filed Critical Mifu Shenzhen Network Technology Co ltd
Priority to CN202011062208.8A priority Critical patent/CN114338562A/en
Publication of CN114338562A publication Critical patent/CN114338562A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Telephonic Communication Services (AREA)

Abstract

The application discloses a priority scheduler, a gateway and a scheduling device. The scheduler comprises a storage module, an identification module, a delivery module, a collection module and a processing module. The storage module is used for storing a preset priority queue, the identification module is used for identifying the priority of the user service request, the delivery module is used for putting the user service request into the corresponding priority queue according to the priority, the acquisition module is used for acquiring the user service request from the priority queue according to a preset proportion to form a queue to be processed, and the processing module is used for processing the queue to be processed and outputting a processing result. The scheduler extracts the user service requests put into the priority queue according to a preset proportion to form a queue to be processed, so that the non-critical service can be processed while the critical service is emphatically processed, and system resources are reasonably distributed.

Description

Priority scheduler, gateway and scheduling device
Technical Field
The present application relates to the field of software system technologies, and in particular, to a priority scheduler, a priority gateway, and a priority scheduling apparatus.
Background
With the continuous development of company business requirements, the micro-services operated by the bearer business are more and more. The API gateway serves as an intermediate layer between the client and the service micro-service cluster, the services exposed to the outside of the micro-service cluster are aggregated, all external systems needing to call the services need to be accessed through the API gateway, and based on the mode, unified management control can be performed on the API of the whole system.
In the conventional API gateway, access requests of clients are transmitted to a back-end micro-service system to be processed without difference, and in this way, under a concurrent scene or under a resource shortage condition, requests of non-critical services may occupy too many system resources, so that critical services such as orders, payment, inbound and outbound cannot obtain more processing resources, which is likely to cause system blocking, loading delay and the like, resulting in poor user experience and user loss.
Disclosure of Invention
The application provides a priority scheduler, a gateway and a scheduling device to solve the problem that non-critical services may occupy too much system resources to cause that critical services cannot be processed in time.
Specifically, the application provides a priority scheduler, which comprises a storage module, an identification module, a delivery module, a collection module and a processing module. The storage module is used for storing a preset priority queue, the identification module is used for identifying the priority of a user service request, the delivery module is used for putting the user service request into the corresponding priority queue according to the priority, the acquisition module is used for acquiring the user service request from the priority queue according to a preset proportion to form a queue to be processed, and the processing module is used for processing the queue to be processed and outputting a processing result.
In some embodiments, the storage module is further configured to store metadata of a mapping relationship between the user service request and the priority, and the identification module identifies the priority of the user service request according to the metadata.
In some embodiments, the user service request is placed in a default priority when the data of the user service request falls outside the metadata.
In some embodiments, the number of priority queues and the number of priorities are in a ratio of 1: a proportional mapping of N, wherein N is greater than or equal to 2.
In some embodiments, the acquiring module is further configured to acquire the user service request that is not executed within a preset interval time of the same priority queue, and increase a weight value of the user service request that is not acquired, so that the user service request can enter a next queue to be processed.
In some embodiments, the acquisition module is further configured to readjust the preset ratio when the number of the priority queues does not satisfy the preset ratio.
In some embodiments, the delivery module is further configured to obtain delivery times of the user service request within a preset time period, and adjust a weight value of the user service request according to the delivery times.
The present application further provides a gateway, which includes a gateway component and the scheduler according to any of the above embodiments, and the gateway component is connected to the scheduler.
In some embodiments, the gateway further comprises a configuration module for altering the priority queue.
The application also provides a scheduling device of service priority, the scheduling device comprises a back-end server and the gateway in any one of the above embodiments, and the back-end server is used for processing the information output by the gateway.
The scheduler, the network management and the scheduling device extract the user service requests put into the priority queue according to the preset proportion to form the queue to be processed, so that the non-critical service can be processed while the critical service is emphatically processed, and system resources are reasonably distributed.
Drawings
In order to make the aforementioned objects, features and advantages of the present application more comprehensible, preferred embodiments accompanied with figures are described in detail below:
fig. 1 is a schematic diagram of an application scenario of a scheduling apparatus according to an embodiment of the present invention.
Fig. 2 is a schematic block diagram of a scheduler applied to a gateway according to an embodiment of the present invention.
Fig. 3 is a schematic diagram illustrating a usage flow of a scheduler according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. The same or similar reference numerals refer to the same or similar elements or elements having the same or similar functions throughout. The embodiments described below with reference to the accompanying drawings are illustrative only for the purpose of explaining the present invention, and are not to be construed as limiting the present invention.
Referring to fig. 1, the present application provides a priority scheduler 100, where the scheduler 100 includes a storage module 11, an identification module 12, a delivery module 13, an acquisition module 14, and a processing module 15. The storage module 11 is configured to store a preset priority queue 111, the identification module 12 is configured to identify a priority of a user service request, the delivery module 13 is configured to put the user service request into the corresponding priority queue 111 according to the priority, the acquisition module 14 is configured to acquire the user service request from the priority queue 111 according to a preset proportion to form a queue to be processed 141, and the processing module 15 is configured to process the queue to be processed 141 and output a processing result.
The scheduler 100 of the present application collects the user service requests input into the priority queue 111 according to the preset proportion to form the queue 141 to be processed, so as to extract the critical service and the non-critical service according to the preset proportion, achieve processing of the non-critical service while emphasizing processing of the critical service, reasonably distribute system resources, and prevent service accumulation.
Specifically, referring to fig. 1 and fig. 2, the scheduler 100 of the present application is applied in a gateway 200, and a storage module 11 stores a priority queue 111 of user service requests. In some examples, the priority queues 111 include queue 1, queue 2, queue 3, queue 4, queue 5, wherein a larger value represents a greater importance of the weight value of the service request. That is, the importance of the service request in queue 5 is greater than the importance of the service requests in queues 1-4, and it is necessary to process the service request in queue 5 with priority or occupy more system resources. It should be noted that the number of the priority queues 111 includes but is not limited to this, and may also be 10, 100, 1000, etc., and may be determined according to the business requirements or the processing capacity of the system.
In some examples, the number of priority queues 111 and the number of priorities are in accordance with 1: and mapping the proportion of N, wherein N is greater than or equal to 2, the proportion supports dynamic adjustment and can be adjusted according to the calling times or frequency of the user service requests. Setting N to be greater than or equal to 2 can effectively avoid the expansion of the number of the corresponding priority queues 111 caused by excessive service request levels, thereby occupying a large amount of memory resources, and also can prevent backlog of requests of the low priority queues 111. The priority queues 111 are implemented in a heap (complete binary tree implemented in an array), and the order of the user service requests in each queue is determined by the weight value. In some examples, N =2, i.e. the number of priority queues 111 and the number of priorities is 1: 2, one queue corresponds to two priorities. In other examples, N may also be 3, 5, 8, 10, etc., and may be set according to actual needs.
Priority queue and priority distribution table
Figure DEST_PATH_IMAGE001
In some examples, more relevant user service requests are placed in the same priority queue, such as payment inbound and gate open, joining shopping cart, and payment. In other examples, the user service requests with greater similarity may also be stored in the same priority queue, such as approval and disapproval. And the user service requests with larger correlation or similarity are put into the same queue, so that the system can process the user service requests conveniently.
The storage module 11 further stores metadata of mapping relationships between the service requests of the users and priorities, where the priorities of the service requests represent importance levels of the service requests. In some examples, the storage module 11 is divided into 1-10 levels according to the related service requirements, and each level corresponds to one service. It should be noted that, the division of the service priority includes but is not limited to this, and may also be 20 levels, 100 levels, 500 levels, and so on, and may be set according to actual needs.
User service request and priority metadata corresponding table
Business Show(s) Message leaving method Default priority Order form Payment in-and-out station
Priority level 1 2 3 4 5 6 7 8 9 10
The identification module 12 identifies the priority of the user service request according to preset metadata. In some examples, the user is conducting a pay-for-inbound service, and the identification module 12 identifies that the user service request corresponds to a priority of 10 as the user service request passes through the gateway 200. In other examples, when the user performs a message leaving service and the user service request passes through the gateway 200, the identification module 12 identifies that the priority corresponding to the service request is 2.
The delivery module 13 assigns a weight value to the user service request service identified by the identification module 12, puts the user service request service into the corresponding priority queue 111 according to the priority, and confirms the ordering of the user service request in the priority queue 111 according to the weight value. The delivery module 13 will calculate the weight value of the service request from the parameters such as the number of calls, the call frequency, etc. of the user service request at regular time, so as to adjust the weight value of the user service request from the new one. In some examples, the pay-in service is located at the first-ranked position in queue 5, and the user-ongoing pay-in service is placed into the first-ranked position in queue 5 according to priority 10.
The user service request is preferentially extracted due to the large weight value, and after the user service request is collected, if the same user service request comes in, the user service request is collected next time, the user service request arranged behind the user service request continuously waits until the user service request with the high weight value is collected, and then the collection of the service data with the low weight value is rotated. Thus, important traffic can be always preferentially processed.
In some examples, the delivery module 13 is further configured to obtain service delivery times of the same priority queue in a preset time period, and adjust the level of the priority queue 111 according to the delivery times. Specifically, in a certain time period, the delivery volume of a queue with the same priority suddenly increases greatly, for example, the service volume of messages suddenly increases greatly in 5 minutes, the priority of the messages is increased to 8, and the message service requests are put into the queue 4, so that the message service requests can be processed in time, and the overstocked service requests of users are prevented. And when the message service request amount is restored to a normal level, restoring the original priority queue 1. Wherein the level of adjustment can be set as desired.
In some examples, the user service request is placed in a default priority when the data of the user service request falls outside of the metadata. Specifically, if the user is browsing a service and there is no corresponding service and priority in the metadata, the browsing service is identified as a default priority 6 and put into the queue 3.
In order to ensure the throughput of the high-priority request as much as possible and to perform the low-priority request at the same time, the acquisition module 14 acquires the user service requests from the priority queue 111 according to the weight values in a preset proportion to form a queue 141 to be processed, the requests in the same queue 141 to be processed are always arranged according to the height of the priority queue, and the requests in the same priority queue are always arranged according to the weight values. Therefore, important services can be guaranteed to have enough system resources to process, non-important services can be processed, the system resources are fully utilized, and the backlog of the services is prevented.
In some examples, the services in the priority queue 111 are extracted in 5 queues according to the importance degree of the services according to a preset ratio of 5:4:3:2:1, that is, the acquisition module 14 acquires 1 service from the queue 1, 2 services from the queue 2, 3 services from the queue 3, 4 services from the queue 4, and 5 services from the queue 5 to form a queue 141 to be processed, the services in the queue 5 are arranged according to the size of the weight value, and the other similar operations are performed. In other examples, the user service requests in the pending queue 111 need not be queued and the processing module 15 may concurrently process the services in the pending queue 111.
In some examples, the collecting module 14 is further configured to obtain a user service request that is not executed within a preset interval time of the same priority queue, and increase a weight value of the user service request that is not collected, so that the user service request can enter the next queue to be processed 141. Specifically, the acquiring module 14 acquires the user service request in the queue 1 that is not processed within 1 second, and then increases the weight value of the user service request that is not processed in the queue 1, so that the user service request in the queue 1 can enter the queue 141 to be processed. The preset interval time may be 0.2 second, 0.5 second, 0.8 second, 1.5 second, etc., and may be set as needed.
In some examples, the collecting module 14 is further configured to readjust the preset ratio when the number of the priority queues 111 does not satisfy the preset ratio. Specifically, the collection may not always be performed at the right proportion, and when the proportion is insufficient, the collection module 14 may replan the collection number of each queue from high to low according to the priority to ensure the normal operation of the related service. For example, when there are only 4 services in the queue 5, the collection module 14 can collect only 4 services, and to avoid wasting system resources, one service will be added in the queue 4 or a service that has not entered the queue before is added. Or, the resources are preferentially allocated to the priority with higher importance of the service. For another example, when no service exists in queue 1 of priority queue 111, the number of services in queue 5 or queue 4 is correspondingly increased, so as to avoid waste of system resources.
The processing module 15 includes a work thread pool, the work thread concurrently processes the user service in the queue 141 to be processed and outputs a processing result, and after the operation is completed, the processing module 15 transmits the request to the next component of the API gateway 200 for further processing (see fig. 3).
Referring to fig. 1 and fig. 2, the present application further provides a gateway 200, where the gateway 200 includes a gateway component 210 and a scheduler 100 according to any of the above embodiments, the gateway component 210 is connected to the scheduler 100, and the scheduler 100 is configured to receive and schedule priorities of user services.
The gateway 200 further comprises a configuration module 220, the configuration module 220 being configured to modify the priority queue 111 and the metadata. The manager can adjust the priority queue 111 or metadata, increase or decrease a preset ratio, and the like through the configuration module 220. For example, changing queue 5 to queue 4, changing the priority of the exposure service from 1 to 2, etc. by the configuration module 220. In other embodiments, the configuration module 220 may also be provided in the scheduler 100.
Configuration module 220 manages all behavioral configurations of all gateway components in business gateway 100. The gateway 100 will cache the configuration of the component in the local memory at startup and listen in real time for data changes of the configuration module 220. When the administrator changes the priority (including addition, deletion, modification) of the user service request, the gateway 200 will immediately update the corresponding priority policy, and the priority scheduler will complete the priority scheduling of the request according to the new configuration.
In one example, the riding type APP generally aggregates a great number of services, such as advertisements, notifications, two-dimensional code riding codes, passenger messages, and the like, and all the service requests are uniformly preprocessed by the API gateway and then forwarded to the back-end service bearer service cluster. The priorities of the services are different, for example, the service priority of the request of the two-dimensional code bus code is highest, the advertisement priority is lower, and the like. When a user opens an APP request bus code, the gateway can always ensure the request priority processing of the two-dimensional code bus code based on the service priority so as to reduce the waiting brake-off time of passengers, and other conventional service requests can also obtain execution opportunities.
Referring to fig. 1 and fig. 2, the present application further provides a scheduling apparatus 300 for service priority, where the scheduling apparatus 300 includes a backend server 310 and the gateway 200 according to any of the above embodiments, and the backend server 310 is configured to process information output by the gateway 200. The backend server 310 is the executor of the gateway 200 forwarding the requested real traffic. After the back-end server 310 executes the service request, the result is returned to the gateway 200, and finally the gateway 200 responds to the client.
The above description should not be taken as limiting the invention to the embodiments, but rather, as will be apparent to those skilled in the art to which the invention pertains, numerous simplifications or substitutions may be made without departing from the spirit of the invention, which shall be deemed to fall within the scope of the invention as defined by the claims appended hereto.

Claims (10)

1. A scheduler of priorities, the scheduler comprising:
the storage module is used for storing a preset priority queue;
the identification module is used for identifying the priority of the user service request;
the delivery module is used for putting the user service request into a corresponding priority queue according to the priority;
the acquisition module is used for acquiring the user service requests from the priority queue according to a preset proportion to form a queue to be processed;
and the processing module is used for processing the queue to be processed and outputting a processing result.
2. The scheduler of claim 1, wherein the storage module is further configured to store metadata of the mapping relationship between the user service request and the priority, and the identification module identifies the priority of the user service request according to the metadata.
3. The scheduler of claim 2, wherein the user service request is placed in a default priority when the data of the user service request is outside the metadata.
4. The scheduler of claim 1, wherein the number of priority queues and the number of priorities are in accordance with a 1: a proportional mapping of N, wherein N is greater than or equal to 2.
5. The scheduler of claim 4, wherein the collecting module is further configured to obtain the user service requests that are not executed within a preset interval time of the same priority queue, and increase a weight value of the user service requests that are not collected, so that the user service requests can enter a next queue to be processed.
6. The scheduler of claim 1, wherein the acquisition module is further configured to readjust the preset ratio when the number of priority queues does not satisfy the preset ratio.
7. The scheduler of claim 1, wherein the delivery module is further configured to obtain delivery times of the user service request within a preset time period, and adjust a weight value of the user service request according to the delivery times.
8. A gateway, characterized in that the gateway comprises a gateway component and a scheduler according to any of claims 1-7, the gateway component and the scheduler being connected.
9. The gateway of claim 8, further comprising a configuration module configured to change the priority queue.
10. A scheduling device for service priority, wherein the scheduling device comprises a backend server and the gateway of any one of claims 8 to 9, and the backend server is configured to process information output by the gateway.
CN202011062208.8A 2020-09-30 2020-09-30 Priority scheduler, gateway and scheduling device Pending CN114338562A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011062208.8A CN114338562A (en) 2020-09-30 2020-09-30 Priority scheduler, gateway and scheduling device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011062208.8A CN114338562A (en) 2020-09-30 2020-09-30 Priority scheduler, gateway and scheduling device

Publications (1)

Publication Number Publication Date
CN114338562A true CN114338562A (en) 2022-04-12

Family

ID=81011232

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011062208.8A Pending CN114338562A (en) 2020-09-30 2020-09-30 Priority scheduler, gateway and scheduling device

Country Status (1)

Country Link
CN (1) CN114338562A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277863A (en) * 2022-06-27 2022-11-01 中盈优创资讯科技有限公司 Scheduling method of API (application program interface) route

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115277863A (en) * 2022-06-27 2022-11-01 中盈优创资讯科技有限公司 Scheduling method of API (application program interface) route
CN115277863B (en) * 2022-06-27 2024-05-14 中盈优创资讯科技有限公司 Scheduling method of API (application program interface) route

Similar Documents

Publication Publication Date Title
CN107423120B (en) Task scheduling method and device
CN108776934B (en) Distributed data calculation method and device, computer equipment and readable storage medium
US20170126583A1 (en) Method and electronic device for bandwidth allocation based on online media services
US10554430B2 (en) Systems and methods for providing adaptive flow control in a notification architecture
CN107451853B (en) Method, device and system for real-time red packet distribution and storage medium
WO2020015047A1 (en) Storage capacity evaluation method and apparatus based on cdn application
CN109981702B (en) File storage method and system
CN108512672B (en) Service arranging method, service management method and device
US20240073298A1 (en) Intelligent scheduling apparatus and method
CN110830964B (en) Information scheduling method, internet of things platform and computer readable storage medium
WO2017075967A1 (en) Bandwidth allocation method and system for on-line media service
CN112445857A (en) Resource quota management method and device based on database
WO2017096842A1 (en) Content delivery task submission method and system
CN112053105A (en) Method and device for dividing service area
CN110838987B (en) Queue current limiting method and storage medium
CN114338562A (en) Priority scheduler, gateway and scheduling device
CN114116173A (en) Method, device and system for dynamically adjusting task allocation
CN112416558A (en) Service data processing method and device based on block chain and storage medium
CN116319810A (en) Flow control method, device, equipment, medium and product of distributed system
CN113329050B (en) Content distribution method and system
CN113538081B (en) Mall order system and processing method for realizing resource self-adaptive scheduling
CN110908810A (en) Message transmission method and device
CN115834712B (en) Gateway resource scheduling method for connection-oriented service
CN110795151A (en) Operator concurrency degree adjusting method, device and equipment
CN115586957B (en) Task scheduling system, method and device and electronic equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20220412

WD01 Invention patent application deemed withdrawn after publication