A critical resource scheduling method, device, equipment and storage medium
By combining load balancing and atomic increment techniques to handle resource requests, the problem of unfair scheduling of critical resources in high-concurrency scenarios is solved, achieving efficient and fair resource allocation.
Patent Information
- Application Number
- CN202210788088.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-07-04
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2042-07-04
AI Technical Summary
When critical resources are accessed concurrently, existing technologies cannot effectively solve the problems of resource blocking and waste, resulting in inefficient and unfair resource scheduling.
By combining load balancing and atomic increment techniques, the system receives resource requests, preprocesses them to determine the target resource request, and then retrieves and distributes the target critical resources from the critical resource pool.
It achieves efficient and fair critical resource scheduling in high-concurrency scenarios, avoiding resource blockage and waste.
Smart Images

Figure CN115328646B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a critical resource scheduling method, device and equipment and storage medium. BACKGROUND
[0002] Critical resource is a kind of shared resource that is not allowed to be used simultaneously, and the hardware belonging to critical resource includes memory, PCI bus, tape drive, printer and the like, and the software belonging to critical resource includes variable, array, message buffer queue and the like.Critical resource pool is a set composed of critical resources with the same attribute.
[0003] Generally, the resource sharing of critical resource pool is realized by using the queue mode, but when the critical resource is called in high concurrency, due to the uncertainty of critical resource release, it will inevitably cause the blocking and waste of critical resource.
[0004] Therefore, how to schedule critical resource efficiently and fairly in high concurrency scenario is a technical problem to be solved at present. SUMMARY
[0005] The present application provides a critical resource scheduling method, device and equipment and storage medium, which realizes efficient and fair scheduling of critical resource by combining load balancing technology and atomic self-increment technology.
[0006] In the first aspect, the present application provides a critical resource scheduling method, comprising:
[0007] receiving a plurality of initial resource requests sent by a plurality of preset users;
[0008] preprocessing the initial resource requests to determine a target resource request from the plurality of initial resource requests, wherein the preprocessing at least includes load balancing processing and atomic self-increment processing;
[0009] According to the target resource request, a target critical resource corresponding to the target resource request is retrieved from a preset critical resource pool, and the target critical resource is distributed to a target user corresponding to the target resource request.
[0010] Preferably, according to the critical resource scheduling method provided by the present application, comprising:
[0011] The preprocessing of the initial resource requests to determine a target resource request from the plurality of initial resource requests, comprising:
[0012] The initial resource requests are subjected to load balancing processing to obtain a plurality of resource request sets, wherein each resource request set includes at least one initial resource request;
[0013] Atomically increment the weight of each initial resource request in the plurality of resource request sets, to obtain a plurality of weight values corresponding to each initial resource request;
[0014] According to the weight values, determine a target resource request from the plurality of initial resource requests.
[0015] Preferably, the critical resource scheduling method provided by the application comprises:
[0016] According to the weight values, determine a target resource request from the plurality of initial resource requests.
[0017] Compare the weight value corresponding to each initial resource request with a preset maximum weight threshold value;
[0018] If the weight value is greater than the maximum weight threshold value, determine the initial resource request corresponding to the weight value as the target resource request.
[0019] Preferably, the critical resource scheduling method provided by the application comprises:
[0020] According to the target resource request, retrieve a target critical resource corresponding to the target resource request from a preset critical resource pool.
[0021] Based on a preset loop thread, update the resource state of an initial critical resource in the critical resource pool within a preset time period, and determine an effective critical resource from the initial critical resource according to the resource state.
[0022] According to the request instruction corresponding to the target resource request, retrieve the effective critical resource corresponding to the target resource request from the critical resource pool, and provide the target critical resource.
[0023] Preferably, the critical resource scheduling method provided by the application comprises:
[0024] Before the step of according to the request instruction corresponding to the target resource request, retrieving the effective critical resource corresponding to the target resource request from the critical resource pool, and providing the target critical resource, the method comprises:
[0025] According to the loop thread, count the number of effective resources of the effective critical resource in the critical resource pool.
[0026] If the number of effective resources is greater than a preset resource number, atomically decrement the number of effective resources.
[0027] Preferably, the critical resource scheduling method provided by the application comprises:
[0028] After the target critical resource is distributed to the target user corresponding to the target resource request, the method comprises:
[0029] The plurality of initial resource requests are stored in a preset ordered set, wherein the preset ordered set at least comprises a user ordered set and a time period ordered set;
[0030] The user ordered set and the time period ordered set are intersected to obtain a target ordered set;
[0031] The target resource request is screened out from the plurality of initial resource requests in the target ordered set.
[0032] In a second aspect, the present application further provides a critical resource scheduling device, comprising:
[0033] A receiving module is configured to receive a plurality of initial resource requests sent by a plurality of preset users;
[0034] A preprocessing module is configured to preprocess the initial resource requests and determine a target resource request from the plurality of initial resource requests, wherein the preprocessing at least comprises load balancing processing and atomic increment processing;
[0035] A distributed resource module is configured to retrieve a target critical resource corresponding to the target resource request from a preset critical resource pool according to the target resource request, and distribute the target critical resource to a target user corresponding to the target resource request.
[0036] In a third aspect, the present application further provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to realize the steps of the critical resource scheduling method as described above.
[0037] In a fourth aspect, the present application further provides a non-transitory computer readable storage medium, which stores a computer program, wherein the computer program is executed by a processor to realize the steps of the critical resource scheduling method as described above.
[0038] In a fifth aspect, the present application further provides a computer program product, comprising a computer program, wherein the computer program is executed by a processor to realize the steps of the critical resource scheduling method as described above.
[0039] The application provides a critical resource scheduling method, device and equipment and a storage medium. BRIEF DESCRIPTION OF DRAWINGS
[0040] In order to more clearly illustrate the technical solutions in the application or prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative effort.
[0041] Figure 1 is one of the flowcharts of the critical resource scheduling method provided by the application;
[0042] Figure 2 is one of the flowcharts of the step S200 in the application Figure 1 ;
[0043] Figure 3 is the second flowchart of the critical resource scheduling method provided by the application;
[0044] Figure 4 is the structural schematic diagram of the critical resource scheduling device provided by the application;
[0045] Figure 5 is the structural schematic diagram of the electronic equipment provided by the application. DETAILED DESCRIPTION
[0046] In order to make the purpose, technical solutions and advantages of the application more clear, the technical solutions in the application will be clearly and completely described in combination with the drawings in the application. Obviously, the described embodiments are some embodiments of the application, not all the embodiments. Based on the embodiments in the application, all the other embodiments obtained by those skilled in the art without creative effort belong to the protection scope of the application.
[0047] The application will be described in combination with Figures 1-5The application discloses a critical resource scheduling method, device and equipment and a storage medium.
[0048] The application is described in the embodiments as follows.
[0049] As shown in the figure, the application provides an implementation flowchart of a critical resource scheduling method, which can include but is not limited to steps S100-S300. Figure 1
[0050] S100, receiving a plurality of initial resource requests sent by a plurality of preset users;
[0051] S200, preprocessing the initial resource requests, and determining a target resource request from the initial resource requests, wherein the preprocessing at least includes load balancing processing and atomic self-increment processing;
[0052] S300, according to the target resource request, taking a target critical resource corresponding to the target resource request from a preset critical resource pool, and distributing the target critical resource to a target user corresponding to the target resource request.
[0053] In step S100 of some embodiments, a plurality of initial resource requests sent by a plurality of preset users are received. It can be understood that the scheduling server receives a plurality of initial resource requests sent by a plurality of preset users, which are used for preprocessing the initial resource requests, so that a plurality of user threads of the scheduling server receive the initial resource requests in parallel.
[0054] In step S200 of some embodiments, the initial resource requests are preprocessed, and a target resource request is determined from the initial resource requests. It can be understood that after the step S100 is executed, the specific execution step can be: performing load balancing processing on the initial resource requests to obtain a plurality of resource request sets, wherein each resource request set includes at least one initial resource request, performing atomic self-increment processing on the weight of each initial resource request in the plurality of resource request sets to obtain a plurality of weight values corresponding to each initial resource request, and performing comparison processing on the weight value and a preset maximum weight threshold; if the weight value is greater than the maximum weight threshold, the initial resource request corresponding to the weight value is determined as the target resource request.
[0055] It should be noted that the preprocessing at least includes load balancing processing and atomic self-increment processing.
[0056] In step S300 of some embodiments, according to the target resource request, a target critical resource corresponding to the target resource request is retrieved from a preset critical resource pool, and the target critical resource is distributed to a target user corresponding to the target resource request. It can be understood that after the step S200 of preprocessing the initial resource request is performed, the step of determining the target resource request from the plurality of initial resource requests is executed, the specific execution step can be that, first, based on a preset loop thread, the resource state of the initial critical resource in the critical resource pool is updated in a preset time period, the valid critical resource is determined from the initial critical resource according to the resource state, the number of valid resources of the valid critical resource in the critical resource pool is counted according to the loop thread, if the number of valid resources is greater than a preset resource number, the number of valid resources is atomically decremented, the valid critical resource corresponding to the target resource request is retrieved from the critical resource pool according to the request instruction corresponding to the target resource request, and the target critical resource is obtained.
[0057] In some embodiments, referring to Figure 2 It is shown that step S200 can also include but is not limited to steps S210 to S230.
[0058] S210, the initial resource request is load balanced to obtain a plurality of resource request sets, wherein each resource request set includes at least one initial resource request;
[0059] S220, respectively, the weight of the initial resource request in the plurality of resource request sets is atomically incremented to obtain a plurality of weight values corresponding to each initial resource request;
[0060] S230, according to the weight value, the target resource request is determined from the plurality of initial resource requests.
[0061] In step S210 of some embodiments, the initial resource request is load balanced to obtain a plurality of resource request sets. It can be understood that after the step S100 of receiving the plurality of initial resource requests issued by the plurality of preset users is executed, the specific execution step can be that: first, the plurality of initial resource requests are load balanced by using a load balancing device to obtain a plurality of resource request sets.
[0062] Referring to Figure 3As shown, there are four initial resource requests, such as a, b, c, and d. The load balancing device is used to process them in parallel, such as a and b initial resource requests are divided into group A resource request set, and c and d initial resource requests are divided into group B resource request set. Then the scheduling server calls user thread A to process the group A resource request set, and calls user thread B to process the group B resource request set.
[0063] It should be noted that each group of the resource request set includes at least one initial resource request.
[0064] In step S220 of some embodiments, the weights of the initial resource requests in the multiple groups of resource request sets are respectively processed by atomic self-increment, to obtain multiple weight values corresponding to each initial resource request. It can be understood that after the step of performing load balancing on the initial resource requests in step S210 to obtain multiple groups of resource request sets, the specific execution step can be: the weights of the initial resource requests in the multiple groups of resource request sets are respectively processed by atomic self-increment, to obtain weight values corresponding to each initial resource request.
[0065] For example, the atomic self-increment technology is used to process a and b initial resource requests in group A, to obtain corresponding weight values a1 and b1.
[0066] At the same time, similarly, c and d initial resource requests in group B are processed to obtain corresponding weight values c1 and d1.
[0067] In step S230 of some embodiments, a target resource request is determined from the multiple initial resource requests according to the weight values. It can be understood that after the step of performing atomic self-increment on the weights of the initial resource requests in the multiple groups of resource request sets in step S220 to obtain multiple weight values corresponding to each initial resource request, the specific execution step can be: comparing the weight value corresponding to each initial resource request with a preset maximum weight threshold; if the weight value is greater than the maximum weight threshold, the initial resource request corresponding to the weight value is determined as the target resource request.
[0068] In some embodiments, the target resource request is determined from the multiple initial resource requests according to the weight values, including:
[0069] comparing the weight value corresponding to each initial resource request with a preset maximum weight threshold;
[0070] if the weight value is greater than the maximum weight threshold, the initial resource request corresponding to the weight value is determined as the target resource request.
[0071] It can be understood that the weight value corresponding to each initial resource request determined in step S220 is compared with the maximum weight threshold MaxV.
[0072] If the weight value corresponding to the initial resource request is greater than the maximum weight threshold MaxV, it is determined that the initial resource request corresponding to the weight value is the target resource request.
[0073] That is, if the weight value a1 corresponding to an initial resource request a is greater than the maximum weight threshold MaxV, it is determined that the initial resource request a is the target resource request for distributing the target resource to the target resource request a.
[0074] It should be noted that, on the contrary, it is prompted that the resource request is queuing.
[0075] In some embodiments, the target critical resource corresponding to the target resource request is retrieved from the preset critical resource pool according to the target resource request, comprising:
[0076] Based on the preset loop thread, the resource state of the initial critical resource in the critical resource pool is updated in a preset time period, and the valid critical resource is determined from the initial critical resource according to the resource state;
[0077] According to the request instruction corresponding to the target resource request, the valid critical resource corresponding to the target resource request is retrieved from the critical resource pool, and the target critical resource is provided.
[0078] It can be understood that according to the loop thread of the scheduling server, the resource state of the initial critical resource in the critical resource pool is determined in a preset time period, such as 5 seconds, to determine whether it is in a valid state, so as to avoid that the initial critical resource is invalid or has no connection due to special circumstances, resulting in that its function cannot be called.
[0079] Thus, the initial critical resource in the critical resource pool is a valid critical resource.
[0080] The scheduling server retrieves the valid critical resource corresponding to the target resource request from the critical resource pool according to the request instruction corresponding to the target resource request a determined above, for example, the target resource request is to call the printer resource, and then the printer resource is selected from the valid critical resource and allocated to the target resource request.
[0081] It should be noted that the token information (Token) of the target critical resource includes: token validity period, available resource state and start parameter.
[0082] In some embodiments, before the step of fetching the valid critical resource corresponding to the target resource request from the critical resource pool according to the request instruction corresponding to the target resource request, the method comprises:
[0083] According to the loop thread of the scheduling server, counting the valid resource quantity of the valid critical resource in the critical resource pool;
[0084] If the valid resource quantity is greater than the preset resource quantity, atomically decrementing the valid resource quantity.
[0085] It can be understood that according to the loop thread of the scheduling server, the valid resource quantity of the valid critical resource in the critical resource pool is counted, and if the valid resource quantity is greater than the preset resource quantity, the valid resource quantity is atomically decremented. For example, the valid resource quantity is 3 and the preset resource quantity is 0, obviously 3 is greater than 0, which means that the critical pool still includes valid critical resources for allocation, so 1 is subtracted first, because the critical resource to be allocated needs to be allocated to the target resource request a.
[0086] Of course, if the valid resource quantity is less than or equal to the preset resource quantity 0, it means that there is no free valid critical resource in the critical resource pool. The current target user is prompted with information that there is no available valid critical resource.
[0087] In some embodiments, after the step of distributing the target critical resource to the target user corresponding to the target resource request, the method comprises:
[0088] Storing a plurality of initial resource requests in a preset ordered set, wherein the preset ordered set at least comprises a user ordered set and a period ordered set;
[0089] Performing an intersection processing on the user ordered set and the period ordered set to obtain a target ordered set;
[0090] Screening the target resource request from a plurality of initial resource requests in the target ordered set.
[0091] It can be understood that the plurality of initial resource requests received in step S100 are stored in a preset ordered set, and the preset ordered set can be Redis ZSet.
[0092] Redis (Remote Dictionary Server) is a key-value storage system, including string, list, set, zset (sorted set) and hash. These data types support push / pop, add / remove, intersection, union and difference, and more operations, and these operations are atomic. On this basis, Redis supports various ways of sorting, and in order to ensure efficiency, data is cached in memory. Redis periodically writes updated data to disk or writes modification operations to an append-only record file, and on this basis, master-slave synchronization is implemented.
[0093] It should be noted that the preset ordered set at least includes: a user ordered set and a period ordered set.
[0094] The intersection of the user ordered set and the period ordered set is processed to obtain a target ordered set. For example, the user ordered set includes A, B and C resource request sets, and the period ordered set only includes A and B resource request sets. It is indicated that the initial resource request in the C resource request set has cancelled the resource request. At this time, the intersection of the user ordered set and the period ordered set is the target ordered set, and the target ordered set includes A and B resource request sets.
[0095] The target resource request is filtered out from the plurality of initial resource requests in the target ordered set, that is, the target resource request a is filtered out from the plurality of initial resource requests in the A and B resource request sets, so as to avoid that the target resource request still competes for the target critical resource in the request queue after enjoying the target critical resource.
[0096] The application provides a critical resource scheduling method, which comprises the following steps: receiving a plurality of initial resource requests sent by a plurality of preset users; preprocessing the initial resource requests to determine a target resource request from the plurality of initial resource requests, wherein the preprocessing at least includes load balancing processing and atomic self-increment processing; according to the target resource request, calling a target critical resource corresponding to the target resource request from a preset critical resource pool, and distributing the target critical resource to a target user corresponding to the target resource request. The combination of the load balancing technology and the atomic self-increment technology realizes efficient and fair scheduling of critical resources.
[0097] A critical resource scheduling device provided by the application will be described below. The critical resource scheduling device described below can be correspondingly referred to the critical resource scheduling method described above.
[0098] Reference Figure 4 As shown in the figure, a critical resource scheduling device comprises:
[0099] The receiving module 410 is configured to receive a plurality of initial resource requests sent by a plurality of preset users.
[0100] The preprocessing module 420 is configured to preprocess the initial resource requests and determine a target resource request from the plurality of initial resource requests, wherein the preprocessing at least includes load balancing processing and atomic increment processing.
[0101] The distributed resource module 430 is configured to, according to the target resource request, call a target critical resource corresponding to the target resource request from a preset critical resource pool, and distribute the target critical resource to a target user corresponding to the target resource request.
[0102] According to the critical resource scheduling device provided by the application, the preprocessing module 420 is further configured to perform load balancing processing on the initial resource requests to obtain a plurality of resource request sets, wherein each resource request set includes at least one initial resource request.
[0103] The atomic increment processing is performed on the weights of the initial resource requests in the plurality of resource request sets respectively to obtain a plurality of weight values corresponding to each initial resource request.
[0104] The target resource request is determined from the plurality of initial resource requests according to the weight values.
[0105] According to the critical resource scheduling device provided by the application, the preprocessing module 420 is further configured to compare the weight value corresponding to each initial resource request with a preset maximum weight threshold.
[0106] If the weight value is greater than the maximum weight threshold, the initial resource request corresponding to the weight value is determined as the target resource request.
[0107] According to the critical resource scheduling device provided by the application, the distributed resource module 430 is further configured to, based on a preset loop thread, cyclically update a resource state of an initial critical resource in the critical resource pool within a preset time period, and determine an effective critical resource from the initial critical resource according to the resource state.
[0108] According to the request instruction corresponding to the target resource request, the effective critical resource corresponding to the target resource request is called from the critical resource pool to serve as the target critical resource.
[0109] According to the critical resource scheduling device provided by the application, the effective resource quantity of the effective critical resource in the critical resource pool is further counted according to the loop thread.
[0110] If the effective resource quantity is greater than the preset resource quantity, atomically decrementing the effective resource quantity.
[0111] The critical resource scheduling device provided by the application is also used for storing the plurality of initial resource requests in a preset ordered set, wherein the preset ordered set at least includes a user ordered set and a period ordered set.
[0112] The user ordered set and the period ordered set are intersected to obtain a target ordered set.
[0113] The target resource request is screened out from the plurality of initial resource requests in the target ordered set.
[0114] The critical resource scheduling device provided by the application receives a plurality of initial resource requests sent by a plurality of preset users, pre-processes the initial resource requests, determines a target resource request from the plurality of initial resource requests, wherein the pre-processing at least includes load balancing processing and atomic increment processing, according to the target resource request, takes a target critical resource corresponding to the target resource request from a preset critical resource pool, and distributes the target critical resource to a target user corresponding to the target resource request.
[0115] Figure 5 An example of an entity structure diagram of an electronic device is shown in Figure 5 The electronic device can include a processor 510, a communications interface 520, a memory 530 and a communications bus 540, wherein the processor 510, the communications interface 520 and the memory 530 complete mutual communication through the communications bus 540. The processor 510 can call a logical instruction in the memory 530 to execute a critical resource scheduling method, which includes receiving a plurality of initial resource requests sent by a plurality of preset users, pre-processing the initial resource requests, determining a target resource request from the plurality of initial resource requests, wherein the pre-processing at least includes load balancing processing and atomic increment processing, according to the target resource request, taking a target critical resource corresponding to the target resource request from a preset critical resource pool, and distributing the target critical resource to a target user corresponding to the target resource request.
[0116] In addition, the logic instructions in the memory 530 described above can be implemented in the form of software functional units and sold or used as independent products, and can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that contribute to the prior art or parts of the technical solutions can be embodied in the form of a software product. The computer software product is stored in a storage medium, and includes several instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various media that can store program codes.
[0117] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, so that the computer can execute a critical resource scheduling method provided by the above-mentioned methods. The method comprises the following steps: receiving a plurality of initial resource requests sent by a plurality of preset users; preprocessing the initial resource requests to determine a target resource request from the plurality of initial resource requests, wherein the preprocessing at least includes load balancing processing and atomic increment processing; according to the target resource request, calling a target critical resource corresponding to the target resource request from a preset critical resource pool, and distributing the target critical resource to a target user corresponding to the target resource request.
[0118] In another aspect, the present application also provides a computer program product, which comprises a computer program, the computer program can be stored on a non-transitory computer readable storage medium, and the computer program is executed by a processor, so that the computer can execute a critical resource scheduling method provided by the above-mentioned methods. The method comprises the following steps: receiving a plurality of initial resource requests sent by a plurality of preset users; preprocessing the initial resource requests to determine a target resource request from the plurality of initial resource requests, wherein the preprocessing at least includes load balancing processing and atomic increment processing; according to the target resource request, calling a target critical resource corresponding to the target resource request from a preset critical resource pool, and distributing the target critical resource to a target user corresponding to the target resource request.
[0119] The device embodiments described above are merely illustrative, wherein the units described as separate components can or can not be physically separate, and the components displayed as units can or can not be physical units, i.e., can be located in one place, or can be distributed to multiple network units. Part or all of the modules can be selected to achieve the purposes of the embodiments according to actual needs. Those skilled in the art can understand and implement without creative labor.
[0120] Through the description of the above embodiments, those skilled in the art can clearly understand that the embodiments can be realized by means of software and the necessary general hardware platform, and of course can also be realized by hardware. Based on such understanding, the above technical solutions can be embodied in the form of a software product, which can be stored in a computer readable storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server, or a network device, etc.) execute the methods described in each embodiment or some parts of the embodiments.
[0121] Finally, it should be noted that: the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.
Claims
1. A critical resource scheduling method, characterized in that, include: Receive multiple initial resource requests from multiple preset users; The initial resource requests are preprocessed to determine the target resource request from a plurality of initial resource requests, wherein the preprocessing includes at least: load balancing processing and atomic increment processing; The preprocessing further includes: The initial resource request is load balanced to obtain multiple sets of resource requests, wherein each set of resource requests includes at least one of the initial resource requests. The weights of the initial resource requests in the multiple sets of resource requests are atomically incremented to obtain multiple weight values corresponding to each initial resource request. Based on the weight value, the target resource request is determined from the plurality of initial resource requests, including: The weight value corresponding to each initial resource request is compared with a preset maximum weight threshold. If the weight value is greater than the maximum weight threshold, then the initial resource request corresponding to the weight value is determined to be the target resource request; According to the target resource request, the target critical resource corresponding to the target resource request is retrieved from the preset critical resource pool, and the target critical resource is distributed to the target user corresponding to the target resource request. The token information of the target critical resource includes: token validity period, available resource status and startup parameters.
2. The critical resource scheduling method according to claim 1, characterized in that, The step of retrieving the target critical resource corresponding to the target resource request from a preset critical resource pool according to the target resource request includes: Based on a preset loop thread, the resource status of the initial critical resources in the critical resource pool is updated cyclically within a preset time period, and effective critical resources are determined from the initial critical resources according to the resource status. According to the request instruction corresponding to the target resource request, the effective critical resource corresponding to the target resource request is retrieved from the critical resource pool, which is the target critical resource.
3. The critical resource scheduling method according to claim 2, characterized in that, Before retrieving the valid critical resource corresponding to the target resource request from the critical resource pool according to the request instruction corresponding to the target resource request, the method includes: Based on the loop thread, count the number of valid critical resources in the critical resource pool; If the number of effective resources is greater than the preset number of resources, then the number of effective resources is atomically decremented.
4. The critical resource scheduling method according to claim 1, characterized in that, After distributing the target critical resource to the target user corresponding to the target resource request, the method includes: The initial resource requests are stored in a preset ordered set, wherein the preset ordered set includes at least: a user ordered set and a period ordered set; The target ordered set is obtained by taking the intersection of the ordered set of users and the ordered set of periods. The target resource request is filtered out from the plurality of initial resource requests in the target ordered set.
5. A critical resource scheduling device, characterized in that, include: The receiving module is used to receive multiple initial resource requests from multiple preset users; A preprocessing module is used to preprocess the initial resource requests and determine the target resource request from a plurality of initial resource requests, wherein the preprocessing includes at least: load balancing processing and atomic increment processing; The preprocessing module further includes: The initial resource request is load balanced to obtain multiple sets of resource requests, wherein each set of resource requests includes at least one of the initial resource requests. The weights of the initial resource requests in the multiple sets of resource requests are atomically incremented to obtain multiple weight values corresponding to each initial resource request. Based on the weight value, the target resource request is determined from the plurality of initial resource requests, including: The weight value corresponding to each initial resource request is compared with a preset maximum weight threshold. If the weight value is greater than the maximum weight threshold, then the initial resource request corresponding to the weight value is determined to be the target resource request; The resource distribution module is used to retrieve the target critical resource corresponding to the target resource request from a preset critical resource pool according to the target resource request, and distribute the target critical resource to the target user corresponding to the target resource request. The token information of the target critical resource includes: token validity period, available resource status and startup parameters.
6. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the critical resource scheduling method as described in any one of claims 1 to 4.
7. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the critical resource scheduling method as described in any one of claims 1 to 4.
8. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the steps of the critical resource scheduling method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
YARN cluster resource scheduling method and system, medium and computer equipment
CN113535333A
Resource scheduling method and device, storage medium and electronic device
CN114327841A
Data processing method and system
CN114640681A