Service operation method and device, electronic equipment and storage medium

By loading a pre-loaded global library using a dynamic linker, obtaining a resource binding whitelist and configuration policy information, and binding system-level resources to the target service, this solves the problem of insufficient resource configuration in complex business scenarios for managers such as systemd, and enables flexible resource management and customized resource binding.

CN121579096APending Publication Date: 2026-02-27PHYTIUM TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202511766912.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-27
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

In existing technologies, professional service managers such as systemd are unable to meet the fine-grained resource configuration needs of complex business scenarios, especially in multi-core, NUMA architectures, where resource control functions are relatively basic and cannot properly insert shared libraries to complete resource management and allocation.

Method used

The system loads a pre-loaded global library using a dynamic linker, runs its initialization code to obtain the resource binding whitelist and configuration policy information, and binds system-level resources to the target service based on this information, thereby achieving customized system resource binding.

Benefits of technology

It enables flexible resource configuration when the target service starts, meets the refined resource needs in complex business scenarios, and improves the flexibility and efficiency of system resource management.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579096A_ABST
    Figure CN121579096A_ABST
Patent Text Reader

Abstract

The invention provides a service operation method and device, electronic equipment and a storage medium, and relates to the technical field of computers. The method comprises the following steps: starting a target service, and loading a preset global preloading library through a dynamic linker; running an initialization code in a preset global preloading library to obtain a resource binding white list and resource configuration strategy information; according to the resource binding white list and the resource configuration strategy information, system-level resources are bound for the target service, and the target service is executed. By applying the embodiment of the invention, the preset global preloading library can be loaded when the target service is started, and by running an initialization code in the preset global preloading library, the target service can be loaded in the preset global preloading library. According to the method, the target resource configuration strategy corresponding to the target service identifier can be obtained, the corresponding system-level resource is bound for the target service according to the target resource configuration strategy, customized system resource binding of the target service is achieved, the method has the advantage of being flexible in configuration, and the refined resource configuration requirement in a complex service scene can be met.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a service operation method, apparatus, electronic device and storage medium. Background Technology

[0002] In modern high-performance server and cloud computing environments, operating systems need to run a large number of service processes simultaneously. Effective management and optimization of system resources (such as CPU, memory, and I / O bandwidth) have become key factors affecting overall system performance. Especially with the widespread adoption of multi-core and NUMA architectures, reasonable resource scheduling strategies can significantly reduce cross-node access latency, reduce context switching overhead, and improve cache hit rate.

[0003] Currently, in terms of resource management, systems generally use professional service managers such as systemd to start and manage services. However, the resource control functions provided by systemd itself are relatively basic. If started using such tools, shared libraries cannot be properly inserted to complete the management and allocation of resources.

[0004] Therefore, the existing methods of using professional service managers such as systemd to start and manage services are difficult to meet the fine-grained resource configuration needs of complex business scenarios. Summary of the Invention

[0005] The purpose of this application is to address the shortcomings of the prior art by providing a service operation method, apparatus, electronic device, and storage medium that can achieve customized system resource binding for target services, has flexible configuration features, and can meet the fine-grained resource configuration needs in complex business scenarios.

[0006] To achieve the above objectives, the technical solutions adopted in the embodiments of this application are as follows: In a first aspect, the present invention provides a service operation method, the method comprising: Start the target service and load the preset global preloaded library through the dynamic linker; Run the initialization code in the preset global preloaded library to obtain the resource binding whitelist and resource configuration policy information. The resource binding whitelist includes the service identifier corresponding to at least one service that needs to be bound to resources. The resource configuration policy information includes the resource configuration policy corresponding to each service identifier. Based on the resource binding whitelist and resource configuration policy information, system-level resources are bound to the target service, and the target service is executed.

[0007] In an optional implementation, running the initialization code in the preset global preload library to obtain resource binding whitelist and resource configuration policy information includes: Run the initialization code in the preset global preloaded library, and attempt to access the first shared memory according to the first preset memory identifier corresponding to the first shared memory. The first shared memory stores the second memory identifier of the second shared memory, and the second shared memory stores the resource binding whitelist and resource configuration policy. If the first shared memory can be successfully accessed according to the first preset memory identifier, then the second memory identifier is obtained through the first shared memory; Based on the second memory identifier, access the second shared memory to obtain the resource binding whitelist and resource configuration policy.

[0008] In an optional implementation, the step of binding system-level resources to the target service based on the resource binding whitelist and resource configuration policy information, and then executing the target service, includes: Check whether the target service identifier corresponding to the target service is included in the resource binding whitelist; If included, the target resource configuration strategy corresponding to the target service identifier is obtained according to the resource configuration strategy information; According to the target resource configuration policy corresponding to the target service identifier, bind system-level resources to the target service and execute the target service.

