WO2021017304A1 - 基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质 - Google Patents

基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质 Download PDF

Info

Publication number
WO2021017304A1
WO2021017304A1 PCT/CN2019/118060 CN2019118060W WO2021017304A1 WO 2021017304 A1 WO2021017304 A1 WO 2021017304A1 CN 2019118060 W CN2019118060 W CN 2019118060W WO 2021017304 A1 WO2021017304 A1 WO 2021017304A1
Authority
WO
WIPO (PCT)
Prior art keywords
pool
target
object pool
returned
pools
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.)
Ceased
Application number
PCT/CN2019/118060
Other languages
English (en)
French (fr)
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.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Publication of WO2021017304A1 publication Critical patent/WO2021017304A1/zh
Anticipated expiration legal-status Critical
Ceased legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals

Definitions

  • This application relates to the field of cloud storage technology, and in particular to a scheduling method, system, electronic device, and computer-readable storage medium based on a shared object pool.
  • object pools have been widely used in Internet technology. By introducing the object pool, the system overhead of creating each object from scratch can be effectively reduced. In actual applications, if you need to activate the object, you can directly extract it from the object pool; if you deactivate the object, put the object back into the object pool, and the object pool can continue to wait for the next request to use the object.
  • the inventor of this application realizes that the current calls to objects in the object pool are mainly for specific services, that is, the objects in each type of object pool are only applicable to a certain function, for example, the connection pool can only operate on the network. Connected function. It can be seen that in the prior art, the use of each object pool is independent, and there is no sharing situation, so that the processor memory resources are not effectively used and the resource utilization rate is low.
  • one purpose of the present application is to provide a scheduling method, system, electronic device, and computer-readable storage medium based on a shared object pool.
  • a scheduling method based on a shared object pool includes: receiving an object acquisition request, the object acquisition request being used to acquire a target type of object; according to the object acquisition request, determining whether there is a request queue in all object pools Is an empty target object pool; if the target object pool exists, check whether there are objects of the target type stored in the target object pool; if there are objects of the target type stored, trigger the object dispatch thread from all The target object pool acquires objects of the target type.
  • a scheduling system based on a shared object pool includes: a receiving unit for receiving an object acquisition request, the object acquisition request is for acquiring an object of a target type; a judging unit, for judging according to the object acquisition request Whether there is a target object pool with an empty request queue in all object pools; a detection unit for detecting whether the target object pool is stored in the target object pool when the judgment unit determines that the target object pool exists Object; an acquisition unit, configured to trigger an object dispatch thread to acquire the object of the target type from the target object pool through an interface when the detection unit detects that the object of the target type is stored.
  • an electronic device includes: a processor; and
  • a memory configured to store a scheduling program based on the shared object pool of the processor; wherein the processor is configured to execute the scheduling method based on the shared object pool as described above by executing the scheduling program based on the shared object pool .
  • a computer-readable storage medium stores a scheduler based on a shared object pool, characterized in that, when the scheduler based on a shared object pool is executed by a processor, the aforementioned shared object-based The scheduling method of the pool.
  • a computer program product includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute as described in the first aspect of the embodiment of the present invention Or any possible implementation of the first aspect.
  • the target object pool whose request queue is empty can be found in each object pool, and whether there is an object of the target type in the target object pool, and if it exists, the target is acquired Type of object. It can be seen that this method allows the objects of each object pool to be shared, thus improving resource utilization.
  • Fig. 1 is a schematic diagram showing a device according to an exemplary embodiment
  • Fig. 2 is a flow chart showing a scheduling method based on a shared object pool according to an exemplary embodiment
  • Fig. 3 is a flowchart showing a scheduling method based on a shared object pool according to another exemplary embodiment
  • Fig. 4 is a block diagram showing a scheduling system based on a shared object pool according to an exemplary embodiment
  • Fig. 5 is a block diagram showing another scheduling system based on a shared object pool according to an exemplary embodiment.
  • Fig. 1 is a schematic diagram showing a device according to an exemplary embodiment.
  • the apparatus 100 may be an electronic device.
  • the device 100 may include one or more of the following components: a processing component 102, a memory 104, a power supply component 106, a multimedia component 108, an audio component 110, a sensor component 114, and a communication component 116.
  • the processing component 102 generally controls the overall operations of the device 100, such as operations associated with display, telephone calls, data communications, camera operations, and recording operations.
  • the processing component 102 may include one or more processors 118 to execute instructions to complete all or part of the steps of the following method.
  • the processing component 102 may include one or more modules to facilitate the interaction between the processing component 102 and other components.
  • the processing component 102 may include a multimedia module to facilitate the interaction between the multimedia component 108 and the processing component 102.
  • the memory 104 is configured to store various types of data to support operations in the device 100. Examples of these data include instructions for any application or method operating on the device 100.
  • the memory 104 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, SRAM for short), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory) Erasable Programmable Read-Only Memory (EEPROM), Erasable Programmable Read-Only Memory (EPROM), Programmable Red-Only Memory (PROM), Read-only memory ( Read-Only Memory, ROM for short), magnetic storage, flash memory, magnetic disk or optical disk.
  • the memory 104 also stores one or more modules, and the one or more modules are configured to be executed by the one or more processors 118 to complete all or part of the steps in the method shown below.
  • the power supply component 106 provides power to various components of the device 100.
  • the power supply component 106 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power for the device 100.
  • the multimedia component 108 includes a screen that provides an output interface between the device 100 and the user.
  • the screen may include a liquid crystal display (Liquid Crystal Display, LCD for short) and a touch panel. If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user.
  • the touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundary of a touch or slide action, but also detect the duration and pressure related to the touch or slide operation.
  • the screen may also include an organic electroluminescence display (Organic Light Emitting Display, OLED for short).
  • the audio component 110 is configured to output and/or input audio signals.
  • the audio component 110 includes a microphone (Microphone, MIC for short).
  • the microphone is configured to receive external audio signals.
  • the received audio signal can be further stored in the memory 104 or sent via the communication component 116.
  • the audio component 110 further includes a speaker for outputting audio signals.
  • the sensor component 114 includes one or more sensors for providing the device 100 with various aspects of state evaluation.
  • the sensor component 114 can detect the open/close state of the device 100 and the relative positioning of components.
  • the sensor component 114 can also detect the position change of the device 100 or a component of the device 100 and the temperature change of the device 100.
  • the sensor component 114 may also include a magnetic sensor, a pressure sensor or a temperature sensor.
  • the communication component 116 is configured to facilitate wired or wireless communication between the apparatus 100 and other devices.
  • the device 100 can access a wireless network based on a communication standard, such as WiFi (Wireless-Fidelity, wireless fidelity).
  • the communication component 116 receives a broadcast signal or broadcast related information from an external broadcast management system via a broadcast channel.
  • the communication component 116 further includes a near field communication (Near Field Communication, NFC for short) module to facilitate short-range communication.
  • the NFC module can be implemented based on Radio Frequency Identification (RFID) technology, Infrared Data Association (IrDA) technology, Ultra Wideband (UWB) technology, Bluetooth technology and other technologies. .
  • RFID Radio Frequency Identification
  • IrDA Infrared Data Association
  • UWB Ultra Wideband
  • the apparatus 100 may be implemented by one or more Application Specific Integrated Circuits (ASIC for short), digital signal processors, digital signal processing equipment, programmable logic devices, field programmable gate arrays, The controller, microcontroller, microprocessor or other electronic components are implemented to perform the following methods.
  • ASIC Application Specific Integrated Circuits
  • digital signal processors digital signal processing equipment
  • programmable logic devices programmable logic devices
  • field programmable gate arrays The controller, microcontroller, microprocessor or other electronic components are implemented to perform the following methods.
  • Fig. 2 is a flow chart showing a scheduling method based on a shared object pool according to an exemplary embodiment. As shown in Figure 2, this method includes the following steps.
  • Step 201 The dispatch system receives an object acquisition request; wherein the object acquisition request is used to acquire an object of a target type.
  • an object refers to a program unit used to describe objective things in object-oriented programming.
  • a connection pool a connection pool is also a type of object pool
  • the object in the connection pool refers to Is connected.
  • the working principle of the Object Pool is: the object pool can serve as a "container" for storing objects, storing used objects, and then using them again when they are needed next time, thus to a certain extent Reduce the overhead caused by frequently creating objects.
  • the object acquisition request can also be issued by any client.
  • Step 202 The scheduling system determines whether there is a target object pool with an empty request queue in all object pools according to the object acquisition request. If there is a target object pool, it triggers execution of step 203; if there is no such target object pool, the process ends.
  • the request queue of the object pool is empty, it means that the object stored in the object pool is not currently in use. It can be seen that, in the embodiment of the present application, a target object pool with an empty request queue can be found in all object pools, thereby improving the efficiency of obtaining objects.
  • the scheduling system determines whether there is a target object pool with an empty request queue in all object pools according to the object acquisition request, which may include:
  • the object acquisition request determine whether there is a free object pool with an empty request queue in all object pools; if there is a free object pool, obtain the free number of the free object pool; calculate the difference between the number of free objects and the preset minimum number of free objects Determine whether the difference is greater than the preset difference threshold; if the difference is greater than the preset difference threshold, get the idle time of each idle object pool; turn off the idle object pools whose idle time is longer than the preset time threshold to get the remaining Free object pool; determine the target object pool from the remaining free object pool.
  • the scheduling system determines the target object pool from the remaining free object pools, which may include:
  • the scheduling system can also perform the following steps:
  • all acquisition requests in the request queue of the candidate object pool are reordered, and the acquisition requests are processed according to the reordered request queue.
  • the processing priority can be divided into three levels: high, medium, and low.
  • the object acquisition request used to acquire the target type of object in this solution can correspond to the "high" level.
  • Processing priority It can be seen that implementing the embodiments of this application can use the processing priority corresponding to each acquisition request to reorder all acquisition requests in the request queue, so that the candidate object pool can process the acquisition requests according to the reordered request queue. The orderly processing of acquisition requests is realized, and each acquisition request is sorted by processing priority to meet the processing requirements of different types of acquisition requests.
  • Step 203 The scheduling system detects whether there are objects of the target type stored in the target object pool. If there are objects of the target type, step 204 is triggered; if no objects of the target type are stored, the process ends.
  • one or more objects may be stored in the object pool; further, optionally, different types of objects may be stored in the same object pool, which is not limited in the embodiment of the present application.
  • a method of traversing the target object pool may be used to detect whether there are objects of the target type stored in the target object pool.
  • the method of traversing the target object pool may be a CAS operation in JAVA, which is not limited in the embodiment of the present application.
  • the state of the object of the target type can be changed to a used (occupied) state, and at the same time, the traversal operation is ended, which can avoid unnecessary CPU resource overhead.
  • Step 204 The scheduling system triggers the object dispatch thread to obtain the object of the target type from the target object pool through the interface.
  • a thread is a single sequential control flow in a program, and is a unit for executing a program command.
  • the object pool is used to cache objects during thread processing. It has an interface, and the object dispatching thread obtains objects from the object pool through the object pool interface.
  • the implementation of the scheduling method based on the shared object pool described in Figure 2 can appropriately schedule objects of the target type in all object pools based on the client's object acquisition request, thereby improving resource utilization efficiency; and, achieving acquisition
  • the orderly processing of requests, and the use of processing priority to sort each acquisition request meets the processing needs of different types of acquisition requests; in addition, when traversing the target object pool to find the target type of object, you can use the target type of object
  • the state of is changed to the used (occupied) state, and the traversal operation is ended at the same time, which can avoid unnecessary CPU resource overhead.
  • Fig. 3 is a flowchart showing a scheduling method based on a shared object pool according to another exemplary embodiment. As shown in FIG. 3, the scheduling method based on the shared object pool may include the following steps:
  • the scheduling method based on the shared object pool further includes steps 301 to 303.
  • steps 301 to 303 please refer to the detailed description of steps 201 to 203 in the first embodiment. Repeat it again.
  • step 303 if an object of the target type is stored, step 304 can be triggered to execute; if no object of the target type is stored, step 305 can be triggered to execute.
  • Step 304 The scheduling system triggers the object dispatch thread to obtain the object of the target type from the target object pool through the interface.
  • Step 305 The scheduling system judges whether the number of created objects in the target object pool is less than the preset number threshold; if the number of created objects is less than the preset number threshold, step 306 is triggered; if the number of created objects is not less than the preset number
  • the threshold value triggers the execution of step 307.
  • the number of objects created in the target object pool is not less than the preset number threshold, it indicates that the capacity of the target object pool at this time is close to saturation.
  • the scheduling system may also perform the following steps:
  • the hill climbing algorithm is used to construct an adaptive dynamic adjustment scheme for the size of the object pool, so that the target object pool has an adaptive dynamic adjustment capability.
  • an adaptive dynamic adjustment solution for the size of the object pool is constructed. Specifically, you can first predefine the minimum value of the target object pool capacity and the adjustment time interval; measure the execution of the request queue in the object pool within the predefined time interval Time length, and count the number of extraction (acquisition) of each object in the object pool, count the object extraction schemes whose execution time is less than the preset execution time, determine such schemes as health schemes, and use this as the object in the next time interval Basis for assessment of pool capacity. If the current plan obtained by the evaluation does not meet the requirements of the health plan, use the evaluation data recorded by the mountain climbing algorithm to adjust the object pool capacity. If the current plan obtained by the evaluation meets the requirements of the health plan, no adjustment is required.
  • the hill-climbing algorithm is an optimal algorithm. Specifically, when the algorithm is iterated, the previous solution is replaced with a better solution in the adjacent solution space each time. It can be seen that implementing this scheme can construct an adaptive object pool dynamic adjustment scheme and realize the dynamic adjustment of the object pool capacity.
  • Step 306 The scheduling system creates a new object in the target object pool, and triggers the object dispatching thread to obtain the new object through the interface; wherein the type of the new object is the target type.
  • the number of created objects in the target object pool is less than the preset number threshold, indicating that the maximum capacity of the target object pool is not currently reached. Therefore, new objects can be created in the target object pool to satisfy the client Growing demand.
  • the scheduling system creates a new object in the target object pool, which may include:
  • the new object is stored in the target object pool according to the storage rules; wherein, the object identifier of the new object matches the object pool identifier of the target object pool.
  • the preset storage rule may be: each object corresponds to a unique object identifier, and each object pool also corresponds to a unique object pool identifier; and the storage rule is used to specify the object identifier Correspondence (matching) relationship with the object pool identifier.
  • the object can be stored in the designated object pool according to the corresponding relationship between the object identifier and the object pool identifier, thereby realizing reasonable storage of the object.
  • Step 307 The scheduling system detects whether there is an object to be returned in the target object pool; if there is an object to be returned, step 308 is triggered; if there is no object to be returned, the process ends; where the type of the object to be returned is the target type .
  • the scheduling system may also perform the following steps:
  • step 307 is triggered.
  • the scheduling system when the scheduling system detects the object to be returned returned by any client, it should first check whether the object to be returned can be reused, that is, whether the object to be returned has the feature of reuse; if the object to be returned has With the repeated use feature, the object to be returned can be placed in the object pool corresponding to the object pool identifier that matches its object identifier; or the object to be returned can be directly loaned to other clients with usage requirements. Conversely, if the object to be returned does not have the feature of repeated use, the scheduling system can discard the object to be returned.
  • step 308 the scheduling system triggers the object dispatch thread to obtain the object to be returned when the object to be returned returns to the target object pool through the interface.
  • implementing the scheduling method based on the shared object pool described in Figure 3 can appropriately schedule objects of the target type in all object pools based on the client's object acquisition request, thereby improving resource utilization efficiency; and, achieving acquisition
  • Fig. 4 is a block diagram showing a scheduling system based on a shared object pool according to an exemplary embodiment. As shown in Figure 4, the system includes:
  • the receiving unit 401 is configured to receive an object acquisition request, and provide the object acquisition request to the judgment unit 402, where the object acquisition request is used to acquire an object of a target type.
  • the first judging unit 402 is configured to judge whether there is a target object pool with an empty request queue in all object pools according to the object acquisition request, and provide the judgment result to the detecting unit 403.
  • the detection unit 403 is configured to detect whether an object of the target type is stored in the target object pool when the first determination unit 402 determines that there is a target object pool, and provide the detection result to the acquisition unit 404.
  • one or more objects may be stored in the object pool; further, optionally, different types of objects may be stored in the same object pool, which is not limited in the embodiment of the present application.
  • the detection unit 403 may detect whether there are objects of the target type stored in the target object pool by traversing the target object pool.
  • the method of traversing the target object pool may be a CAS operation in JAVA, which is not limited in the embodiment of the present application.
  • the state of the object of the target type can be changed to a used (occupied) state, and at the same time, the traversal operation is ended, which can avoid unnecessary CPU resource overhead.
  • the first obtaining unit 404 is configured to trigger the object dispatch thread to obtain the object of the target type from the target object pool through the interface when the detection unit 403 detects that the object of the target type is stored.
  • the implementation of the system described in Figure 4 can appropriately schedule objects of the target type in all object pools based on the client's object acquisition request, which improves the efficiency of resource utilization; and realizes the orderly processing of acquisition requests. And use the processing priority to sort each acquisition request to meet the processing requirements of different types of acquisition requests; in addition, when traversing the target object pool to find the target type of object, the status of the target type of object can be changed to be used (Occupy) state and end the traversal operation at the same time, which can avoid unnecessary CPU resource overhead.
  • FIG. 5 shows a block diagram of another scheduling system according to an exemplary embodiment, wherein the system shown in FIG. 5 is obtained by further optimization of the system shown in FIG. 4.
  • the system shown in Figure 5 also includes:
  • the second judging unit 405 is used for judging whether the number of objects created in the target object pool is less than the preset number threshold when the detection unit 403 detects that no objects of the target type are stored, and providing the judgment result to the creating unit 406 .
  • the creating unit 406 is configured to create a new object in the target object pool when the second determining unit 405 determines that the number of created objects is less than the preset number threshold; wherein the type of the new object is the target type.
  • the detection unit 403 is further configured to detect whether there are objects to be returned in the target object pool to be returned when the second judgment unit 405 determines that the number of created objects is not less than the preset number threshold, and provide the detection result to the first 2.
  • Obtaining unit 407 Wherein, the type of the object to be returned is the target type.
  • the second acquisition unit 407 is configured to trigger the object dispatch thread to acquire the object to be returned when the object to be returned returns to the target object pool through the interface when the detection unit 403 detects that there is an object to be returned.
  • the creating unit 406 may include:
  • the creation sub-unit 4061 is configured to create a new object according to preset object configuration parameters, and provide the new object to the storage sub-unit 4062.
  • the storage subunit 4062 is configured to store the new object in the target object pool according to the storage rules; wherein the object identifier of the new object matches the object pool identifier of the target object pool.
  • the preset storage rule may be: each object corresponds to a unique object identifier, and each object pool also corresponds to a unique object pool identifier; and the storage rule is used to specify the object identifier Correspondence (matching) relationship with the object pool identifier.
  • the object can be stored in the designated object pool according to the corresponding relationship between the object identifier and the object pool identifier, thereby realizing reasonable storage of the object.
  • the second judging unit 405 is further configured to judge whether the object to be returned has a repeated use feature when the detecting unit 403 detects that there is an object to be returned, and The judgment result is provided to the second obtaining unit 407.
  • the second obtaining unit 407 is specifically configured to trigger the object dispatching thread to obtain the object to be returned when the object to be returned returns to the target object pool through the interface when the second determining unit 405 determines that the object to be returned has a reusable feature.
  • the above-mentioned first determining unit 402 includes:
  • the judging subunit 4021 is configured to judge whether there is an idle object pool with an empty request queue in all object pools according to the object acquisition request, and provide the judgment result to the obtaining subunit 4022.
  • the obtaining subunit 4022 is configured to obtain the idle number of the idle object pool when the determining subunit 4021 determines that there is an idle object pool, and provide it to the calculation subunit 4023.
  • the calculation sub-unit 4023 calculates the difference between the number of idles and the preset minimum idle number, and provides the difference result to the judging sub-unit 4021.
  • the above-mentioned judging subunit 4021 is also used to judge whether the difference is greater than a preset difference threshold, and provide the judgment result to the obtaining subunit 4022.
  • the obtaining subunit 4022 is configured to obtain the idle duration of each idle object pool when the determining subunit 4021 determines that the difference is greater than the preset difference threshold, and provide the idle duration to the closing subunit 4024.
  • the closing sub-unit 4024 is used to close the idle object pool whose idle time is longer than the preset duration threshold to obtain the remaining idle object pool and provide it to the determining sub-unit 4025.
  • the determining subunit 4025 is used to determine the target object pool from the remaining free object pools.
  • the manner in which the determining subunit 4025 determines the target object pool from the remaining free object pool may specifically be:
  • the foregoing scheduling system may further include:
  • the determining unit 408 is configured to determine the candidate object pool from other object pools storing the target type when the first determining unit 402 determines that there is no target object pool, and trigger the request queue unit 409 to start; among them, other objects
  • the pool is all the object pools except the target object pool.
  • the request queue unit 409 is configured to add the object acquisition request to the request queue of the candidate object pool and trigger the processing unit 410 to start.
  • the processing unit 410 is configured to reorder all the acquisition requests in the request queue of the candidate object pool based on the processing priority corresponding to each acquisition request, and process the acquisition requests according to the reordered request queue.
  • the implementation of the system described in Figure 5 can appropriately schedule objects of the target type in all object pools based on the client's object acquisition request, which improves the efficiency of resource utilization; and realizes the orderly processing of acquisition requests. And use the processing priority to sort each acquisition request to meet the processing requirements of different types of acquisition requests; and when traversing the target object pool to find an object of the target type, the status of the target type of object can be changed to be used (Occupy) state and end the traversal operation at the same time, which can avoid unnecessary CPU resource overhead; and, can construct an adaptive object pool dynamic adjustment scheme, which realizes the dynamic adjustment of the object pool capacity; and, according to the object identification The corresponding relationship between the object pool identifier and the object is stored in the specified object pool, realizing the reasonable storage of the object.
  • This application also provides an electronic device, which includes:
  • a memory where computer-readable instructions are stored, and when the computer-readable instructions are executed by the processor, the performance test method shown above is implemented.
  • the electronic device may be the apparatus 100 shown in FIG. 1.
  • the present application further provides a computer-readable storage medium on which a computer program is stored, and when the computer program is executed by a processor, the scheduling method based on the shared object pool as shown above is implemented.
  • the present application further provides a computer program product, which includes a non-transitory computer-readable storage medium storing a computer program, and the computer program is operable to cause a computer to execute Mock test method shown.
  • the computer program product includes program code, and when the program product runs on a terminal device, the program code is used to make the terminal device execute the various methods described in the “Exemplary Method” section of this specification. Steps of an exemplary embodiment.

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

