Resource management method and device, equipment and storage medium
By monitoring the available proportion of resources in the resource pool and automatically applying for supplementary resources, the problem of time-consuming preparation for resource application is solved, and efficient resource management and system performance improvement is achieved.
Patent Information
- Application Number
- CN202411560339.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-04
- Publication Date
- 2025-02-11
AI Technical Summary
In the prior art, the preparation work for initialization, destruction and connection of resource applications takes a long time and cannot efficiently manage resources.
By monitoring the available resource proportion of each resource in the resource pool, determine that the resource whose available resource proportion is lower than the preset threshold is the resource to be supplemented, use the thread pool to send resource application requests to the resource server, and receive a resource collection to supplement the resource pool .
It realizes efficient resource management, improves system stability and performance, improves resource utilization, and enhances the degree of automation and flexibility of the system.
Smart Images

Figure CN119415362A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of resource management, and in particular to a resource management method, device, equipment and storage medium. Background Art
[0002] With the continuous development of automobile intelligence, the functions that can be realized by vehicles are gradually increasing, so the number of electronic control units is rapidly increasing. Using software environment to simulate the actual electronic control unit functions, the so-called "Software-in-the-Loop" (SIL) testing technology, has become an important means to improve development efficiency and quality.
[0003] When simulating the actual electronic control unit function, it is necessary to apply for and utilize resources to implement functional testing. During the resource application process, operations such as initialization, destruction, and connection are required.
[0004] The preparation work such as initialization, destruction and connection of the above resource application takes a long time, so achieving efficient management of effective resources is a technical problem that urgently needs to be solved in this field. Summary of the invention
[0005] The present application provides a resource management method, apparatus, device and storage medium to solve the problem in the prior art that the preparation work such as initialization, destruction and connection of resource application takes a long time and the resources cannot be managed efficiently.
[0006] In a first aspect, the present application provides a resource management method, comprising:
[0007] Based on the available resource ratio of each resource in the monitoring resource pool, the resources whose available resource ratio is lower than the preset ratio threshold are determined as resources to be supplemented;
[0008] Sending a resource application request to a resource server through a thread pool, wherein the resource application request includes resource demand information corresponding to each resource to be supplemented;
[0009] A resource set sent by the resource server is received and added to the resource pool, wherein the resource set includes supplementary resources for each resource to be supplemented.
[0010] In combination with the first aspect, in some embodiments, the method further includes:
[0011] Verifying the resource information in the resource pool and the resource information in the resource server according to a preset verification period;
[0012] If the verification fails, data synchronization is performed to make the resource information in the resource pool consistent with the resource information in the resource server.
[0013] In combination with the first aspect, in some embodiments, the method further includes:
[0014] Extract resource information in the resource server from the Redis cache.
[0015] In combination with the first aspect, in some embodiments, the method further includes:
[0016] When any resource in the resource pool is detected to be abnormal, marking the abnormal resource for destruction;
[0017] A resource release request is sent to the resource server, wherein the resource release request includes an identifier of the abnormal resource.
[0018] In combination with the first aspect, in some embodiments, the method further includes:
[0019] For any occupied resource in the resource pool, based on the occupation time set by the user corresponding to the resource, historical usage information and a preset time threshold, determining whether the resource is an invalid occupied resource;
[0020] If it is determined that the resource is an invalid occupied resource, an application is made to the resource server to release the resource through a message queue.
[0021] In combination with the first aspect, in some embodiments, determining whether the resource is an invalid occupied resource based on the occupation duration set by the user corresponding to the resource, historical usage information, and a preset duration threshold includes:
[0022] For any occupied resource in the resource pool, determine a timestamp of the last use of the resource based on historical usage information corresponding to the resource;
[0023] Determining, according to the timestamp, whether the resource has not been used for a period of time exceeding the time threshold;
[0024] If it is determined that the unused time period of the resource exceeds the time period threshold, and the occupied time period of the resource exceeds the occupied time period set by the user, the resource is determined to be an invalid occupied resource.
[0025] In combination with the first aspect, in some embodiments, the method further includes:
[0026] If it is determined that the resource has not been used for a period of time exceeding the time threshold, and the occupied time of the resource does not exceed the occupied time set by the user, a prompt message is sent to the user, wherein the prompt message is used to prompt the user whether to release the resource;
[0027] receiving a feedback message from the user, where the feedback message is used to indicate whether the user agrees to release the resource;
[0028] Determine whether the resource is an invalid occupied resource based on the feedback message.
[0029] In a second aspect, the present application provides a resource management device, including:
[0030] A first determination module is used to determine resources whose available resource ratio is lower than a preset ratio threshold as resources to be supplemented based on the available resource ratio of each resource in the monitoring resource pool;
[0031] A first sending module, configured to send a resource application request to a resource server through a thread pool, wherein the resource application request includes resource demand information corresponding to each resource to be supplemented;
[0032] The receiving module is used to receive the resource set sent by the resource server and supplement it to the resource pool, wherein the resource set includes supplementary resources for each resource to be supplemented.
[0033] In conjunction with the second aspect, in some embodiments, the apparatus further includes:
[0034] A verification module, used to verify the resource information in the resource pool and the resource information in the resource server according to a preset verification period;
[0035] The synchronization module is used to perform data synchronization update if the verification fails, so that the resource information in the resource pool is consistent with the resource information in the resource server.
[0036] In conjunction with the second aspect, in some embodiments, the apparatus further includes:
[0037] The extraction module is used to extract resource information in the resource server pool from the Redis cache.
[0038] In conjunction with the second aspect, in some embodiments, the apparatus further includes:
[0039] A marking module, used for marking the abnormal resource for destruction when any resource in the resource pool is detected to be abnormal;
[0040] The second sending module is used to send a resource release request to the resource server, wherein the resource release request includes an identifier of the abnormal resource.
[0041] In conjunction with the second aspect, in some embodiments, the apparatus further includes:
[0042] A second determination module is used to determine, for any occupied resource in the resource pool, whether the resource is an invalid occupied resource based on the occupied time set by the user corresponding to the resource, historical usage information and a preset time threshold;
[0043] The application module is used to apply to the resource server for releasing the resource through a message queue if it is determined that the resource is an invalid occupied resource.
[0044] In conjunction with the second aspect, in some embodiments, the second determining module is specifically configured to:
[0045] For any occupied resource in the resource pool, determine a timestamp of the last use of the resource based on historical usage information corresponding to the resource;
[0046] Determining, according to the timestamp, whether the resource has not been used for a period of time exceeding the time threshold;
[0047] If it is determined that the unused time period of the resource exceeds the time period threshold, and the occupied time period of the resource exceeds the occupied time period set by the user, the resource is determined to be an invalid occupied resource.
[0048] In conjunction with the second aspect, in some embodiments, the second determining module is further configured to:
[0049] If it is determined that the resource has not been used for a period of time exceeding the time threshold, and the occupied time of the resource does not exceed the occupied time set by the user, a prompt message is sent to the user, wherein the prompt message is used to prompt the user whether to release the resource;
[0050] receiving a feedback message from the user, where the feedback message is used to indicate whether the user agrees to release the resource;
[0051] Determine whether the resource is an invalid occupied resource based on the feedback message.
[0052] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory and a communication interface communicatively connected to the processor;
[0053] The memory stores computer-executable instructions;
[0054] The processor executes the computer-executable instructions stored in the memory to implement the resource management method described in any one of the first aspects.
[0055] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the resource management method described in any one of the first aspects.
[0056] In a fifth aspect, the present application provides a computer program product, wherein the computer program product includes a computer program, and when the computer program is executed by a processor, the resource management method described in any one of the first aspects is implemented.
[0057] The present application provides a resource management method, apparatus, device and storage medium. Based on monitoring the available resource ratio of each resource in the resource pool, resources whose available resource ratio is lower than a preset ratio threshold are determined as resources to be supplemented, resource application requests are sent to the resource server through the thread pool, resource sets sent by the resource server are received, and the resource pool is supplemented. The above method realizes efficient resource management, improves system stability and performance, improves resource utilization, and enhances the automation and flexibility of the system by monitoring resource ratios, automatically applying for and supplementing resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0058] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0059] Figure 1 A flowchart of a first embodiment of a resource management method provided in an embodiment of the present application;
[0060] Figure 2 A schematic diagram of a second example of a resource management method according to an embodiment of the present application;
[0061] Figure 3 A flowchart of a third embodiment of the resource management method provided in the embodiment of the present application;
[0062] Figure 4 A flowchart of a fourth embodiment of the resource management method provided in the embodiment of the present application;
[0063] Figure 5 A flowchart of a fifth embodiment of the resource management method provided in the embodiment of the present application;
[0064] Figure 6 A flowchart of a sixth embodiment of the resource management method provided in the embodiment of the present application;
[0065] Figure 7 A schematic diagram of the structure of an embodiment of a vehicle resource management device provided in an embodiment of the present application;
[0066] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application.
[0067] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0068] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0069] With the continuous development of automobile intelligence, the functions that can be realized by vehicles are gradually increasing, so the number of electronic control units is increasing rapidly. Using software environment to simulate the actual electronic control unit functions, the so-called "Software-in-the-Loop" (SIL) testing technology, has become an important means to improve development efficiency and quality. When simulating the actual electronic control unit functions, it is necessary to apply for and utilize resources to implement functional testing. Initialization, destruction, and connection operations are required during the resource application process. The preparation work such as initialization, destruction, and connection of the above resource applications is time-consuming, so realizing efficient management of effective resources is a technical problem that needs to be solved urgently in this field.
[0070] In response to the above problems, the present application provides a resource management method, device, equipment and storage medium to achieve efficient resource management. Specifically, when simulating the actual electronic control unit function, it is necessary to apply for and utilize resources to achieve functional testing. Initialization, destruction and connection operations are required during the resource application process. The preparation work such as initialization, destruction and connection of the above resource application is time-consuming. In view of these problems, the inventor studied whether it is possible to assemble resource demand information according to business data in a personalized manner, and then apply to the resource server in advance for resources to be stored in the resource pool before the user uses the resources. When the user applies for resource use, the initialization time can be saved, and the status of resources in the resource pool can be monitored in real time. When the resources in the resource pool do not meet the available proportion of the system configuration, the resource pool is supplemented in real time. Based on this, the technical solution of the present application is proposed.
[0071] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0072] Figure 1 A schematic diagram of a process flow of a resource management method embodiment 1 provided in the present application, such as Figure 1 As shown, the method specifically includes:
[0073] S101: Based on the monitoring of the available resource ratio of each resource in the resource pool, the resources whose available resource ratio is lower than a preset ratio threshold are determined as resources to be supplemented.
[0074] In this step, in order to achieve efficient resource management and improve service performance, resources are applied to the resource server in advance and placed in the resource pool. During the process of users using resources, each resource in the resource pool is monitored to determine the resources to be supplemented.
[0075] Specifically, for each resource in the resource pool, the available resource ratio of the resource is monitored, and a ratio threshold is preset. If the available resource ratio of the resource is less than the ratio threshold, it means that the resource is in short supply and needs to be supplemented, then the resource is determined as a resource to be supplemented.
[0076] Optionally, in the process of monitoring resources in the resource pool, different types of resources in the resource pool can also be monitored differently. For example, different types of resources such as CPU, memory, storage space, network bandwidth, etc. can be preset with different monitoring indicators according to different types of resources, such as usage rate, remaining amount, etc. Then, select the appropriate monitoring tool or API according to the resource type and monitoring requirements. For example, for server resources, tools such as Prometheus and Zabbix can be used; for cloud services, the API provided by the cloud service provider can be used directly. You can also set the appropriate data collection frequency according to the frequency of resource changes and monitoring requirements.
[0077] For each resource, calculate its available resource ratio based on the collected data. For example, available memory ratio = (total memory - used memory) / total memory. Store the calculation results in the database or memory for subsequent analysis and comparison. Set a reasonable ratio threshold for each resource based on business needs and resource characteristics, and allow administrators to adjust the threshold based on actual conditions. Analyze the available resource ratio of resources regularly (such as every second, every minute) or based on trigger conditions (such as data changes). When it is found that the available resource ratio of a resource is lower than the preset threshold, an alarm is triggered. The alarm can be sent to relevant personnel via email, SMS, Slack messages, etc.
[0078] S102: Send a resource application request to a resource server through a thread pool.
[0079] In this step, after the resources to be supplemented are determined, a resource application request is sent to the resource server based on the resource demand information corresponding to the resources to be supplemented.
[0080] Specifically, in order to achieve efficient and high-concurrency processing, resource application requests can be sent to resource servers through thread pools. A thread pool is a container that manages multiple threads. It can reduce the overhead of thread creation and destruction and perform multiple tasks by reusing threads. The thread pool allows requests to be sent to multiple resource servers at the same time without creating a new thread for each request.
[0081] Exemplarily, according to the system load and resource constraints, a thread pool of appropriate size is initialized. For example, if it is decided to process 20 concurrent requests at the same time, a thread pool with 20 threads is created. Then, for each resource server, a task is defined, which is responsible for building a request (such as an HTTP GET request), sending it to the corresponding resource server, and processing the response (such as parsing data in JSON format). Traverse the list of resource servers, create a task for each resource server, and submit these tasks to the thread pool. The thread pool will automatically allocate threads to execute tasks based on the number of currently idle threads. The threads in the thread pool start to execute the submitted tasks. Since there are multiple threads, multiple requests can be sent to different resource servers at the same time. Each thread is responsible for sending requests, waiting for responses, processing responses, and returning the processing results to the main program or storing them for subsequent use.
[0082] Optionally, you can monitor the status of the thread pool to see how many tasks are waiting to be executed and how many tasks have been completed. After all tasks are submitted to the thread pool, you can choose to wait for all tasks to be completed, or set a timeout to continue executing subsequent logic after the timeout (even if some tasks may not be completed yet). After all tasks are completed, or when the main program is about to exit, you need to close the thread pool. This ensures that all resources are released correctly and avoids problems such as memory leaks.
[0083] S103: Receive a resource set sent by a resource server, and add it to a resource pool.
[0084] In this step, after sending a resource application request to the resource server through the above steps, the resource server allocates resources according to the resource application request, and then returns the allocated resources, and after receiving the resource set sent by the resource server, it is supplemented to the resource pool. Among them, the resource set includes supplementary resources for each resource to be supplemented.
[0085] Specifically, when an HTTP GET request is sent to a resource server through a thread in the thread pool, the resource server returns a response body containing the required resources. This response body may be a JSON array, XML document, or other format of data collection, depending on the protocol between the resource server and the resource server.
[0086] Exemplarily, once a response is received, the next step is to parse the response body to extract the specific resources in the resource collection. This usually involves using a JSON parsing library (such as Jackson, Gson, or Fastjson) to parse JSON data, or using an XML parser (such as a DOM parser or SAX parser) to parse XML data. The result of the parsing will be a set of resource objects that represent the specific resources obtained from the resource server.
[0087] Optionally, before adding resources to the resource pool, the resources can also be verified to ensure their integrity, correctness, and security. Verification can include checking whether the format of the resource meets the expected format, verifying the integrity of the data (such as using hashes or digital signatures), and ensuring that the resource does not contain malicious code or sensitive information. After verification, the resource can be added to the resource pool. A resource pool is a component that stores and manages resources. It can be an in-memory data structure (such as a list, set, or hash table) or a persistent storage (such as a database, file system, or cache). If the resource pool is an in-memory data structure, the parsed and verified resource objects can be directly added to this data structure. The advantage of this is fast access speed, but the disadvantage is that if the system restarts or crashes, the resource data may be lost. If the resource pool is a persistent storage, the resource data needs to be written to a database, file system, or cache. The advantage of this is that even if the system restarts or crashes, the resource data will not be lost, but the access speed may be slower than the in-memory data structure.
[0088] In one possible implementation, you may need to deal with concurrency and synchronization issues when adding resources to the resource pool. In particular, when multiple threads add resources to the resource pool at the same time, you need to ensure data consistency and integrity. This can be achieved by using locks, synchronized blocks, concurrent collections (such as ConcurrentHashMap), or other concurrency control mechanisms.
[0089] After resources are successfully added to the resource pool, other parts of the system (such as the user interface, other services, or workflows) can also be notified about this update. This can be achieved through event publishing, callback mechanisms, message queues, or other communication mechanisms.
[0090] Optionally, before users apply to use resources, they can create and update the resource management business table based on actual business data, so as to assemble resource demand information based on the resource business table, and then apply to the resource server for release in advance, and mark the resources as released or unreleased according to business needs. The scheduled release and removal of resources can be realized through scheduled tasks. When users apply for resource use, the corresponding resources are directly matched in the resource pool for users to use, which saves time and improves the user experience.
[0091] The resource management method provided in this embodiment is based on monitoring the available resource ratio of each resource in the resource pool, determining the resources whose available resource ratio is lower than the preset ratio threshold as resources to be supplemented, sending resource application requests to the resource server through the thread pool, receiving the resource set sent by the resource server, and supplementing it to the resource pool. The above method realizes efficient resource management, improves system stability and performance, improves resource utilization, and enhances the automation and flexibility of the system by monitoring resource ratios, automatically applying for and supplementing resources.
[0092] Figure 2 A flow chart of the second embodiment of the resource management method provided in the embodiment of the present application is shown in FIG. Figure 2 As shown, based on the above embodiment, the method further includes:
[0093] S201: Verify resource information in a resource pool and resource information in a resource server according to a preset verification period.
[0094] In this step, in order to ensure the consistency of resource pool data and resource server data, a scheduled task is used to periodically send a resource verification request to the resource server.
[0095] Specifically, according to a preset verification cycle, when the verification time is reached, the resource information in the resource pool is compared with the resource information in the resource server to check whether the data is consistent.
[0096] Exemplarily, the preset verification period can be daily, weekly or monthly, which can be set according to the importance of resources, the frequency of changes and the maintenance requirements of the system. In the system, a scheduled task (such as a cron job, Windows task scheduler or the timing function of a cloud service) can be used to trigger the verification process.
[0097] Obtain resource information in the resource pool from the resource pool management system through API calls, database queries or other interfaces, usually including the resource's unique identifier, name, status, configuration details, etc.
[0098] Get resource information directly from the resource server through SSH, API, remote call or other protocols, including the resource's unique identifier, status, actual configuration, etc.
[0099] Compare the resource information in the resource pool with the information on the resource server. This typically involves the following steps:
[0100] Identifier matching: First confirm whether the resource identifiers between the two are consistent.
[0101] Status comparison: compare whether the status of resources is the same, such as running, stopped, faulty, etc.
[0102] Configuration verification: Key configuration items, such as IP addresses, storage quotas, and security settings, are compared one by one.
[0103] S202: If the verification fails, data synchronization is performed to make the resource information in the resource pool consistent with the resource information in the resource server.
[0104] In this step, the resource information is verified through the above steps. If the verification fails, it means that the resource data of the two are inconsistent, so the data is synchronously updated to make the resource information in the resource pool consistent with the resource information in the resource server.
[0105] Exemplarily, first identify which resources have inconsistent information. For example, it involves multiple aspects such as resource identifiers, status, and configuration. By comparing the verification results, a list containing the details of inconsistent resources can be generated. Then, for each inconsistent resource, try to analyze the cause of the inconsistency. This helps to determine the specific strategy for synchronization updates and prevent similar problems from happening again in the future. The reasons may include data entry errors, errors in the synchronization process, changes on the resource server side that have not been notified to the resource pool, etc. Design an appropriate synchronization strategy based on the cause of the inconsistency and the characteristics of the resource. The synchronization strategy may include:
[0106] Full synchronization: Resynchronize all resource information on the resource server to the resource pool. This is suitable for situations where the number of resources is small or the resource pool information needs to be completely updated.
[0107] Incremental synchronization: Synchronizes only the resource information that has changed since the last synchronization, reducing the amount of data transferred and the synchronization time.
[0108] Conditional synchronization: Selectively synchronize resource information based on specific conditions (such as resource status, timestamp, etc.).
[0109] Perform actual synchronization operations according to the designed synchronization strategy. For example:
[0110] Get the latest information from the resource server: Get the latest resource information from the resource server through API calls, remote calls, or other methods.
[0111] Update resource pool: Update the latest information obtained to the resource pool, which may involve modifying database records, updating memory data structures, or triggering update operations of other systems.
[0112] Verify synchronization results: After the synchronization is completed, verify again to ensure that the resource information in the resource pool is consistent with the information on the resource server.
[0113] Optionally, if the synchronization operation involves important resources or may have an impact on other systems, relevant managers should be notified. The notification can be made via email, SMS, message queue or other communication channels.
[0114] Optionally, extract resource information from the resource server in the Redis cache.
[0115] In this step, in order to reduce the interaction with the database service, you can put the frequently read data into the Redis cache. If the resource information in the resource server changes, the cached data in the Redis cache will be updated.
[0116] It should be noted that users apply for corresponding resources according to their needs, and change the status of corresponding resources in the resource pool to occupied, so as to prevent multiple users from using the same resource and realize resource isolation.
[0117] The resource management method provided in this embodiment extracts resource information from the resource server in the Redis cache, verifies the resource information in the resource pool and the resource information in the resource server according to a preset verification cycle, and if the verification fails, performs data synchronization update to make the resource information in the resource pool consistent with the resource information in the resource server. The above method realizes the effective management and maintenance of resource information in the resource pool by extracting resource information from the Redis cache, regularly verifying data consistency and performing synchronous updates, ensuring data consistency, reducing data errors and conflicts, improving system stability and reliability, and optimizing resource utilization efficiency.
[0118] Figure 3 A flowchart of the resource management method embodiment 3 provided in the present application is shown in FIG. Figure 3 As shown, based on the above embodiment, the method further includes:
[0119] S301: When any resource in the resource pool is detected to be abnormal, the abnormal resource is marked for destruction.
[0120] S302: Send a resource release request to the resource server.
[0121] In order to achieve efficient resource management and improve user experience, if a resource anomaly is detected in the resource pool, the resource needs to be marked as destroyed immediately. This usually involves updating the resource record in the resource pool management system, changing the resource status from "normal" to "destroying" or a similar mark. This mark will ensure that other systems or processes will not continue to try to use the resource. Among them, anomalies may include resource unavailability, performance degradation, configuration errors, updates, etc.
[0122] After detecting an anomaly, a request to release the resource is sent to the resource server. This request should contain enough information so that the resource server can identify and release the corresponding resource. The content of the request may include the unique identifier of the resource, the resource type, the release instruction, etc.
[0123] Use API calls: If the resource server provides an API interface, you can send instructions to release resources through HTTP requests or other protocols.
[0124] Remote call: If the resource server and resource pool management system are in the same network, you can use remote calls (such as RMI, gRPC, etc.) to send requests.
[0125] Message queue: If a message queue is used in the system architecture, a request to release resources can be sent to the queue, which will be listened and processed by the resource server.
[0126] After sending a request to release a resource, you need to wait for a confirmation message from the resource server to ensure that the resource has been successfully released. This can be achieved by polling the resource status, listening for callbacks, or waiting for a response in the message queue.
[0127] Once a release confirmation message is received from the resource server, or after a period of time it is confirmed that the resource has been released (for example, by rechecking the resource status), the resource record in the resource pool management system needs to be updated to change the resource status from "being destroyed" to "destroyed" or "idle".
[0128] Optionally, if it is detected that a user is using abnormal resources, it is necessary to make an appointment with the resource server to release the resources after the user's use ends, and the user is prompted through a message queue that the resource is abnormal and the reason for the abnormality.
[0129] The resource management method provided in this embodiment, when any resource in the resource pool is detected to be abnormal, marks the abnormal resource as destroyed and sends a resource release request to the resource server. The above method realizes effective management and maintenance of resources in the resource pool by timely detecting and releasing abnormal resources, realizes rapid response and problem isolation, improves resource utilization, maintains system stability and reliability, and enhances user experience.
[0130] Figure 4 A flowchart of a fourth embodiment of the resource management method provided in the present application is shown in FIG. Figure 4 As shown, based on the above embodiment, the method further includes:
[0131] S401: For any occupied resource in a resource pool, determine whether the resource is an invalid occupied resource based on the occupied time set by the user corresponding to the resource, historical usage information, and a preset time threshold.
[0132] S402: If it is determined that the resource is an invalid occupied resource, an application is made to the resource server to release the resource through a message queue.
[0133] In order to reduce the burden on the resource server and improve performance, the resources occupied by each user in the resource pool are monitored to determine whether the resources are invalidly occupied. If so, an application for release is made to the resource server.
[0134] Specifically, for each occupied resource, whether it is an invalid occupied resource is determined based on the occupied time set by the user corresponding to the resource, historical usage information and preset time threshold. Among them, the occupied time set by the user is the expected occupied time set by the user before or during the use of the resource, the historical usage information includes the past usage records of the resource, such as the duration, frequency, time period, etc. of each use, and the preset time threshold is one or more time standards set by the system or administrator according to resource characteristics and business needs, which is used to determine whether the resource occupation is valid.
[0135] Exemplarily, for any occupied resource in the resource pool, based on the historical usage information corresponding to the resource, the timestamp of the last use of the resource is determined, and based on the timestamp, it is determined whether the time period for which the resource has not been used exceeds a time threshold. If it is determined that the time period for which the resource has not been used exceeds the time threshold, and the occupation time of the resource has exceeded the occupation time set by the user, then the resource is determined to be an invalid occupied resource.
[0136] Optionally, if it is determined that the resource has not been used for a period of time exceeding a time threshold and the resource occupation time does not exceed the occupation time set by the user, a prompt message is sent to the user, a feedback message from the user is received, and based on the feedback message, it is determined whether the resource is an invalid occupied resource.
[0137] The resource management method provided in this embodiment determines whether a resource is an invalid occupied resource based on the occupied time set by the user corresponding to the resource, historical usage information and the preset time threshold for any occupied resource in the resource pool. If the resource is determined to be an invalid occupied resource, the resource server is requested to release the resource through the message queue. This method optimizes resource utilization, enhances user experience, realizes automated management, reduces the burden on the resource server, and effectively improves the management level and overall performance of the resource pool by accurately identifying invalid occupied resources.
[0138] Figure 5 A flowchart of a fifth embodiment of the resource management method provided in the present application is shown in FIG. Figure 5 As shown, based on the above embodiment, step S401 specifically includes:
[0139] S501: For any occupied resource in a resource pool, determine a timestamp of the last use of the resource based on historical usage information corresponding to the resource.
[0140] S502: Determine, based on the timestamp, whether the resource unused time exceeds a time threshold.
[0141] S503: If it is determined that the resource is not used for a period of time exceeding the time threshold, and the resource occupation time has exceeded the occupation time set by the user, the resource is determined to be an invalid occupied resource.
[0142] For each occupied resource, obtain the timestamp of the last time the resource was used from the historical usage information of the resource. Subtract the timestamp of the last use from the current timestamp to obtain the length of time (usually in seconds, minutes, or hours) that the resource has not been used since the last use. Compare the calculated length of time that the resource has not been used with the preset length of time threshold. If it exceeds the threshold, it indicates that the resource has not been used for a long time, and its occupation status needs to be further determined. Compare the actual occupation time with the occupation time set by the user. If it exceeds the user setting, and the length of time that the resource has not been used also exceeds the length of time threshold, it can be determined that the resource is an invalid occupied resource.
[0143] The resource management method provided in this embodiment determines the timestamp of the last use of any occupied resource in the resource pool based on the historical usage information corresponding to the resource, and determines whether the unused time of the resource exceeds the time threshold according to the timestamp. If it is determined that the unused time of the resource exceeds the time threshold and the occupied time of the resource has exceeded the occupied time set by the user, the resource is determined to be an invalid occupied resource. This method optimizes resource allocation, reduces resource waste, improves user experience, and enhances system stability through accurate resource status evaluation.
[0144] Figure 6 A flowchart of the sixth embodiment of the resource management method provided in the embodiment of the present application is shown in FIG. Figure 6 As shown, based on the above embodiment, step S401 may further include:
[0145] S601: If it is determined that the resource unused time exceeds the time threshold, and the resource occupied time does not exceed the occupied time set by the user, a prompt message is sent to the user.
[0146] S602: Receive feedback from the user.
[0147] S603: Determine whether the resource is an invalid occupied resource based on the feedback message.
[0148] If it is determined that the resource has not been used for a period of time exceeding the threshold, and the resource usage time does not exceed the user-set usage time, a prompt message needs to be sent to the user to understand the user's needs. The prompt message is used to inform the user that the resource has not been used for a period of time (specifically specifying the unused time), but has not yet reached the user-set usage time limit. According to the user's preferences and system support, select an appropriate notification method (such as email, SMS, in-app notification, etc.) to send the prompt message. In the prompt message, provide users with convenient feedback channels, such as directly replying to emails, clicking on links to enter the feedback page, and replying to SMS using specific commands. After sending the prompt, the system needs to wait for a period of time to receive the user's feedback message. A reasonable waiting time threshold can be set. If no feedback is received after this time, other measures can be considered.
[0149] Once the user's feedback message is received, the system needs to analyze its content to understand the user's intentions and plans.
[0150] If the user plans to continue using the resource and provides a reasonable explanation or a need to extend the usage, the system can allow the user to continue to occupy the resource and may update the usage time limit based on the user's requirements.
[0151] If the user agrees to release the resources: the system should immediately perform the resource release operation and put the resources back into the resource pool.
[0152] If the user does not give clear instructions: the system may need to communicate with the user again or handle resources according to preset strategies (such as automatic release, continued waiting, etc.).
[0153] Update resource status: Update the status of resources in the system (such as still occupied, released, etc.) based on user feedback.
[0154] The resource management method provided in this embodiment sends a prompt message to the user, receives a feedback message from the user, and determines whether the resource is an invalid occupied resource based on the feedback message if it is determined that the resource has not been used for a period of time exceeding the time threshold and the occupied time of the resource has not exceeded the occupied time set by the user. This method improves resource utilization efficiency, provides a personalized service experience, and enhances the intelligence level of the system by enhancing user participation and flexibly handling special situations.
[0155] Figure 7 A schematic diagram of the structure of the resource management device embodiment provided in the present application, such as Figure 7 As shown, the resource management device 700 includes:
[0156] The first determination module 701 is used to determine the resources whose available resource ratio is lower than a preset ratio threshold as resources to be supplemented based on the available resource ratio of each resource in the monitoring resource pool;
[0157] The first sending module 702 is used to send a resource application request to the resource server through the thread pool, where the resource application request includes resource demand information corresponding to each resource to be supplemented;
[0158] The receiving module 703 is used to receive a resource set sent by a resource server and add it to a resource pool. The resource set includes supplementary resources for each resource to be supplemented.
[0159] Optionally, the resource management device 700 further includes:
[0160] Verification module 704, used to verify resource information in the resource pool and resource information in the resource server according to a preset verification cycle;
[0161] The synchronization module 705 is used to perform data synchronization update if the verification fails, so that the resource information in the resource pool is consistent with the resource information in the resource server.
[0162] Optionally, the resource management device 700 further includes:
[0163] The extraction module 706 is used to extract resource information in the resource server from the Redis cache.
[0164] In a possible implementation, the resource management device 700 further includes:
[0165] The marking module 707 is used to mark the abnormal resource as destroyed when any resource in the resource pool is detected to be abnormal;
[0166] The second sending module 708 is used to send a resource release request to the resource server, where the resource release request includes an identifier of the abnormal resource.
[0167] In another possible implementation, the resource management device 700 further includes:
[0168] The second determination module 709 is used to determine, for any occupied resource in the resource pool, whether the resource is an invalid occupied resource based on the occupied time set by the user corresponding to the resource, historical usage information and a preset time threshold;
[0169] The application module 710 is used to apply to the resource server for releasing the resource through the message queue if it is determined that the resource is an invalid occupied resource.
[0170] Optionally, the second determining module is specifically configured to:
[0171] For any occupied resource in the resource pool, determine the timestamp of the last use of the resource based on the historical usage information corresponding to the resource;
[0172] Determine whether the resource unused time exceeds the time threshold according to the timestamp;
[0173] If it is determined that the resource has not been used for a period of time exceeding a time threshold, and the resource has been occupied for a period of time exceeding an occupation time set by the user, the resource is determined to be an invalid occupation resource.
[0174] Optionally, the second determining module is further specifically configured to:
[0175] If it is determined that the resource has not been used for a period of time exceeding the time threshold, and the resource has not been used for a period of time exceeding the user-set period of time, a prompt message is sent to the user to prompt the user whether to release the resource;
[0176] Receive a feedback message from the user, where the feedback message is used to indicate whether the user agrees to release the resource;
[0177] Based on the feedback message, it is determined whether the resource is an invalid occupied resource.
[0178] The resource management device provided in the above embodiment is used to execute the resource management method in any of the above method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.
[0179] Figure 8 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application, such as Figure 8 As shown, it includes: a processor 802, a memory 801 and a communication interface 803 which are communicatively connected to the processor 802;
[0180] The memory 801 stores computer executable instructions;
[0181] The processor 802 executes the computer-executable instructions stored in the memory 801 to implement the resource management method in any of the aforementioned embodiments.
[0182] The communication interface 803 is used to implement data communication with the resource server.
[0183] An embodiment of the present application further provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, they are used to implement the resource management method in any one of the embodiments.
[0184] The computer-readable storage medium mentioned above can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory, electrically erasable programmable read-only memory, erasable programmable read-only memory, programmable read-only memory, read-only memory, magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium can be any available medium that can be accessed by a general or special purpose computer.
[0185] Optionally, a readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in an application specific integrated circuit (ASIC). Of course, the processor and the readable storage medium can also exist in the device as discrete components.
[0186] An embodiment of the present application also provides a computer program product, which includes a computer program. The computer program is stored in a computer-readable storage medium. At least one processor can read the computer program from the computer-readable storage medium. When at least one processor executes the computer program, it can implement the technical solution provided by any of the above method embodiments.
[0187] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0188] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. A resource management method, characterized in that: include: Based on the available resource ratio of each resource in the monitoring resource pool, the resources whose available resource ratio is lower than the preset ratio threshold are determined as resources to be supplemented; Sending a resource application request to a resource server through a thread pool, wherein the resource application request includes resource demand information corresponding to each resource to be supplemented; A resource set sent by the resource server is received and added to the resource pool, wherein the resource set includes supplementary resources for each resource to be supplemented.
2. The method according to claim 1, characterized in that The method further comprises: Verifying the resource information in the resource pool and the resource information in the resource server according to a preset verification period; If the verification fails, data synchronization is performed to make the resource information in the resource pool consistent with the resource information in the resource server.
3. The method according to claim 2, characterized in that The method further comprises: The resource information in the resource server is extracted from the Redis cache.
4. The method according to claim 1, characterized in that The method further comprises: When any resource in the resource pool is detected to be abnormal, marking the abnormal resource for destruction; A resource release request is sent to the resource server, wherein the resource release request includes an identifier of the abnormal resource.
5. The method according to claim 1, characterized in that: The method further comprises: For any occupied resource in the resource pool, based on the occupation time set by the user corresponding to the resource, historical usage information and a preset time threshold, determining whether the resource is an invalid occupied resource; If it is determined that the resource is an invalid occupied resource, an application is made to the resource server to release the resource through a message queue.
6. The method according to claim 5, characterized in that The determining whether the resource is an invalid occupied resource based on the occupation duration set by the user corresponding to the resource, historical usage information, and a preset duration threshold includes: For any occupied resource in the resource pool, determine a timestamp of the last use of the resource based on historical usage information corresponding to the resource; Determining, according to the timestamp, whether the resource has not been used for a period of time exceeding the time threshold; If it is determined that the unused time period of the resource exceeds the time period threshold, and the occupied time period of the resource exceeds the occupied time period set by the user, the resource is determined to be an invalid occupied resource.
7. The method according to claim 6, characterized in that The method further comprises: If it is determined that the resource has not been used for a period of time exceeding the time threshold, and the occupied time of the resource does not exceed the occupied time set by the user, a prompt message is sent to the user, wherein the prompt message is used to prompt the user whether to release the resource; receiving a feedback message from the user, where the feedback message is used to indicate whether the user agrees to release the resource; Determine whether the resource is an invalid occupied resource based on the feedback message.
8. A resource management device, characterized in that: include: A first determination module is used to determine resources whose available resource ratio is lower than a preset ratio threshold as resources to be supplemented based on the available resource ratio of each resource in the monitoring resource pool; A first sending module, configured to send a resource application request to a resource server through a thread pool, wherein the resource application request includes resource demand information corresponding to each resource to be supplemented; The receiving module is used to receive the resource set sent by the resource server and supplement it to the resource pool, wherein the resource set includes supplementary resources for each resource to be supplemented.
9. An electronic device, characterized in that: include: A processor, a memory and a communication interface connected to the processor in communication; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the resource management method as described in any one of claims 1 to 7 above.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the resource management method according to any one of claims 1 to 7.