[0009] In an optional implementation, the method further includes: If access to the first shared memory fails or the target service identifier corresponding to the target service is not included in the resource binding whitelist, then the target service is run.

[0010] In an optional implementation, the method further includes: Run a preset monitoring service to obtain the resource binding whitelist and resource configuration policy from the preset configuration file, and generate a first shared memory, a second shared memory, and a second memory identifier corresponding to the second shared memory. The preset configuration file includes the resource binding whitelist and resource configuration policy information.

[0011] In an optional implementation, the method further includes: Detect whether the preset configuration file has been updated; If the preset configuration file is updated, a third shared memory and a third memory identifier corresponding to the third shared memory are generated. Write the resource binding whitelist and resource configuration policy from the current preset configuration file into the third shared memory; Write the third memory identifier into the first shared memory.

[0012] In an optional implementation, after writing the resource binding whitelist and resource configuration policy from the current preset configuration file into the third shared memory, the method further includes: Monitor whether the second shared memory is in use; If the second shared memory is not in use, release the second shared memory.

[0013] In an optional implementation, the resource configuration strategy information specifically includes a resource configuration mask for at least one resource corresponding to each service identifier, wherein the resource configuration mask is used to indicate the resource information corresponding to each service identifier.

[0014] In a second aspect, the present invention provides a service operation apparatus, the apparatus comprising: The startup module is used to start the target service and loads the preset global preloaded libraries through the dynamic linker; The acquisition module is used to run the initialization code in the preset global preloaded library to obtain the resource binding whitelist and resource configuration policy information. The resource binding whitelist includes: the service identifier corresponding to at least one service that needs to be bound to resources, and the resource configuration policy information includes the resource configuration policy corresponding to each service identifier. The execution module is used to bind system-level resources to the target service according to the resource binding whitelist and resource configuration policy information, and then execute the target service.

[0015] In an optional implementation, the acquisition module is specifically used to run the initialization code in the preset global preload library, and attempt to access the first shared memory according to the first preset memory identifier corresponding to the first shared memory. The first shared memory stores the second memory identifier of the second shared memory, and the second shared memory stores a resource binding whitelist and a resource configuration strategy. If the first shared memory can be successfully accessed according to the first preset memory identifier, then the second memory identifier is obtained through the first shared memory; Based on the second memory identifier, access the second shared memory to obtain the resource binding whitelist and resource configuration policy.

[0016] In an optional implementation, the execution module is specifically used to check whether the resource binding whitelist includes the target service identifier corresponding to the target service; If included, the target resource configuration strategy corresponding to the target service identifier is obtained according to the resource configuration strategy information; According to the target resource configuration policy corresponding to the target service identifier, bind system-level resources to the target service and execute the target service.

[0017] In an optional implementation, the execution module is further configured to run the target service if access to the first shared memory fails or the target service identifier corresponding to the target service is not included in the resource binding whitelist.

[0018] In an optional implementation, the acquisition module is further configured to run a preset monitoring service, acquire the resource binding whitelist and resource configuration policy in a preset configuration file, and generate a first shared memory, a second shared memory, and a second memory identifier corresponding to the second shared memory, wherein the preset configuration file includes the resource binding whitelist and the resource configuration policy information.

[0019] In an optional implementation, the acquisition module is further configured to detect whether the preset configuration file has been updated; If the preset configuration file is updated, a third shared memory and a third memory identifier corresponding to the third shared memory are generated. Write the resource binding whitelist and resource configuration policy from the current preset configuration file into the third shared memory; Write the third memory identifier into the first shared memory.

[0020] In an optional implementation, the acquisition module is further configured to monitor whether the second shared memory is being used; If the second shared memory is not in use, release the second shared memory.

[0021] In an optional implementation, the resource configuration strategy information specifically includes a resource configuration mask for at least one resource corresponding to each service identifier, wherein the resource configuration mask is used to indicate the resource information corresponding to each service identifier.

[0022] Thirdly, the present invention provides an electronic device, comprising: a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of any of the service operation methods described in the foregoing embodiments.

[0023] Fourthly, the present invention provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the steps of the service operation method as described in any of the foregoing embodiments.