一种基于共享对象池的调度方法、系统、电子设备(100)及计算机可读存储介质,属于云存储技术领域,该方法包括:接收对象获取请求,其中,该对象获取请求用于获取目标类型的对象(201);根据对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池(202);如果存在目标对象池,检测目标对象池中是否存放有目标类型的对象(203);如果存放有目标类型的对象,触发对象派发线程通过接口从目标对象池获取目标类型的对象(204)。该方法能够提高资源利用率。

Description

基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质 技术领域
本申请要求2019年07月29日递交、发明名称为“基于共享对象池的调度方法、系统、介质及电子设备”的中国专利申请201910690391.7的优先权,在此通过引用将其全部内容合并于此。
本申请涉及云存储技术领域,尤其涉及一种基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质。
背景技术
目前,对象池在互联网技术中得到了广泛的应用。通过引入对象池可以有效减少从头创建每个对象的系统开销。在实际应用中,如果需要激活对象时可以直接从对象池中提取;如果停用对象时,将对象放回对象池中,对象池可以继续等待下一个使用对象的请求。
发明概述
技术问题
然而,本申请的发明人意识到,目前对于对象池中对象的调用主要针对的是具体业务,即每一种对象池中的对象仅适用于某一种功能,例如连接池只能操作对于网络连接的功能。可见,在现有技术中,各个对象池的使用均是独立的,并不存在共享的情况,因此使得处理器内存资源得不到有效利用,资源利用率低。
问题的解决方案
技术解决方案
为了解决上述技术问题,本申请的一个目的在于提供一种基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质。
其中,本申请所采用的技术方案为:
第一方面,一种基于共享对象池的调度方法,包括:接收对象获取请求,所述对象获取请求用于获取目标类型的对象;根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池;如果存在所述目标对象池,检测所述目标对象池中是否存放有所述目标类型的对象;如果存放有所述目标类型的对象,触发对象派发线程通过接口从所述目标对象池获取所述目标类型的对象。
第二方面,基于共享对象池的调度系统,包括:接收单元,用于接收对象获取请求,所述对象获取请求用于获取目标类型的对象;判断单元,用于根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池;检测单元,用于在所述判断单元判断出存在所述目标对象池时,检测所述目标对象池中是否存放有所述目标类型的对象;获取单元,用于在所述检测单元检测出存放有所述目标类型的对象时,触发对象派发线程通过接口从所述目标对象池获取所述目标类型的对象。
第三方面,一种电子设备,包括:处理器;以及
存储器,用于存储所述处理器的基于共享对象池的调度程序;其中,所述处理器配置为经由执行所述基于共享对象池的调度程序来执行如上所述的基于共享对象池的调度方法。
第四方面,一种计算机可读存储介质,其上存储有基于共享对象池的调度程序,其特征在于,所述基于共享对象池的调度程序被处理器执行时实现如上所述的基于共享对象池的调度方法。
第五方面,一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如本发明实施例第一方面所述的方法或第一方面任意可能实现方式中的方法。
在上述技术方案中,能够在接收到对象获取请求之后,在各个对象池中找到请求队列为空的目标对象池,并检测目标对象池中是否存在目标类型的对象,如果存在,则获取该目标类型的对象。可见,本方法使得各个对象池的对象得到共享,因此提高了资源利用率。
应当理解的是,以上的一般描述和后文的细节描述仅是示例性和解释性的,并 不能限制本申请。
发明的有益效果
对附图的简要说明
附图说明
此处的附图被并入说明书中并构成本说明书的一部分,示出了符合本申请的实施例,并于说明书一起用于解释本申请的原理。
图1是根据一示例性实施例示出的一种装置的示意图;
图2是根据一示例性实施例示出的一种基于共享对象池的调度方法的流程图;
图3是根据另一示例性实施例示出的一种基于共享对象池的调度方法的流程图;
图4是根据一示例性实施例示出的一种基于共享对象池的调度系统的框图;
图5是根据一示例性实施例示出的另一种基于共享对象池的调度系统的框图。
通过上述附图,已示出本申请明确的实施例,后文中将有更详细的描述,这些附图和文字描述并不是为了通过任何方式限制本申请构思的范围,而是通过参考特定实施例为本领域技术人员说明本申请的概念。
发明实施例
本发明的实施方式
这里将详细地对示例性实施例执行说明,其示例表示在附图中。下面的描述涉及附图时,除非另有表示,不同附图中的相同数字表示相同或相似的要素。以下示例性实施例中所描述的实施方式并不代表与本申请相一致的所有实施方式。相反,它们仅是与如所附权利要求书中所详述的、本申请的一些方面相一致的装置和方法的例子。
现在将参考附图更全面地描述示例实施方式。然而,示例实施方式能够以多种形式实施,且不应被理解为限于在此阐述的范例;相反,提供这些实施方式使得本申请将更加全面和完整,并将示例实施方式的构思全面地传达给本领域的技术人员。所描述的特征、结构或特性可以以任何合适的方式结合在一个或更多实施方式中。
图1是根据一示例性实施例示出的一种装置的示意图。装置100可以是电子设备。如图1所示,装置100可以包括以下一个或多个组件:处理组件102,存储器104,电源组件106,多媒体组件108,音频组件110,传感器组件114以及通信组件116。
处理组件102通常控制装置100的整体操作,诸如与显示,电话呼叫,数据通信,相机操作以及记录操作相关联的操作等。处理组件102可以包括一个或多个处理器118来执行指令,以完成下述的方法的全部或部分步骤。此外,处理组件102可以包括一个或多个模块,用于便于处理组件102和其他组件之间的交互。例如,处理组件102可以包括多媒体模块,用于以方便多媒体组件108和处理组件102之间的交互。
存储器104被配置为存储各种类型的数据以支持在装置100的操作。这些数据的示例包括用于在装置100上操作的任何应用程序或方法的指令。存储器104可以由任何类型的易失性或非易失性存储设备或者它们的组合实现,如静态随机存取存储器(Static Random Access Memory,简称SRAM),电可擦除可编程只读存储器(Electrically Erasable Programmable Read-Only Memory,简称EEPROM),可擦除可编程只读存储器(Erasable Programmable Read Only Memory,简称EPROM),可编程只读存储器(Programmable Red-Only Memory,简称PROM),只读存储器(Read-Only Memory,简称ROM),磁存储器,快闪存储器,磁盘或光盘。存储器104中还存储有一个或多个模块,用于该一个或多个模块被配置成由该一个或多个处理器118执行,以完成如下所示方法中的全部或者部分步骤。
电源组件106为装置100的各种组件提供电力。电源组件106可以包括电源管理系统,一个或多个电源,及其他与为装置100生成、管理和分配电力相关联的组件。
多媒体组件108包括在所述装置100和用户之间的提供一个输出接口的屏幕。在一些实施例中,屏幕可以包括液晶显示器(Liquid Crystal Display,简称LCD)和触摸面板。如果屏幕包括触摸面板,屏幕可以被实现为触摸屏,以接收来自用户的输入信号。触摸面板包括一个或多个触摸传感器以感测触摸、滑动和触 摸面板上的手势。所述触摸传感器可以不仅感测触摸或滑动动作的边界,而且还检测与所述触摸或滑动操作相关的持续时间和压力。屏幕还可以包括有机电致发光显示器(Organic Light Emitting Display,简称OLED)。
音频组件110被配置为输出和/或输入音频信号。例如,音频组件110包括一个麦克风(Microphone,简称MIC),当装置100处于操作模式,如呼叫模式、记录模式和语音识别模式时,麦克风被配置为接收外部音频信号。所接收的音频信号可以被进一步存储在存储器104或经由通信组件116发送。在一些实施例中,音频组件110还包括一个扬声器,用于输出音频信号。
传感器组件114包括一个或多个传感器,用于为装置100提供各个方面的状态评估。例如,传感器组件114可以检测到装置100的打开/关闭状态,组件的相对定位,传感器组件114还可以检测装置100或装置100一个组件的位置改变以及装置100的温度变化。在一些实施例中,该传感器组件114还可以包括磁传感器,压力传感器或温度传感器。
通信组件116被配置为便于装置100和其他设备之间有线或无线方式的通信。装置100可以接入基于通信标准的无线网络,如WiFi(Wireless-Fidelity,无线保真)。在一个示例性实施例中,通信组件116经由广播信道接收来自外部广播管理系统的广播信号或广播相关信息。在一个示例性实施例中,所述通信组件116还包括近场通信(Near Field Communication,简称NFC)模块,用于以促进短程通信。例如,在NFC模块可基于射频识别(Radio Frequency Identification,简称RFID)技术,红外数据协会(Infrared Data Association,简称IrDA)技术,超宽带(Ultra Wideband,简称UWB)技术,蓝牙技术和其他技术来实现。
在示例性实施例中,装置100可以被一个或多个应用专用集成电路(Application Specific Integrated Circuit,简称ASIC)、数字信号处理器、数字信号处理设备、可编程逻辑器件、现场可编程门阵列、控制器、微控制器、微处理器或其他电子元件实现,用于执行下述方法。
图2是根据一示例性实施例示出的一种基于共享对象池的调度方法的流程图。 如图2所示,此方法包括以下步骤。
步骤201,调度系统接收对象获取请求;其中,该对象获取请求用于获取目标类型的对象。
本申请实施例中,对象(Object)指的是面向对象程序设计中用来描述客观事物的程序单位,以连接池(连接池也属于对象池的一种)为例,连接池中的对象指的是连接。对象池(Object Pool)的工作原理是:对象池可以充当保存对象的“容器”,将用过的对象保存起来,等下一次需要这种对象时,再拿出来重复使用,从而在一定程度上减少频繁创建对象所造成的开销。当一个线程需要一个对象的时候,它需要从对象池中借出一个对象,当使用完毕后需要将该对象还回对象池;此外,对象获取请求还可以由任意客户端发出,本申请实施例不做限定。
步骤202,调度系统根据对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池,如果存在目标对象池,触发执行步骤203;如果未存在该目标对象池,结束本流程。
本申请实施例中,如果对象池的请求队列为空,说明该对象池中存放的对象当前未处于被使用状态。可见,本申请实施例,能够在所有对象池中查找请求队列为空的目标对象池,以此提高对象的获取效率。
作为一种可选的实施方式,调度系统根据对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池,可以包括:
根据对象获取请求,判断所有对象池中是否存在请求队列为空的空闲对象池;如果存在空闲对象池,获取空闲对象池的空闲个数;计算空闲个数与预设的最小空闲个数之间的差值;判断差值是否大于预设差值阈值;如果差值大于预设差值阈值,获取每个空闲对象池的空闲时长;关闭空闲时长长于预设时长阈值的空闲对象池,得到剩余空闲对象池;从剩余空闲对象池中确定目标对象池。
进一步可选的,调度系统从剩余空闲对象池中确定目标对象池,可以包括:
确定当前位于各个剩余空闲对象池的对象数量;
将所有剩余空闲对象池中对象数量最多的剩余空闲对象池确定为目标对象池。
作为另一种可选的实施方式,如果不存在目标对象池,调度系统还可以执行以下步骤:
从存放目标类型的其他对象池中确定出备选对象池;其中,其他对象池为所有对象池中除目标对象池以外的对象池;
将对象获取请求加入备选对象池的请求队列;
基于每个获取请求对应的处理优先级,对备选对象池的请求队列中所有的获取请求进行重新排序,并按照重新排序后的请求队列对获取请求进行处理。
本申请实施例中,可选的,处理优先级可以划分为高、中、低三级,优选地,本方案中用于获取目标类型的对象的对象获取请求可以对应“高”这一级的处理优先级。可见,实施本申请实施例,能够利用每个获取请求对应的处理优先级对请求队列中的所有获取请求进行重新排序,以使备选对象池按照重新排序后的请求队列对获取请求进行处理,实现了获取请求的有序处理,并且利用处理优先级对各个获取请求进行排序,满足了不同类型的获取请求的处理需求。
步骤203,调度系统检测目标对象池中是否存放有目标类型的对象,如果存放有目标类型的对象,触发执行步骤204;如果未存放有该目标类型的对象,结束本流程。
本申请实施例中,对象池中可以存放有一个或多个对象;进一步可选的,同一对象池中可以存放有不同类型的对象,本申请实施例不做限定。
本申请实施例中,可以采用遍历目标对象池的方式检测目标对象池中是否存放有目标类型的对象。具体地,遍历目标对象池的方式可以是JAVA中的CAS操作,本申请实施例不做限定。进一步地,当遍历目标对象池找到目标类型的对象时,可以将该目标类型的对象的状态改为被使用(占用)状态,同时结束遍历操作,能够避免造成不必要的CPU资源的开销。
步骤204,调度系统触发对象派发线程通过接口从目标对象池获取目标类型的对象。
本申请实施例中,线程(thread)是程序中一个单一的顺序控制流程,是执行一个程序命令的单元。对象池用于在线程处理过程中缓存对象,它设有接口,对象派发线程通过对象池接口从对象池中获取对象。
可见,实施图2所描述的基于共享对象池的调度方法,能够基于客户端的对象获取请求,在所有对象池中对目标类型的对象进行适当调度,提高了资源的利 用效率;以及,实现了获取请求的有序处理,并且利用处理优先级对各个获取请求进行排序,满足了不同类型的获取请求的处理需求;此外,当遍历目标对象池找到目标类型的对象时,可以将该目标类型的对象的状态改为被使用(占用)状态,同时结束遍历操作,能够避免造成不必要的CPU资源的开销。
图3是根据另一示例性实施例示出的一种基于共享对象池的调度方法的流程图。如图3所示,该基于共享对象池的调度方法可以包括以下步骤:
本申请实施例中,该基于共享对象池的调度方法还包括步骤301~303,针对步骤301~303的描述,请参照上述实施例一中针对步骤201~203的详细描述,本申请实施例不再赘述。其中,在步骤303中,如果存放有目标类型的对象,可以触发执行步骤304;如果未存放有目标类型的对象,可以触发执行步骤305。
步骤304,调度系统触发对象派发线程通过接口从目标对象池获取目标类型的对象。
步骤305,调度系统判断目标对象池中已创建的对象数目是否小于预设数量阈值;如果已创建的对象数目小于预设数量阈值,触发执行步骤306;如果已创建的对象数目不小于预设数量阈值,触发执行步骤307。
本申请实施例中,由于对象池的容量大小有限,如果目标对象池中已创建的对象数目不小于预设数量阈值,说明目标对象池此时的容量已经接近饱和。
可选的,调度系统在判断出目标对象池中已创建的对象数目不小于预设数量阈值之后,还可以执行以下步骤:
利用爬山算法,构造自适应的对象池大小的动态调整方案,使得该目标对象池具有自适应的动态调整能力。
本方案中,构造自适应的对象池大小的动态调整方案,具体来说,可以首先预定义目标对象池容量的最小值、调整时间间隔;在预定义的时间间隔内测量对象池内请求队列的执行时长,并针对对象池中各对象的提取(获取)次数进行统计,统计执行时长小于预设执行时长的对象提取方案,将此类方案确定为健康方案,并以此作为下一时间间隔内对象池容量的评估依据。若评估得到的当前方案不符合健康方案的要求,利用爬山算法记录的若干历史时间间隔的评估 数据对对象池容量进行择优调整;若评估得到的当前方案符合健康方案的要求,则不需要调整。其中,爬山算法是一种择优算法,具体来说,就是算法迭代时,每次用临近解空间内的更优解取代前解。可见,实施本方案,能够构造一个自适应的对象池动态调整方案,实现了对象池容量的动态调整。
步骤306,调度系统在目标对象池中创建新的对象,并触发对象派发线程通过接口获取该新的对象;其中,该新的对象的类型为目标类型。
本申请实施例中,目标对象池中已创建的对象数目小于预设数量阈值,说明当前并未达到目标对象池的最大容量,因此,可以在目标对象池中创建新的对象,以满足客户端不断增长的需求。
作为一种可选的实施方式,调度系统在目标对象池中创建新的对象,可以包括:
按照预设的对象配置参数创建新的对象;
按照存储规则将新的对象存储到目标对象池中;其中,新的对象的对象标识与目标对象池的对象池标识相匹配。
本申请实施例中,可选的,预设的存储规则可以是:每个对象对应有唯一的对象标识,每个对象池也对应有唯一的对象池标识;并且该存储规则用于规定对象标识与对象池标识之间的对应(匹配)关系。
可见,本申请实施例,可以根据对象标识与对象池标识之间的对应关系,将对象存放到指定的对象池中,实现了对象的合理存储。
步骤307,调度系统检测是否存在待返回目标对象池的待返回对象;如果存在待返回对象,触发执行步骤308;如果不存在待返回对象,结束本流程;其中,待返回对象的类型为目标类型。
作为一种可选的实施方式,如果存在上述待返回对象,调度系统还可以执行以下步骤:
判断待返回对象是否具有重复使用特性;
如果待返回对象具有重复使用特性,触发执行步骤307。
本申请实施例中,调度系统在检测到任意客户端返回的待返回对象时,首先应该检查该待返回对象是否能够重复使用,即该待返回对象是否具有重复使用特 性;如果该待返回对象具有重复使用特性,可以将该待返回对象放入与其对象标识相匹配的对象池标识所对应的对象池中;或者可以直接将该待返回对象借出给其他存在使用需求的客户端。反之,如果该待返回对象不具有重复使用特性,那么,调度系统可以舍弃该待返回对象。
步骤308,调度系统触发对象派发线程通过接口在待返回对象返回目标对象池时获取待返回对象。
可见,实施图3所描述的基于共享对象池的调度方法,能够基于客户端的对象获取请求,在所有对象池中对目标类型的对象进行适当调度,提高了资源的利用效率;以及,实现了获取请求的有序处理,并且利用处理优先级对各个获取请求进行排序,满足了不同类型的获取请求的处理需求;以及,当遍历目标对象池找到目标类型的对象时,可以将该目标类型的对象的状态改为被使用(占用)状态,同时结束遍历操作,能够避免造成不必要的CPU资源的开销;以及,能够构造一个自适应的对象池动态调整方案,实现了对象池容量的动态调整;以及,可以根据对象标识与对象池标识之间的对应关系,将对象存放到指定的对象池中,实现了对象的合理存储。
以下是本申请的装置实施例。
图4是根据一示例性实施例示出的一种基于共享对象池的调度系统的框图。如图4所示,该系统包括:
接收单元401,用于接收对象获取请求,并将该对象获取请求提供给判断单元402,其中,该对象获取请求用于获取目标类型的对象。
第一判断单元402,用于根据对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池,并将判断结果提供给检测单元403。
检测单元403,用于在上述第一判断单元402判断出存在目标对象池时,检测目标对象池中是否存放有目标类型的对象,并将检测结果提供给获取单元404。
本申请实施例中,对象池中可以存放有一个或多个对象;进一步可选的,同一对象池中可以存放有不同类型的对象,本申请实施例不做限定。
本申请实施例中,检测单元403可以采用遍历目标对象池的方式检测目标对象 池中是否存放有目标类型的对象。具体地,遍历目标对象池的方式可以是JAVA中的CAS操作,本申请实施例不做限定。进一步地,当遍历目标对象池找到目标类型的对象时,可以将该目标类型的对象的状态改为被使用(占用)状态,同时结束遍历操作,能够避免造成不必要的CPU资源的开销。
第一获取单元404,用于在上述检测单元403检测出存放有目标类型的对象时,触发对象派发线程通过接口从目标对象池获取目标类型的对象。
可见,实施图4所描述的系统,能够基于客户端的对象获取请求,在所有对象池中对目标类型的对象进行适当调度,提高了资源的利用效率;以及,实现了获取请求的有序处理,并且利用处理优先级对各个获取请求进行排序,满足了不同类型的获取请求的处理需求;此外,当遍历目标对象池找到目标类型的对象时,可以将该目标类型的对象的状态改为被使用(占用)状态,同时结束遍历操作,能够避免造成不必要的CPU资源的开销。
请参阅图5,图5根据一示例性实施例示出的另一种调度系统的框图,其中,图5所示的系统是由图4所示的系统进一步进行优化得到的。与图4所示的系统相比较,图5所示的系统还包括:
第二判断单元405,用于在上述检测单元403检测出未存放有目标类型的对象时,判断目标对象池中已创建的对象数目是否小于预设数量阈值,并将判断结果提供给创建单元406。
创建单元406,用于在上述第二判断单元405判断出已创建的对象数目小于预设数量阈值时,在目标对象池中创建新的对象;其中,该新的对象的类型为目标类型。
上述检测单元403,还用于在上述第二判断单元405判断出已创建的对象数目不小于预设数量阈值时,检测是否存在待返回目标对象池的待返回对象,并将检测结果提供给第二获取单元407;其中,该待返回对象的类型为目标类型。
第二获取单元407,用于在上述检测单元403检测出存在待返回对象时,触发对象派发线程通过接口在待返回对象返回目标对象池时获取待返回对象。
作为一种可选的实施方式,如图5所示,上述创建单元406可以包括:
创建子单元4061,用于按照预设的对象配置参数创建新的对象,并将该新的对象提供给存储子单元4062。
存储子单元4062,用于按照存储规则将新的对象存储到目标对象池中;其中,该新的对象的对象标识与目标对象池的对象池标识相匹配。
本申请实施例中,可选的,预设的存储规则可以是:每个对象对应有唯一的对象标识,每个对象池也对应有唯一的对象池标识;并且该存储规则用于规定对象标识与对象池标识之间的对应(匹配)关系。
可见,本申请实施例,可以根据对象标识与对象池标识之间的对应关系,将对象存放到指定的对象池中,实现了对象的合理存储。
作为另一种可选的实施方式,如图5所示,上述第二判断单元405,还用于在上述检测单元403检测出存在待返回对象时,判断待返回对象是否具有重复使用特性,并将判断结果提供给第二获取单元407。
上述第二获取单元407,具体用于在上述第二判断单元405判断出待返回对象具有重复使用特性时,触发对象派发线程通过接口在待返回对象返回目标对象池时获取待返回对象。
作为又一种可选的实施方式,如图5所示,上述第一判断单元402,包括:
判断子单元4021,用于根据对象获取请求,判断所有对象池中是否存在请求队列为空的空闲对象池,并将判断结果提供给获取子单元4022。
获取子单元4022,用于在判断子单元4021判断出存在空闲对象池时,获取空闲对象池的空闲个数,并提供给计算子单元4023。
计算子单元4023,计算空闲个数与预设的最小空闲个数之间的差值,并将该差值结果提供给判断子单元4021。
上述判断子单元4021,还用于判断差值是否大于预设差值阈值,并将判断结果提供给获取子单元4022。
上述获取子单元4022,用于在上述判断子单元4021判断出差值大于预设差值阈值时,获取每个空闲对象池的空闲时长,并将空闲时长提供给关闭子单元4024。
关闭子单元4024,用于关闭空闲时长长于预设时长阈值的空闲对象池,得到剩 余空闲对象池,并提供给确定子单元4025。
确定子单元4025,用于从剩余空闲对象池中确定目标对象池。
其中,可选的,确定子单元4025从剩余空闲对象池中确定目标对象池的方式具体可以为:
确定当前位于各个剩余空闲对象池的对象数量;
将所有剩余空闲对象池中对象数量最多的剩余空闲对象池确定为目标对象池。
作为又一种可选的实施方式,如图5所示,上述调度系统还可以包括:
确定单元408,用于在上述第一判断单元402判断出不存在目标对象池时,从存放目标类型的其他对象池中确定出备选对象池,并触发请求队列单元409启动;其中,其他对象池为所有对象池中除目标对象池以外的对象池。
请求队列单元409,用于将对象获取请求加入备选对象池的请求队列,并触发处理单元410启动。
处理单元410,用于基于每个获取请求对应的处理优先级,对备选对象池的请求队列中所有的获取请求进行重新排序,并按照重新排序后的请求队列对获取请求进行处理。
可见,实施图5所描述的系统,能够基于客户端的对象获取请求,在所有对象池中对目标类型的对象进行适当调度,提高了资源的利用效率;以及,实现了获取请求的有序处理,并且利用处理优先级对各个获取请求进行排序,满足了不同类型的获取请求的处理需求;以及,当遍历目标对象池找到目标类型的对象时,可以将该目标类型的对象的状态改为被使用(占用)状态,同时结束遍历操作,能够避免造成不必要的CPU资源的开销;以及,能够构造一个自适应的对象池动态调整方案,实现了对象池容量的动态调整;以及,可以根据对象标识与对象池标识之间的对应关系,将对象存放到指定的对象池中,实现了对象的合理存储。
本申请还提供一种电子设备,该电子设备包括:
处理器;
存储器,该存储器上存储有计算机可读指令,该计算机可读指令被处理器执行时,实现如前所示的性能测试方法。
该电子设备可以是图1所示装置100。
在一示例性实施例中,本申请还提供一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时,实现如前所示的基于共享对象池的调度方法。
在一示例性实施例中,本申请还提供一种计算机程序产品,所述计算机程序产品包括存储了计算机程序的非瞬时性计算机可读存储介质,所述计算机程序可操作来使计算机执行如前所示的Mock测试方法。所述计算机程序产品包括程序代码,当所述程序产品在终端设备上运行时,所述程序代码用于使所述终端设备执行本说明书上述“示例性方法”部分中描述的根据本申请各种示例性实施方式的步骤。
应当理解的是,本申请并不局限于上面已经描述并在附图中示出的精确结构,并且可以在不脱离其范围执行各种修改和改变。本申请的范围仅由所附的权利要求来限制。