[0024] The beneficial effects of this application are: The service operation method, apparatus, electronic device, and storage medium provided in this application include: starting a target service and loading a preset global preload library through a dynamic linker; running initialization code in the preset global preload library to obtain a resource binding whitelist and resource configuration policy information, wherein the resource binding whitelist includes service identifiers corresponding to at least one service that needs resource binding, and the resource configuration policy information includes resource configuration policies corresponding to each service identifier; binding system-level resources to the target service according to the resource binding whitelist and resource configuration policy information, and executing the target service. By applying this application embodiment, the preset global preload library can be loaded when the target service starts, and by running the initialization code in the preset global preload library, the target resource configuration policy corresponding to the target service identifier can be obtained, and the corresponding system-level resources can be bound to the target service accordingly. This achieves customized system resource binding for the target service, has the characteristic of flexible configuration, and can meet the fine-grained resource configuration needs in complex business scenarios. Attached Figure Description

[0025] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.

[0026] Figure 1 A flowchart illustrating a service operation method provided in an embodiment of this application; Figure 2 A flowchart illustrating another service operation method provided in an embodiment of this application; Figure 3 A flowchart illustrating another service operation method provided in an embodiment of this application; Figure 4 A flowchart illustrating another service operation method provided in an embodiment of this application; Figure 5 A flowchart illustrating another service operation method provided in an embodiment of this application; Figure 6 A functional module diagram of a service operation device provided in an embodiment of this application; Figure 7 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations.

[0028] Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely to illustrate selected embodiments of the application. All other embodiments obtained by those skilled in the art based on the embodiments of this application without inventive effort are within the scope of protection of this application.

[0029] It should be noted that similar labels and letters in the following figures indicate similar items. Therefore, once an item is defined in one figure, it does not need to be further defined and explained in subsequent figures.

[0030] In modern computing environments, especially server environments, the management and optimization of resources (such as memory, CPU, network bandwidth, etc.) have become particularly important. Effective resource management can improve application performance and user experience, and reduce energy consumption.

[0031] Preloading refers to the process where the system loads some resources or data into memory before the application starts, in order to reduce access latency and improve response speed. This technology plays an important role in improving user experience and application performance, but it is usually difficult to implement in the scenario of starting system-level services.

[0032] In related technologies, for general applications, the LD_PRELOAD environment variable can be used to insert shared libraries at runtime to modify application behavior. However, using this technology in other scenarios has certain limitations. For example, operating systems use service managers such as systemd to start and manage services. However, the resource control functions provided by systemd itself are relatively basic. If an application is started using such a tool, it cannot properly insert shared libraries to complete resource management and allocation. Although systemd provides some methods for limiting resources internally, its flexibility and customizability are far from sufficient to meet the fine-grained resource configuration needs of complex business scenarios.

[0033] In view of this, the embodiments of this application provide a service operation method, which enables the target service to load the preset global preload library when it starts, and by running the initialization code in the preset global preload library, the target resource configuration policy corresponding to the target service identifier can be obtained, and the corresponding system-level resources can be bound to the target service accordingly, so as to realize the customized system resource binding of the target service. It has the characteristics of flexible configuration and can meet the fine-grained resource configuration needs in complex business scenarios.

[0034] Figure 1 This is a flowchart illustrating a service operation method provided in an embodiment of this application. The execution subject of this method can be an electronic device such as a computer, server, or processor. In some embodiments, this method can be specifically applied to scenarios where service management tools (such as systemd, SysVinit, Upstart, etc.) are needed to start the service and where system-level resources need to be bound. Figure 1 As shown, the method includes: S101. Start the target service and load the preset global preloaded library through the dynamic linker.

[0035] Alternatively, the target service can be any service that requires customized system-level resources.

[0036] In some implementations, the target service can be a system-level background process and a service that can be started through a service management tool. In some implementations, the target service may have the following characteristics: it runs automatically when the system starts; it can be executed without user login; it resides in memory for a long time to provide continuous functional support (such as network response, logging, etc.); it runs with root or specific system user privileges; and it can be manually started and stopped via command line.

[0037] In some implementations, the target service may specifically be a web server, database service, caching service, log service, scheduling service, network service, security service, virtualization service, cluster coordination service, etc., and is not limited here.

[0038] Optionally, the preset global preloaded libraries may include: whitelist acquisition interface, configuration policy acquisition interface, system resource binding interface, etc. The dynamic linker is a system program responsible for loading the shared libraries (.so files) that an executable program depends on and performing symbol resolution and relocation when the operating system starts the executable program.

[0039] In some implementations, the target service can be started through a service management tool, and the preset global preloaded library can be loaded through a dynamic linker. Compared with the existing conventional preloaded library method, this can ensure that the preset global preloaded library can be loaded when the target service starts, and it has a certain degree of versatility.

[0040] It's important to note that existing conventional preloaded libraries are parsed by the ld.so library during loading. The functions and interfaces provided in the preloaded library override those of other dynamic libraries, allowing the execution of custom code. However, this method needs to consider the potential loss of preloaded library environment variables when starting other applications via the exec system call. For example, the ld.so library checks program permissions during parsing; if the setuid bit is set, it will abandon loading the preloaded library for security reasons. Furthermore, when starting a service through a service management tool, the preloaded library is first applied to the tool and then passed to the service via environment variables. If these environment variables are explicitly set, the preloaded library variables may be lost, leading to loading failure. Additionally, for service startup tools that start automatically at system boot, the preloaded library cannot be applied because, during system startup, the tool uses the default startup method without modifying the startup method.

[0041] S102. Run the initialization code in the preset global preload library to obtain the resource binding whitelist and resource configuration strategy information.

[0042] The resource binding whitelist includes: the service identifier corresponding to at least one service that needs to be bound to resources, and the resource configuration policy information includes the resource configuration policy corresponding to each service identifier.

[0043] The preset global preloaded library may include initialization code indicated by the init function. The initialization code indicated by the init function will be automatically executed when the shared library (.so file) is loaded into the process address space and before the main program main() is executed. By executing the init function, program control can be obtained.

[0044] Optionally, the resource binding whitelist and resource configuration policy information can be configured to be stored in a preset configuration file (e.g., a preset JSON configuration file). The resource binding whitelist can be a pre-configured list containing service identifiers corresponding to at least one service that requires resource binding. The resource configuration policy information can indicate the resource configuration policy corresponding to each service identifier. Optionally, the resource configuration policy corresponding to each service identifier can be a pre-defined optimal configuration policy for the target service, customized by the designer.

[0045] In some implementations, the resource configuration strategy corresponding to each service identifier may specifically include system resources such as memory, CPU, and NUMA nodes corresponding to each service identifier, which are not limited here.

[0046] In some implementations, the initialization code in the preset global preload library may include a whitelist acquisition interface and a configuration policy acquisition interface. By running the initialization code in the preset global preload library, the preset resource binding whitelist and resource configuration policy information can be obtained through the whitelist acquisition interface and configuration policy acquisition interface in the initialization code, respectively.

[0047] S103. Based on the resource binding whitelist and resource configuration policy information, bind system-level resources to the target service and execute the target service.

[0048] Based on the above description, optionally, the initialization code in the preset global preload library may also include: system resource binding interface.

[0049] In some implementations, if it is determined that the target service identifier of the target service is included in the resource binding whitelist, the target resource configuration policy corresponding to the target service identifier can be obtained according to the resource configuration policy information. Based on the system resource binding policy indicated by the target resource configuration policy, system-level resources can be bound to the target service through the system resource binding interface in the initialization code, thereby meeting the customized system resource binding requirements of the target service.

[0050] Furthermore, after the system resource binding is completed, the target service continues to be executed, that is, the main function of the target service continues to be executed.

[0051] In summary, this application provides a service operation method, which includes: starting a target service and loading a preset global preloaded library through a dynamic linker; running initialization code in the preset global preloaded library to obtain a resource binding whitelist and resource configuration policy information, wherein the resource binding whitelist includes service identifiers corresponding to at least one service that needs resource binding, and the resource configuration policy information includes resource configuration policies corresponding to each service identifier; binding system-level resources to the target service according to the resource binding whitelist and resource configuration policy information, and executing the target service. By applying this application, the preset global preloaded library can be loaded when the target service starts, and by running the initialization code in the preset global preloaded library, the target resource configuration policy corresponding to the target service identifier can be obtained, and the corresponding system-level resources can be bound to the target service accordingly, thereby realizing customized system resource binding for the target service. This method has the characteristics of flexible configuration and can meet the fine-grained resource configuration needs in complex business scenarios.

[0052] Figure 2 This is a flowchart illustrating another service operation method provided in an embodiment of this application. In optional implementations, such as... Figure 2As shown, the above-mentioned initialization code in the preset global preload library is used to obtain resource binding whitelist and resource configuration policy information, including: S201. Run the initialization code in the preset global preload library and attempt to access the first shared memory according to the first preset memory identifier corresponding to the first shared memory.

[0053] The first shared memory stores the second memory identifier of the second shared memory, and the second shared memory stores the resource binding whitelist and resource configuration policy.