Claims (22)

  1. 一种基于共享对象池的调度方法,所述方法包括:
    接收对象获取请求,所述对象获取请求用于获取目标类型的对象;
    根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池;
    如果存在所述目标对象池,检测所述目标对象池中是否存放有所述目标类型的对象;
    如果存放有所述目标类型的对象,触发对象派发线程通过接口从所述目标对象池获取所述目标类型的对象。
  2. 根据权利要求1所述的方法,其中,如果未存放有所述目标类型的对象,所述方法还包括:
    判断所述目标对象池中已创建的对象数目是否小于预设数量阈值;
    如果所述已创建的对象数目小于所述预设数量阈值,在所述目标对象池中创建新的对象;其中,所述新的对象的类型为所述目标类型;
    如果所述已创建的对象数目不小于所述预设数量阈值,检测是否存在待返回所述目标对象池的待返回对象;所述待返回对象的类型为所述目标类型;
    如果存在所述待返回对象,触发所述对象派发线程通过接口在所述待返回对象返回所述目标对象池时获取所述待返回对象。
  3. 根据权利要求2所述的方法,其中,所述在所述目标对象池中创建新的对象,包括:
    按照预设的对象配置参数创建新的对象;
    按照存储规则将所述新的对象存储到所述目标对象池中;其中,
    所述新的对象的对象标识与所述目标对象池的对象池标识相匹配。
  4. 根据权利要求2所述的方法,其中,如果存在所述待返回对象,所述方法还包括:
    判断所述待返回对象是否具有重复使用特性;
    如果所述待返回对象具有所述重复使用特性,执行所述的触发所述对象派发线程通过接口在所述待返回对象返回所述目标对象池时获取所述待返回对象。
  5. 根据权利要求1所述的方法,其中,所述根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池,包括:
    根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的空闲对象池;
    如果存在所述空闲对象池,获取所述空闲对象池的空闲个数;
    计算所述空闲个数与预设的最小空闲个数之间的差值;
    判断所述差值是否大于预设差值阈值;
    如果所述差值大于所述预设差值阈值,获取每个所述空闲对象池的空闲时长;
    关闭所述空闲时长长于预设时长阈值的空闲对象池,得到剩余空闲对象池;
    从所述剩余空闲对象池中确定目标对象池。
  6. 根据权利要求5所述的方法,其中,所述从所述剩余空闲对象池中确定目标对象池,包括:
    确定当前位于各个所述剩余空闲对象池的对象数量;
    将所有所述剩余空闲对象池中所述对象数量最多的剩余空闲对象池确定为目标对象池。
  7. 根据权利要求1所述的方法,其中,如果不存在所述目标对象池,所述方法还包括:
    从存放所述目标类型的其他对象池中确定出备选对象池;其中,所述其他对象池为所述所有对象池中除所述目标对象池以外的对象池;
    将所述对象获取请求加入所述备选对象池的请求队列;
    基于每个获取请求对应的处理优先级,对所述备选对象池的请求队列中所有的获取请求进行重新排序,并按照重新排序后的请求队列对所述获取请求进行处理。
  8. 一种基于共享对象池的调度系统,包括:
    接收单元,用于接收对象获取请求,所述对象获取请求用于获取目标类型的对象;
    第一判断单元,用于根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池;
    检测单元,用于在所述判断单元判断出存在所述目标对象池时,检测所述目标对象池中是否存放有所述目标类型的对象;
    第一获取单元,用于在所述检测单元检测出存放有所述目标类型的对象时,触发对象派发线程通过接口从所述目标对象池获取所述目标类型的对象。
  9. 根据权利要求8所述的系统,在所述检测单元检测出未存放有目标类型的对象时,还包括:
    第二判断单元,用于判断所述目标对象池中已创建的对象数目是否小于预设数量阈值;
    创建单元,用于如果所述已创建的对象数目小于所述预设数量阈值,在所述目标对象池中创建新的对象;其中,所述新的对象的类型为所述目标类型;
    所述检测单元,用于如果所述已创建的对象数目不小于所述预设数量阈值,检测是否存在待返回所述目标对象池的待返回对象;
    所述待返回对象的类型为所述目标类型;
    第二获取单元,用于如果存在所述待返回对象,触发所述对象派发线程通过接口在所述待返回对象返回所述目标对象池时获取所述待返回对象。
  10. 根据权利要求9所述的系统,所述创建单元被配置为:
    创建子单元,用于按照预设的对象配置参数创建新的对象;
    存储子单元,用于按照存储规则将所述新的对象存储到所述目标对象池中;其中,所述新的对象的对象标识与所述目标对象池的对象池标识相匹配。
  11. 根据权利要求9所述的系统,在所述检测单元检测出存在待返回对象时,所述第二判断单元还被配置为:判断所述待返回对象是否具有重复使用特性;
    所述第二获取单元还被配置为:如果所述待返回对象具有所述重复使用特性,执行所述的触发所述对象派发线程通过接口在所述待返回对象返回所述目标对象池时获取所述待返回对象。
  12. 根据权利要求8所述的系统,所述第一判断单元被配置为:
    判断子单元,用于根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的空闲对象池;
    获取子单元,用于如果存在所述空闲对象池,获取所述空闲对象池的空闲个数;
    计算子单元,用于计算所述空闲个数与预设的最小空闲个数之间的差值;
    所述判断子单元,用于判断所述差值是否大于预设差值阈值;
    所述获取子单元,用于如果所述差值大于所述预设差值阈值,获取每个所述空闲对象池的空闲时长;
    关闭子单元,用于关闭所述空闲时长长于预设时长阈值的空闲对象池,得到剩余空闲对象池;
    确定子单元,用于从所述剩余空闲对象池中确定目标对象池。
  13. 根据权利要求12所述的系统,所述确定子单元被配置为:
    确定当前位于各个所述剩余空闲对象池的对象数量;
    将所有所述剩余空闲对象池中所述对象数量最多的剩余空闲对象池确定为目标对象池。
  14. 根据权利要求8所述的系统,在所述第一判断单元判断出不存在目 标对象池时,还包括:
    确定单元,用于从存放所述目标类型的其他对象池中确定出备选对象池;其中,所述其他对象池为所述所有对象池中除所述目标对象池以外的对象池;
    请求队列单元,用于将所述对象获取请求加入所述备选对象池的请求队列;
    处理单元,用于基于每个获取请求对应的处理优先级,对所述备选对象池的请求队列中所有的获取请求进行重新排序,并按照重新排序后的请求队列对所述获取请求进行处理。
  15. 一种电子设备,包括:处理器;以及存储器,用于存储所述处理器的基于共享对象池的调度程序;其中,所述处理器配置为经由执行所述基于共享对象池的调度程序来执行以下处理:
    接收对象获取请求,所述对象获取请求用于获取目标类型的对象;
    根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池;
    如果存在所述目标对象池,检测所述目标对象池中是否存放有所述目标类型的对象;
    如果存放有所述目标类型的对象,触发对象派发线程通过接口从所述目标对象池获取所述目标类型的对象。
  16. 根据权利要求15所述的电子设备,其中,如果未存放有所述目标类型的对象,所述方法还包括:
    判断所述目标对象池中已创建的对象数目是否小于预设数量阈值;
    如果所述已创建的对象数目小于所述预设数量阈值,在所述目标对象池中创建新的对象;其中,所述新的对象的类型为所述目标类型;
    如果所述已创建的对象数目不小于所述预设数量阈值,检测是否 存在待返回所述目标对象池的待返回对象;所述待返回对象的类型为所述目标类型;
    如果存在所述待返回对象,触发所述对象派发线程通过接口在所述待返回对象返回所述目标对象池时获取所述待返回对象。
  17. 根据权利要求16所述的电子设备,其中,所述在所述目标对象池中创建新的对象,包括:
    按照预设的对象配置参数创建新的对象;
    按照存储规则将所述新的对象存储到所述目标对象池中;其中,所述新的对象的对象标识与所述目标对象池的对象池标识相匹配。
  18. 根据权利要求16所述的电子设备,其中,如果存在所述待返回对象,所述方法还包括:
    判断所述待返回对象是否具有重复使用特性;
    如果所述待返回对象具有所述重复使用特性,执行所述的触发所述对象派发线程通过接口在所述待返回对象返回所述目标对象池时获取所述待返回对象。
  19. 根据权利要求15所述的电子设备,其中,所述根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池,包括:
    根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的空闲对象池;
    如果存在所述空闲对象池,获取所述空闲对象池的空闲个数;
    计算所述空闲个数与预设的最小空闲个数之间的差值;
    判断所述差值是否大于预设差值阈值;
    如果所述差值大于所述预设差值阈值,获取每个所述空闲对象池的空闲时长;
    关闭所述空闲时长长于预设时长阈值的空闲对象池,得到剩余空闲对象池;
    从所述剩余空闲对象池中确定目标对象池。
  20. 根据权利要求19所述的电子设备,其中,所述从所述剩余空闲对象池中确定目标对象池,包括:
    确定当前位于各个所述剩余空闲对象池的对象数量;
    将所有所述剩余空闲对象池中所述对象数量最多的剩余空闲对象池确定为目标对象池。
  21. 根据权利要求15所述的电子设备,其中,如果不存在所述目标对象池,所述方法还包括:
    从存放所述目标类型的其他对象池中确定出备选对象池;其中,所述其他对象池为所述所有对象池中除所述目标对象池以外的对象池;
    将所述对象获取请求加入所述备选对象池的请求队列;
    基于每个获取请求对应的处理优先级,对所述备选对象池的请求队列中所有的获取请求进行重新排序,并按照重新排序后的请求队列对所述获取请求进行处理。
  22. 一种计算机可读存储介质,其上存储有基于共享对象池的调度程序,其特征在于,所述基于共享对象池的调度程序被处理器执行时实现以下处理:
    接收对象获取请求,所述对象获取请求用于获取目标类型的对象;
    根据所述对象获取请求,判断所有对象池中是否存在请求队列为空的目标对象池;
    如果存在所述目标对象池,检测所述目标对象池中是否存放有所述目标类型的对象;
    如果存放有所述目标类型的对象,触发对象派发线程通过接口从所述目标对象池获取所述目标类型的对象。