[0054] The first preset memory identifier (key1) corresponding to the first shared memory (map1) can be a preset fixed value. Optionally, the first preset memory identifier can be stored in a preset global preload library. The first preset memory identifier (key2) corresponding to the second shared memory (map2) can be generated by a preset function (e.g., ftok).

[0055] Optionally, the resource binding whitelist and resource configuration policy information can be configured to be stored in a preset configuration file (e.g., a preset JSON configuration file). In some implementations, the preset configuration file can be parsed to obtain the resource binding whitelist and resource configuration policy information, and then processed and stored in the second shared memory.

[0056] S202. If the first shared memory can be successfully accessed according to the first preset memory identifier, then the second memory identifier is obtained through the first shared memory.

[0057] S203. Based on the second memory identifier, access the second shared memory to obtain the resource binding whitelist and resource configuration policy.

[0058] In some implementations, the initialization code in the preset global preload library may also include a shared memory access interface. When the initialization code in the preset global preload library is run, the shared memory access interface can be used to register and connect to the first shared memory according to the first preset memory identifier to obtain the virtual address corresponding to the first shared memory. The second memory identifier of the second shared memory can be obtained according to the virtual address corresponding to the first shared memory. The second memory identifier of the second shared memory can be registered and connected to the second shared memory according to the second preset memory identifier to obtain the virtual address corresponding to the second shared memory. The resource binding whitelist and resource configuration policy can be obtained according to the virtual address corresponding to the second shared memory.

[0059] By applying the embodiments of this application, resource binding whitelists and resource configuration policies can be obtained through shared memory, which reduces the overhead of opening files and other processes compared to file access. Of course, in some scenarios, other custom data can also be stored using shared memory to meet other custom requirements.

[0060] Figure 3 This is a flowchart illustrating another service operation method provided in an embodiment of this application. In optional implementations, such as... Figure 3 As shown, the above process, based on the resource binding whitelist and resource configuration policy information, binds system-level resources to the target service and executes the target service, including: S301. Check if the target service identifier corresponding to the target service is included in the resource binding whitelist.

[0061] The resource binding whitelist can be a pre-configured service identifier that includes at least one service that needs to be bound to a resource. For example, the resource binding whitelist can be customized in advance by the designer according to the requirements.

[0062] S302. If included, then obtain the target resource configuration policy corresponding to the target service identifier based on the resource configuration policy information.

[0063] S303. Based on the target resource configuration policy corresponding to the target service identifier, bind system-level resources to the target service and execute the target service.

[0064] In some implementations, the target service can be whitelisted based on the resource binding whitelist. Specifically, it is checked whether the target service identifier corresponding to the target service is included in the resource binding whitelist. If it is included, the target service is considered to have passed the whitelist verification. Then, the target resource configuration policy corresponding to the target service identifier can be further searched based on the resource configuration policy information. Based on the target resource configuration policy, system-level resources can be bound to the target service and the target service can be executed.

[0065] Of course, it should be noted that in some implementations, steps S301 to S303 may be executed after steps S201 to S203. That is, if the resource binding whitelist and resource configuration policy are successfully obtained, steps S301 to S303 are executed.

[0066] By applying the embodiments of this application, the introduction of a resource binding whitelist makes the method provided by this application applicable to scenarios that require customized system-level resource binding. By setting a resource binding whitelist and resource configuration strategy to obtain resources in a shared memory manner, a series of overheads such as opening files can be reduced, thereby improving the applicability of the method of this application.

[0067] In an optional implementation, the method further includes: If access to the first shared memory fails or the target service identifier corresponding to the target service is not included in the resource binding whitelist, then the target service will run.

[0068] Based on the above explanation, there are also cases where access to the first shared memory fails, or access to the second shared memory fails, or the target service identifier corresponding to the target service is not included in the resource binding whitelist (i.e., it fails the whitelist verification). In such cases, the target service can be started normally without performing the system resource binding operation.

[0069] By applying the embodiments of this application, it is possible to flexibly configure the service identifiers corresponding to the services that need to be bound to resources through the resource binding whitelist according to the actual application scenario, thereby realizing customized system resource binding.

[0070] In an optional implementation, the method further includes: Run the preset monitoring service, obtain the resource binding whitelist and resource configuration policy from the preset configuration file, and generate the first shared memory, the second shared memory, and the second memory identifier corresponding to the second shared memory. The preset configuration file includes resource binding whitelist and resource configuration policy information.

[0071] Optionally, the resource binding whitelist and resource configuration policy information can be configured to be stored in a preset configuration file (e.g., a preset JSON configuration file). In some implementations, a preset monitoring service can be run in the background to monitor and parse the preset configuration file in real time.

[0072] In some implementations, during the operation of the preset monitoring service, a first shared memory, a second shared memory, and a second memory identifier corresponding to the second shared memory can be generated using shared memory technology. The second memory identifier is then stored in the first shared memory. The preset configuration file is parsed using predefined fields to obtain resource binding whitelist and resource configuration policy information, which are then processed and stored in the second shared memory.

[0073] By applying the embodiments of this application, it is possible to store resource binding whitelists and resource configuration policy information in shared memory, thereby enabling fast filtering and reducing access overhead when accessing resources based on shared memory technology.

[0074] Figure 4 This is a flowchart illustrating another service operation method provided in an embodiment of this application. In optional implementations, such as... Figure 4 As shown, the above method also includes: S401. Check if the preset configuration file has been updated.

[0075] Optionally, the preset configuration file may also carry an update identifier (e.g., update timestamp, version number identifier), which may indicate whether the resource binding whitelist and / or resource configuration policy information has been updated.

[0076] In some implementations, a preset configuration file can be configured to carry an update timestamp, and the second shared memory stores the update timestamp. In specific applications, a preset monitoring service can be run to obtain the update identifier of the preset configuration file and the update identifier of the second shared memory. If the update identifiers of the two are found to be inconsistent, it can be determined that the preset configuration file has been updated.

[0077] S402. If the preset configuration file is updated, a third shared memory and a third memory identifier corresponding to the third shared memory are generated.

[0078] S403. Write the resource binding whitelist and resource configuration policy in the current preset configuration file to the third shared memory.

[0079] S404. Write the third memory identifier to the first shared memory.

[0080] Optionally, if it is determined that the preset configuration file has been updated, considering that the second shared memory may be used by a certain service, a third shared memory (map3) and a third memory identifier (key3) corresponding to the third shared memory can be generated. The latest resource binding whitelist and resource configuration policy in the current preset configuration file are written to the third shared memory, and the third memory identifier is written to the first shared memory.

[0081] Referring to the above description, if a new target service is started at this time, the preset global preloaded library can be loaded through the dynamic linker, the initialization code in the preset global preloaded library can be run, and the third shared memory can be accessed according to the first preset memory identifier corresponding to the first shared memory. The first shared memory stores the third memory identifier of the third shared memory, and the third shared memory stores the new resource binding whitelist and / or the new resource configuration policy. If the first shared memory can be successfully accessed according to the first preset memory identifier, the third memory identifier is obtained through the first shared memory. According to the third memory identifier, the third shared memory is accessed to obtain the new resource binding whitelist and / or the new resource configuration policy.

[0082] By applying the embodiments of this application, when the preset configuration file is updated, a new resource binding whitelist and / or a new resource configuration strategy can be stored in the third shared memory without affecting other services' access to the second shared memory, thereby improving the reliability of the method of this application.

[0083] Figure 5 This is a flowchart illustrating another service operation method provided in an embodiment of this application. In optional implementations, such as... Figure 5 As shown, after writing the resource binding whitelist and resource configuration policy from the current preset configuration file into the third shared memory, the process also includes: S501, Monitor whether the second shared memory is being used.

[0084] S502. If the second shared memory is not in use, release the second shared memory.

[0085] In some implementations, the usage status of the second shared memory can be monitored in real time. If the monitoring determines that the second shared memory is not in use, the second shared memory is released, that is, the second shared memory is detached.

[0086] By applying the embodiments of this application, the second shared memory can be released in a timely manner when it is not in use, thereby avoiding the risk of memory leaks and improving the utilization rate of memory resources.

[0087] In an optional implementation, the resource configuration strategy information specifically includes a resource configuration mask for at least one resource corresponding to each service identifier, the resource configuration mask being used to indicate the resource information corresponding to each service identifier.

[0088] In some implementations, a corresponding resource configuration policy can be set for each service identifier based on a resource configuration mask. Specifically, this resource configuration mask can be a binary mask, which specifies available nodes, CPU, memory, etc., for each service identifier, thereby achieving customized configuration of system resources.

[0089] For example, the resource configuration policy information for a certain service may include: NUMA node configuration mask, CPU configuration mask, and memory configuration mask. Optionally, taking the NUMA node configuration mask as an example, the NUMA node configuration mask can be 0b11110011, indicating that the NUMA nodes allowed for this service (assuming the service runs on an 8-NUMA node, 128-core machine) are Node0, Node1, Node4, Node5, Node6, and Node7, while the prohibited NUMA nodes are Node2 and Node3. Furthermore, for explanations of CPU and memory configuration masks, please refer to the NUMA node configuration mask section; it will not be repeated here.