PCT/CN2019/118060 2019-07-29 2019-11-13 基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质 Ceased WO2021017304A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201910690391.7A CN110471763B (zh) 2019-07-29 2019-07-29 基于共享对象池的调度方法、系统、介质及电子设备
CN201910690391.7 2019-07-29

Publications (1)

Publication Number Publication Date
WO2021017304A1 true WO2021017304A1 (zh) 2021-02-04

Family

ID=68509029

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/118060 Ceased WO2021017304A1 (zh) 2019-07-29 2019-11-13 基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质

Country Status (2)

Country Link
CN (1) CN110471763B (zh)
WO (1) WO2021017304A1 (zh)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11095745B1 (en) * 2020-10-23 2021-08-17 EMC IP Holding Company LLC Cloud-based scheduling of data operations to an object storage using an operation pool
CN118672794A (zh) * 2024-08-26 2024-09-20 山东云海国创云计算装备产业创新中心有限公司 一种请求调度方法、系统、计算机程序产品及计算机介质
CN118796476A (zh) * 2024-09-09 2024-10-18 宁德时代新能源科技股份有限公司 产线视觉处理方法、装置、设备、存储介质及程序产品

Families Citing this family (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111273968A (zh) * 2020-01-17 2020-06-12 上海米哈游天命科技有限公司 一种对象调用方法、装置、设备及介质
CN113449316B (zh) * 2020-03-27 2023-07-18 武汉瓯越网视有限公司 一种程序的加密解密方法、装置和可读存储介质
CN111522645B (zh) * 2020-04-29 2023-09-12 抖音视界有限公司 对象的处理方法、装置、电子设备及计算机可读存储介质
CN112181663A (zh) * 2020-10-15 2021-01-05 新华三大数据技术有限公司 一种内存调度方法、装置及计算机设备
CN114546665B (zh) * 2022-04-22 2022-08-05 恒生电子股份有限公司 对象处理方法以及系统
CN114968208A (zh) * 2022-05-30 2022-08-30 济南浪潮数据技术有限公司 一种对象回收的方法、装置及介质
CN115686452A (zh) * 2022-10-14 2023-02-03 成都索骥科技有限公司 一种通用对象池实现系统及方法
CN116225328B (zh) * 2023-02-20 2026-02-17 车智互联(北京)科技有限公司 一种数据存储方法、装置、计算设备及可读存储介质

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060277158A1 (en) * 2005-06-07 2006-12-07 Samsung Electronics Co., Ltd. System and method for implementing database application while guaranteeing independence of software modules
CN108228332A (zh) * 2016-12-13 2018-06-29 北京嘀嘀无限科技发展有限公司 对象池访问方法及装置
CN109298901A (zh) * 2018-08-29 2019-02-01 百度在线网络技术(北京)有限公司 对象处理方法、装置、设备、存储介质和车辆
CN109710259A (zh) * 2018-12-28 2019-05-03 北京小米移动软件有限公司 一种数据处理方法、装置及存储介质
CN110046038A (zh) * 2019-03-12 2019-07-23 平安普惠企业管理有限公司 一种基于线程池的任务处理方法及装置

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP2363806A1 (en) * 2010-03-03 2011-09-07 Software AG Connection handler and method for providing applications with heterogeneous connection objects
CN109669739A (zh) * 2017-10-16 2019-04-23 阿里巴巴集团控股有限公司 一种界面渲染方法、装置、终端设备和存储介质

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060277158A1 (en) * 2005-06-07 2006-12-07 Samsung Electronics Co., Ltd. System and method for implementing database application while guaranteeing independence of software modules
CN108228332A (zh) * 2016-12-13 2018-06-29 北京嘀嘀无限科技发展有限公司 对象池访问方法及装置
CN109298901A (zh) * 2018-08-29 2019-02-01 百度在线网络技术(北京)有限公司 对象处理方法、装置、设备、存储介质和车辆
CN109710259A (zh) * 2018-12-28 2019-05-03 北京小米移动软件有限公司 一种数据处理方法、装置及存储介质
CN110046038A (zh) * 2019-03-12 2019-07-23 平安普惠企业管理有限公司 一种基于线程池的任务处理方法及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US11095745B1 (en) * 2020-10-23 2021-08-17 EMC IP Holding Company LLC Cloud-based scheduling of data operations to an object storage using an operation pool
CN118672794A (zh) * 2024-08-26 2024-09-20 山东云海国创云计算装备产业创新中心有限公司 一种请求调度方法、系统、计算机程序产品及计算机介质
CN118796476A (zh) * 2024-09-09 2024-10-18 宁德时代新能源科技股份有限公司 产线视觉处理方法、装置、设备、存储介质及程序产品

Also Published As

Publication number Publication date
CN110471763A (zh) 2019-11-19
CN110471763B (zh) 2023-07-25

Similar Documents

Publication Publication Date Title
WO2021017304A1 (zh) 基于共享对象池的调度方法、系统、电子设备及计算机可读存储介质
CN110162384B (zh) 基于Redis分布式锁的超时时间动态调整方法及系统
CN107463403B (zh) 进程控制方法、装置、存储介质以及电子设备
US10862992B2 (en) Resource cache management method and system and apparatus
WO2019114129A1 (zh) 推流服务器的调度装置、方法及计算机可读存储介质
CN105549910B (zh) 一种io调度方法及装置
US20130282869A1 (en) Method, apparatus, and computer program product for scheduling file uploads
WO2016188060A1 (zh) 应用程序安装包的处理方法及装置
CN102779062A (zh) 一种访问系统资源的线程数量的控制方法及装置
US20170041652A1 (en) Image data processing method and electronic device supporting the same
US9509624B2 (en) Generating transmission schedules
CN106339260B (zh) 基于Jenkins平台的任务分配方法及装置
CN109857551A (zh) 基于云计算的服务资源的调度方法及装置、电子设备
WO2014206270A1 (zh) 一种检测电池使用时长的方法、装置及设备
CN114124593B (zh) 多设备的调用方法、装置、控制终端和存储介质
CN109542512A (zh) 一种数据处理方法、装置和存储介质
CN107223351A (zh) 控制网络接入的方法及装置
WO2023108989A1 (zh) 数据访问方法、装置及非临时性计算机可读存储介质
CN115658083A (zh) 模型部署方法、模型运行方法、装置、介质、及电子设备
CN107948093A (zh) 调节终端设备中应用网速的方法及装置
US20100332785A1 (en) Memory management system and method thereof
CN104731722A (zh) 一种针对缓存页面的页面管理方法及装置
KR102255361B1 (ko) 인텐트 처리 방법 및 그 전자 장치
CN105988677A (zh) 页面亮度的控制方法及装置
US20140032787A1 (en) Methods, apparatuses and computer program products for enhancing performance and controlling quality of service of devices by using application awareness

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19939490

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19939490

Country of ref document: EP

Kind code of ref document: A1