[0090] By applying the embodiments of this application, it is possible to set corresponding resource configuration policies for each service identifier through resource configuration masks, thereby realizing customized configuration of system resources.

[0091] Figure 6 This is a functional module diagram of a service operation device provided in an embodiment of this application. The basic principle and technical effects of this device are the same as those of the corresponding method embodiments described above. For the sake of brevity, parts not mentioned in this embodiment can be referred to the corresponding content in the method embodiments. Figure 6 As shown, the service operation device 100 includes: Startup module 110 is used to start the target service and load a preset global preloaded library through the dynamic linker. The acquisition module 120 is used to run the initialization code in the preset global preloaded library to obtain the resource binding whitelist and resource configuration strategy information. The resource binding whitelist includes: the service identifier corresponding to at least one service that needs to be bound to resources, and the resource configuration strategy information includes the resource configuration strategy corresponding to each service identifier. The execution module 130 is used to bind system-level resources to the target service according to the resource binding whitelist and resource configuration policy information, and execute the target service.

[0092] In an optional implementation, the acquisition module 120 is specifically used to run the initialization code in the preset global preload library, and attempt to access the first shared memory according to the first preset memory identifier corresponding to the first shared memory. The first shared memory stores the second memory identifier of the second shared memory, and the second shared memory stores a resource binding whitelist and a resource configuration strategy. If the first shared memory can be successfully accessed according to the first preset memory identifier, then the second memory identifier is obtained through the first shared memory; Based on the second memory identifier, access the second shared memory to obtain the resource binding whitelist and resource configuration policy.

[0093] In an optional implementation, the execution module 130 is specifically used to check whether the resource binding whitelist includes the target service identifier corresponding to the target service; If included, the target resource configuration strategy corresponding to the target service identifier is obtained according to the resource configuration strategy information; According to the target resource configuration policy corresponding to the target service identifier, bind system-level resources to the target service and execute the target service.

[0094] In an optional implementation, the execution module 130 is further configured to run the target service if accessing the first shared memory fails or the target service identifier corresponding to the target service is not included in the resource binding whitelist.

[0095] In an optional implementation, the acquisition module 120 is further configured to run a preset monitoring service, acquire the resource binding whitelist and resource configuration policy in a preset configuration file, and generate a first shared memory, a second shared memory, and a second memory identifier corresponding to the second shared memory, wherein the preset configuration file includes the resource binding whitelist and the resource configuration policy information.

[0096] In an optional implementation, the acquisition module 120 is further configured to detect whether the preset configuration file has been updated; If the preset configuration file is updated, a third shared memory and a third memory identifier corresponding to the third shared memory are generated. Write the resource binding whitelist and resource configuration policy from the current preset configuration file into the third shared memory; Write the third memory identifier into the first shared memory.

[0097] In an optional implementation, the acquisition module 120 is further configured to monitor whether the second shared memory is being used; If the second shared memory is not in use, release the second shared memory.

[0098] In an optional implementation, the resource configuration strategy information specifically includes a resource configuration mask for at least one resource corresponding to each service identifier, wherein the resource configuration mask is used to indicate the resource information corresponding to each service identifier.

[0099] The above-described device is used to execute the method provided in the foregoing embodiments, and its implementation principle and technical effect are similar, so they will not be described again here.

[0100] These modules can be one or more integrated circuits configured to implement the above methods, such as one or more Application Specific Integrated Circuits (ASICs), one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs). Alternatively, when a module is implemented using processing element scheduler code, the processing element can be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. Furthermore, these modules can be integrated together as a system-on-a-chip (SOC).

[0101] Figure 7 This is a schematic diagram of an electronic device structure provided in an embodiment of this application. This electronic device can be integrated into the aforementioned service operation device. For example... Figure 7As shown, the electronic device may include a processor 210, a storage medium 220, and a bus 230. The storage medium 220 stores machine-readable instructions executable by the processor 210. When the electronic device is running, the processor 210 communicates with the storage medium 220 via the bus 230, and the processor 210 executes the machine-readable instructions to perform the steps of the above method embodiment. The specific implementation and technical effects are similar and will not be described in detail here.

[0102] Optionally, this application also provides a storage medium storing a computer program, which, when run by a processor, executes the steps of the above-described method embodiments. The specific implementation and technical effects are similar and will not be repeated here.

[0103] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.

[0104] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.

[0105] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or in a combination of hardware and software functional units.

[0106] The integrated units implemented as software functional units described above can be stored in a computer-readable storage medium. These software functional units, stored in a storage medium, include several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) or processor to execute some steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0107] It should be noted that, in this document, relational terms such as "first" and "second" are used merely to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application. It should be noted that similar reference numerals and letters in the following figures indicate similar items; therefore, once an item is defined in one figure, it does not need further definition and explanation in subsequent figures. The above description is merely a preferred embodiment of this application and is not intended to limit this application. Various modifications and variations are possible for those skilled in the art. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A service operation method, characterized in that, The method includes: Start the target service and load the preset global preloaded library through the dynamic linker; Run the initialization code in the preset global preloaded library to obtain the resource binding whitelist and resource configuration policy information. The resource binding whitelist includes the service identifier corresponding to at least one service that needs to be bound to resources. The resource configuration policy information includes the resource configuration policy corresponding to each service identifier. Based on the resource binding whitelist and resource configuration policy information, system-level resources are bound to the target service, and the target service is executed.

2. The method according to claim 1, characterized in that, The step of running the initialization code in the preset global preload library to obtain resource binding whitelist and resource configuration strategy information includes: Run the initialization code in the preset global preloaded library, and attempt to access the first shared memory according to the first preset memory identifier corresponding to the first shared memory. The first shared memory stores the second memory identifier of the second shared memory, and the second shared memory stores the resource binding whitelist and resource configuration policy. If the first shared memory can be successfully accessed according to the first preset memory identifier, then the second memory identifier is obtained through the first shared memory; Based on the second memory identifier, access the second shared memory to obtain the resource binding whitelist and resource configuration policy.

3. The method according to claim 2, characterized in that, The step of binding system-level resources to the target service based on the resource binding whitelist and resource configuration policy information, and then executing the target service, includes: Check whether the target service identifier corresponding to the target service is included in the resource binding whitelist; If included, the target resource configuration strategy corresponding to the target service identifier is obtained according to the resource configuration strategy information; According to the target resource configuration policy corresponding to the target service identifier, bind system-level resources to the target service and execute the target service.

4. The method according to claim 3, characterized in that, The method further includes: If access to the first shared memory fails or the target service identifier corresponding to the target service is not included in the resource binding whitelist, then the target service is run.

5. The method according to claim 2, characterized in that, The method further includes: Run a preset monitoring service to obtain the resource binding whitelist and resource configuration policy from the preset configuration file, and generate a first shared memory, a second shared memory, and a second memory identifier corresponding to the second shared memory. The preset configuration file includes the resource binding whitelist and resource configuration policy information.

6. The method according to claim 5, characterized in that, The method further includes: Detect whether the preset configuration file has been updated; If the preset configuration file is updated, a third shared memory and a third memory identifier corresponding to the third shared memory are generated. Write the resource binding whitelist and resource configuration policy from the current preset configuration file into the third shared memory; Write the third memory identifier into the first shared memory.

7. The method according to claim 6, characterized in that, After writing the resource binding whitelist and resource configuration policy from the current preset configuration file into the third shared memory, the method further includes: Monitor whether the second shared memory is in use; If the second shared memory is not in use, release the second shared memory.

8. The method according to any one of claims 1-7, characterized in that, The resource configuration strategy information specifically includes a resource configuration mask for at least one resource corresponding to each service identifier, and the resource configuration mask is used to indicate the resource information corresponding to each service identifier.

9. A service operation device, characterized in that, The device includes: The startup module is used to start the target service and loads the preset global preloaded libraries through the dynamic linker; The acquisition module is used to run the initialization code in the preset global preloaded library to obtain the resource binding whitelist and resource configuration policy information. The resource binding whitelist includes: the service identifier corresponding to at least one service that needs to be bound to resources, and the resource configuration policy information includes the resource configuration policy corresponding to each service identifier. The execution module is used to bind system-level resources to the target service according to the resource binding whitelist and resource configuration policy information, and then execute the target service.

10. An electronic device, characterized in that, include: The device includes a processor, a storage medium, and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, and when the electronic device is running, the processor communicates with the storage medium via the bus, and the processor executes the machine-readable instructions to perform the steps of the service operation method as described in any one of claims 1-8.

11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, performs the steps of the service operation method as described in any one of claims 1-8.

Citation Information

Patent Citations

  • Process and thread launch features

    CN108027740A

  • Resource management method, device, equipment, medium and product

    CN114116230A

  • Resource management method and device, computer equipment and storage medium

    CN116578410A

  • Application starting method and device, equipment and storage medium

    CN117290009A

  • A system and method for memory allocation and management in non-uniform memory access architecture computing environments

    US20230325239A1