Data acquisition method, server and electronic equipment
By adopting the cache mechanism and LRU/LFU algorithm adaptively update the cache in server operation and maintenance, the problem of insufficient real-time and accuracy of data acquisition is solved, and the operation and maintenance efficiency and server stability are improved.
Patent Information
- Application Number
- CN202411577293.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-06
- Publication Date
- 2025-02-25
AI Technical Summary
The real-time and accuracy of data acquisition in server operation and maintenance are poor, which leads to difficult timely processing when system failures or network interruptions, affecting the stable operation of the server.
The cache mechanism is used to store the object data on the server, and the cache is updated adaptively using LRU or LFU algorithms to ensure that the hotspot data is cached and improve the real-time and accuracy of data acquisition.
Through the caching mechanism and adaptive update algorithm, the real-time and accuracy of data acquisition are significantly improved, the operation and maintenance efficiency is improved, and the stable operation of the server is ensured.
Smart Images

Figure CN119512871A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data processing, and in particular to a data acquisition method, a server and an electronic device. Background Art
[0002] Servers are widely used in all walks of life. Almost all industries that need to store, process and share large amounts of data can use servers. For example, the Internet, finance, smart manufacturing, smart cities, etc. all require servers to store data, process business services, and calculate artificial intelligence tasks. Ensuring stable operation of servers and timely reporting of problems has become an important issue, and server operation and maintenance usually undertakes these heavy tasks.
[0003] Server operation and maintenance involves a wide range of technical fields, including server hardware, operating systems, network equipment, storage systems, virtualization technology, databases, security systems, etc. Server operation and maintenance usually requires 7x24 hours on call, because system failures or network interruptions may occur at any time. Operation and maintenance personnel need to continuously monitor the system status to ensure that all indicators are normal. In the operation and maintenance process, server data is generally obtained through queries, and each query must communicate directly with the hardware, which takes a long time. Summary of the invention
[0004] The present invention provides a data acquisition method, a server and an electronic device, which are used to improve the real-time performance and accuracy of data acquisition.
[0005] In a first aspect, an embodiment of the present invention provides a data acquisition method, which is applied to a server, and the method includes:
[0006] Obtaining the object information sent by the demand side, and determining the target object according to the object information;
[0007] Acquire target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0008] The target data is sent to the demand end.
[0009] This embodiment uses a cache mechanism to store data of objects on the service end, so that when the demand end needs to view data, the data of the object can be directly read from the cache and fed back to the demand end, thereby improving the real-time nature of data acquisition and improving operation and maintenance efficiency.
[0010] As an optional implementation, the method further includes:
[0011] The priorities of objects in the cache are updated in an LRU or LFU manner, wherein the access frequencies of objects with different priorities are in different frequency intervals.
[0012] This embodiment uses the LRU or LFU algorithm to adaptively update the cache itself, ensure that hotspot devices are always resident in the cache, and ensure the real-time and accuracy of the data in the cache.
[0013] As an optional implementation, the method further includes:
[0014] Using threads, reading data of at least one object on the server according to a preset period;
[0015] According to the read data, data of at least one object in the cache is updated.
[0016] This embodiment opens a thread, obtains data from the object on the server side through the object information cycle to update the cache, and ensures the accuracy and real-time performance of the data in the cache.
[0017] As an optional implementation manner, if the target data of the target object is not obtained from the cache, the method further includes:
[0018] Determining data features of the target data according to the object information, wherein the data features are used to represent static characteristics or dynamic characteristics of the data;
[0019] The target data is acquired from the target object or memory according to data features of the target data.
[0020] This embodiment classifies the objects on the server side into static or dynamic. Since static data is fixed, the data can be obtained from the memory. Since dynamic data is dynamically changeable, when there is no dynamic data of the target object in the cache, the dynamic data can be directly obtained from the target object to ensure the accuracy of the obtained data.
[0021] As an optional implementation manner, acquiring the target data from the target object or memory according to the data feature of the target data includes:
[0022] If the data feature of the target data is static, then obtaining the target data from the memory; or,
[0023] If the data feature of the target data is dynamic, the target data is acquired from the target object.
[0024] This embodiment classifies the data on the server side according to different data features, stores static data in memory, and stores dynamic data in cache. When there is no target data in the cache, the data can be acquired according to the method of acquiring data features, thereby improving the real-time and accuracy of acquiring different types of data.
[0025] As an optional implementation manner, the data feature of the target data is dynamic; the method further includes:
[0026] The target data of the target object is added to the cache, and the priorities of the target object and other objects except the target object are updated, and / or, the data of the target object in the cache is updated using the target data.
[0027] This embodiment classifies the data on the server side according to different data features, stores static data in memory, stores dynamic data in cache, and when there is no target data in the cache, adds the target data read from the target object to the cache and updates the cache, thereby ensuring the real-time and accuracy of the data read from the cache next time by means of cache adaptive updates.
[0028] As an optional implementation,
[0029] The server object includes physical equipment and / or software information; or
[0030] The demand side includes client side and / or server side functional modules.
[0031] The data acquisition method of this embodiment can be applied to a variety of scenarios and has better portability and versatility.
[0032] In a second aspect, an embodiment of the present invention provides a server, comprising a processor and a memory, wherein the memory is used to store a program executable by the processor, and the processor is used to read the program in the memory and perform the following steps:
[0033] Obtaining the object information sent by the demand side, and determining the target object according to the object information;
[0034] Acquire target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0035] The target data is sent to the demand end.
[0036] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising a processor and a memory, the memory being used to store a program executable by the processor, the processor being used to read the program in the memory and perform the following steps:
[0037] Obtaining the object information sent by the demand side, and determining the target object according to the object information;
[0038] Acquire target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0039] The target data is sent to the demand end.
[0040] In a fourth aspect, an embodiment of the present invention further provides a data acquisition device, the device comprising:
[0041] An object acquisition module is used to acquire object information sent by the demand side and determine the target object according to the object information;
[0042] A data acquisition module, configured to acquire target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0043] A data sending module is used to send the target data to the demand end.
[0044] In a fifth aspect, an embodiment of the present invention further provides a computer storage medium on which a computer program is stored, and when the program is executed by a processor, it is used to implement the steps of any one of the methods described in the first aspect above.
[0045] In a sixth aspect, the present application provides a computer program product, comprising: a computer program code, when the computer program code is run on a computer, the computer executes any one of the methods described in the first aspect.
[0046] These and other aspects of the present application will be more clearly understood in the description of the following embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0047] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.
[0048] Figure 1 A flowchart of a data acquisition method provided by an embodiment of the present invention;
[0049] Figure 2 A schematic diagram of a data acquisition system based on an LRU cache mechanism provided by an embodiment of the present invention;
[0050] Figure 3 A flow chart of an implementation method of a data acquisition method based on an LRU cache mechanism provided by an embodiment of the present invention;
[0051] Figure 4 A schematic diagram of an LRU cache update provided by an embodiment of the present invention;
[0052] Figure 5A flowchart for obtaining the temperature of a chassis provided by an embodiment of the present invention;
[0053] Figure 6 A schematic diagram of a server provided in an embodiment of the present invention;
[0054] Figure 7 A schematic diagram of an electronic device provided by an embodiment of the present invention;
[0055] Figure 8 A schematic diagram of a data acquisition device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0056] In order to make the purpose, technical scheme and advantages of the present invention clearer, the present invention will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, rather than all the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0057] In the embodiments of the present invention, the term "and / or" describes the association relationship of associated objects, indicating that three relationships may exist. For example, A and / or B may represent three situations: A exists alone, A and B exist at the same time, and B exists alone. The character " / " generally indicates that the associated objects before and after are in an "or" relationship.
[0058] The application scenarios described in the embodiments of the present invention are intended to more clearly illustrate the technical solutions of the embodiments of the present invention, and do not constitute a limitation on the technical solutions provided by the embodiments of the present invention. It is known to those skilled in the art that with the emergence of new application scenarios, the technical solutions provided by the embodiments of the present invention are also applicable to similar technical problems. In the description of the present invention, unless otherwise specified, "multiple" means two or more.
[0059] Before introducing the data acquisition method provided in the embodiment of the present application, in order to facilitate understanding, the technical background of the embodiment of the present application is first introduced in detail below.
[0060] Servers are widely used in all walks of life. Almost all industries that need to store, process and share large amounts of data can use servers. For example, the Internet, finance, smart manufacturing, smart cities, etc. all require servers to store data, process business services, and calculate artificial intelligence tasks. Ensuring stable operation of servers and timely reporting of problems has become an important issue, and server operation and maintenance usually undertakes these heavy tasks.
[0061] Server operation and maintenance involves a wide range of technical fields, including server hardware, operating systems, network equipment, storage systems, virtualization technology, databases, security systems, etc. Server operation and maintenance usually requires 7x24 hours on call, because system failures or network interruptions may occur at any time. Operation and maintenance personnel need to continuously monitor the system status to ensure that all indicators are normal. In the operation and maintenance process, server data is generally obtained through queries, and each query must communicate directly with the hardware, which takes a long time.
[0062] At present, when obtaining server data, the main problems are as follows:
[0063] (1) Poor real-time performance. The data of the device is obtained by querying, and each query requires direct communication with the hardware, which takes a relatively long time, resulting in poor real-time performance of the obtained data.
[0064] (2) Low accuracy. In order to further improve real-time performance, manufacturers will acquire device data in advance, such as opening up multiple threads and updating device data to shared memory in a polling manner. Each polling will be set to a fixed duration, which will improve real-time performance to a certain extent, but reduce accuracy. In addition, since there is no distinction between sensor priorities, the data of devices with high priority are more important and are read more frequently. However, the method of polling to search for all sensors will make the real-time transmission of sensor data with high priority insufficient. For example, the fan speed of the server's cooling module needs to be adjusted according to the value of the temperature sensor. Since the data of all sensors are accessed by polling, the temperature sensor data will be delayed and inaccurate.
[0065] (3) The priority of different data needs to be manually configured, which has poor universality. Due to the diversity of servers, different servers have different numbers and types of devices. Different devices in different types of servers have different priorities. Common transmission strategies require adding fields to the configuration file to distinguish the importance of devices by setting priorities separately. Different types of servers need to modify the configuration file, which is not universal.
[0066] (4) The common polling method to search all physical devices accelerates the aging of physical devices to a certain extent.
[0067] In order to solve the above technical problems, this embodiment provides a data acquisition method. The core idea is to use a cache mechanism to store the data of objects on the service end, so that when the demand end needs to view the data, the object data can be directly read from the cache and fed back to the demand end, thereby improving the real-time performance of data acquisition and improving operation and maintenance efficiency.
[0068] like Figure 1 As shown, the data acquisition method in this embodiment is applied to the server, and the specific implementation process is as follows:
[0069] Step 100: Obtain object information sent by the demand side, and determine the target object according to the object information;
[0070] In some embodiments, the demand side includes but is not limited to at least one of the functional modules of the client and the server. In implementation, the demand side can be a web (World Wide Web, Global Wide Area Network) page, ipmitool (Intelligent Platform Management Interface tool, Intelligent Platform Management Interface Tool), Postman (Interface Testing Tool), and various functional modules of the server. As long as the subject with device information needs can be used as the client in this embodiment, this embodiment does not make too many restrictions on this. For example, the client can be a Postman tool, and the demand is to obtain the data of the temperature sensor in the server chassis. In implementation, the Postman tool can be used to obtain the temperature sensor information in the server chassis and print the data on the screen. Among them, Postman is an interface testing tool. When doing interface testing, Postman is equivalent to a client. It can simulate various HTTP requests initiated by users, send request data to the server, and obtain the corresponding response results, thereby verifying whether the result data in the response matches the expected value; and ensure that developers can handle bugs in the interface in a timely manner, thereby ensuring the stability and security of the product after it goes online. Optionally, the various functional modules of the server include but are not limited to: heat dissipation module, sensor threshold alarm module and other functional modules that require algorithmic decision-making, and this embodiment does not make too many restrictions on this.
[0071] In some embodiments, the server may be a server, a cloud server, or other server devices. Optionally, the server object includes but is not limited to at least one of the server's physical devices and software information. Optionally, the server's physical devices include but are not limited to voltage sensors, current sensors, GPUs (Graphics Processing Units), power supplies, etc., and the software information includes but is not limited to software-level version information, operating system information, etc. This embodiment does not impose too many restrictions on this.
[0072] In some embodiments, the object information sent by the demand side is information after packaging, encryption and other operations. The object information includes but is not limited to the device address, device name, device identification, version information, operating system information, data characteristics (static or dynamic), etc., and this embodiment does not impose too many restrictions on this. Among them, the data characteristics are used to indicate whether the data is static or dynamic. Static data is fixed, such as FRU (Field Replaceable Unit), system model, CPU model, etc. FRU includes detailed information on replaceable hardware components such as CPU, memory, hard disk, power supply, such as model, serial number, manufacturer, etc. Dynamic data changes over time, such as temperature, voltage, link rate, etc.
[0073] Step 101: Obtain target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0074] Step 102: Send the target data to the demand end.
[0075] The cache of this embodiment stores data of one or more objects on the server side, and the cache can reduce the number of times the CPU accesses the main memory and improve the data access speed. It is located between the CPU (Central Processing Unit) and the main memory and is a temporary storage device. When there is a need to access data, the data of the object can be read directly from the cache, thereby improving the real-time performance and speed of data reading.
[0076] In some embodiments, the present embodiment may also update the cache, and the specific method of updating is as follows:
[0077] The priorities of objects in the cache are updated in an LRU (Least Recently Used) or LFU (least frequently used) manner, wherein the access frequencies of objects with different priorities are in different frequency intervals.
[0078] Among them, LRU is a memory data elimination strategy. It is commonly used when the memory is insufficient and the least recently used data needs to be eliminated. LRU is often used in the elimination strategy of cache systems. LFU is a cache algorithm used to manage computer memory, mainly used to record and track the number of times memory blocks are used. Over a period of time, the data blocks that are used the least frequently will be eliminated first to make room for new data blocks.
[0079] In the implementation, the priority of the objects in the cache is updated through the LRU or LFU method to ensure that the hot objects are always in the cache. The cache update mechanism reduces the program's access rate to useless devices, thereby reducing the CPU usage and making device control more timely and accurate.
[0080] In some embodiments, this embodiment can also update the data of the object in the cache, and the specific update method is as follows:
[0081] Using threads, data of at least one object on the server is read according to a preset period; and data of the at least one object in the cache is updated according to the read data.
[0082] During implementation, there is a thread in the server background that periodically obtains real-time data from the physical device and stores the obtained data in the cache to ensure the real-time and accuracy of the data of the objects in the cache.
[0083] In some embodiments, if the target data of the target object is not obtained from the cache, this embodiment may further perform the following steps:
[0084] According to the object information, data features of the target data are determined, wherein the data features are used to represent static characteristics or dynamic characteristics of the data; according to the data features of the target data, the target data is acquired from the target object or memory.
[0085] In implementation, after the server obtains the object information, if the target data of the target object is not obtained from the cache, the target data can also be read from the target object or memory according to whether the data characteristics of the data are static or dynamic. The target object can be a hardware device or software of the server. After the target data is not obtained from the cache, the data can be read directly from the hardware device or software, or from the memory.
[0086] In some embodiments, the target data is obtained from the target object or memory according to the data characteristics of the target data in any of the following ways:
[0087] 1) If the data feature of the target data is static, acquiring the target data from the memory;
[0088] In implementation, when the target data is static data, since the static data, such as FRU, system model, CPU model, etc., is stored in the memory, the target data can be directly read from the memory.
[0089] 2) If the data feature of the target data is dynamic, the target data is obtained from the target object.
[0090] During implementation, when the data characteristics of the target data are dynamic, the current real-time data, such as temperature, voltage, link rate, etc., can be read directly from the target object. At the same time, in order to ensure the accuracy and real-time nature of the data in the cache, the read real-time data is stored in the cache, and the priority of the target object in the cache is updated based on the LRU or LFU algorithm.
[0091] In some embodiments, when the data characteristics of the target data are dynamic, the target data of the target object is added to the cache, and the priorities of the target object and other objects except the target object are updated, and / or the data of the target object in the cache is updated using the target data.
[0092] In implementation, when the target data of the target object does not exist in the cache, the attribute information of the target object needs to be added to the cache first, and the different priorities in the cache need to be updated. The attribute information of the target object includes but is not limited to the object name, object identifier, object characteristics, and other information that represents the uniqueness or characteristics of the object, such as device name, device identifier, device characteristics, software name, software identifier, software characteristics, system name, system identifier, system characteristics, and other information. Since a new target object is added to the cache, it is necessary to reorder the priority of the newly added target object and the priority of the objects already in the cache. For example, the fan speed and temperature are stored in the cache. At this time, the demand side needs to read the power supply data, but there is no power supply data in the cache. It is necessary to read the data from the power supply and store the read data in the cache. When storing the read power supply data in the cache, since the priority of the power supply is higher than the priority of the fan temperature, the temperature data in the cache is removed and the power supply data is stored to ensure that the data of the hotspot device can always be read from the cache. In addition, when a new target object is added to the cache, since the data of the target object may be dynamic, the target data read from the target object in real time can be used to update the data of the target object in the cache to ensure the real-time and accuracy of the target data of the target object in the cache.
[0093] like Figure 2 As shown, this embodiment also provides a data acquisition system based on the LRU cache mechanism, including a demand side and a server side, wherein the demand side includes functional modules of the client and the server, and the server includes a parsing module, an object, a memory and a cache module.
[0094] During implementation, the demand side sends the object information required by any one or more of the client, heat dissipation module, sensor threshold alarm module, etc. to the parsing module, wherein the object information is the information after data processing of the attribute information of the device such as the device name, device identification, device address, and device characteristics, such as encoding, encryption, packaging, and other common data processing; the parsing module is used to parse the device information to obtain the attribute information of the device such as the device name, device identification, device address, and device characteristics, and then initiate a request message to the cache module to obtain the object data; when the cache module returns the target data of the target object, the parsing module sends the target data to the demand side; when the cache module returns null value data, it indicates that the target data of the target object is not stored in the cache, then the target data of the target object is directly read from the object or memory at this time, if the target data is read from the object, the target data can also be stored in the cache, and the priority of the object in the cache and the data of the target object are updated. The memory stores fixed data, such as FRU, CPU model, system model, etc.
[0095] The cache is used to store dynamic data of the object, such as temperature, voltage and other information. The cache module receives the request message from the parsing module and checks whether the target data of the target object is stored in the cache. If the target data of the target object is stored in the cache, the target data is directly sent to the parsing module; if the target data of the target object is not stored in the cache, null value data is sent to the parsing module. The memory is used to store static information for device initialization, such as FRU, CPU model, system model, etc. The object in this embodiment can be an actual physical device or software, including static data and dynamic data of the object.
[0096] At present, the real-time performance of data acquisition in the server operation and maintenance process is relatively poor. For example, if the server operation and maintenance personnel check the voltage and current of the server equipment power supply, if the real-time performance is poor, data leakage may occur, and the heat dissipation is not timely, which may cause the motherboard or other equipment to burn out. In order to improve the real-time performance of acquiring device data and solve the demand for the real-time performance of temperature sensors in the server hardware monitoring process, this embodiment provides a program framework based on the LRU cache mechanism, which is used to adaptively update the data of important objects with high real-time performance requirements. For example, the heat dissipation module in server monitoring needs to make decisions based on the values of various temperature sensors in the server, such as increasing or reducing the fan speed. If the real-time performance of acquiring sensor data is poor, the acquired sensor data will be inaccurate, which will eventually lead to the problem of the fan being too fast or too slow. The fan being too fast will waste electricity, and the fan being too slow will cause the server CPU to reduce the frequency or even cause equipment damage. Therefore, this embodiment updates the cached objects based on the LRU or LFU algorithm, so that the data of hotspot objects are always stored in the cache.
[0097] like Figure 3As shown, this embodiment also provides a data acquisition method based on the LRU cache mechanism, and the specific implementation process of the method is as follows:
[0098] Step 300: The demand side sends a request message to the server side, and the request message carries object information;
[0099] In the implementation, the demand side (including the functional modules of the client and the server) sends object information, wherein the client can send a request message, such as ipmitool, web page, etc., and package the object information (object identification, object characteristics, etc.) and send it to the parsing module of the server, wherein the object characteristics are used to indicate the server how to obtain the object data, such as obtaining from the memory or obtaining from the target object. The demand side can also be the monitoring module of the server, because the monitoring module also needs the data of the device to make decisions, such as the heat dissipation module needs to control the fan speed according to the data of the temperature sensor.
[0100] Step 301: The server parses the request message to obtain object information;
[0101] During implementation, after receiving the request message from the demand side, the parsing module of the server first uses the parsing module to parse the request message to obtain object information, including object characteristics, object identifiers, object names, etc., and sends a query request message to the cache module.
[0102] Step 302: The server determines the target object for which data needs to be obtained according to the object information;
[0103] In implementation, after receiving the query request message from the parsing module, the cache module checks the cache. When the cache has the target data of the target object, the target data of the target object is directly returned to the parsing module. When the cache does not have the target data of the target object, a null value is returned to the parsing module. The parsing module accesses the static data in the memory or the dynamic data in the physical device according to the characteristics (static or dynamic) of the target object to be accessed, and inserts the dynamic data into the cache.
[0104] The process of checking the cache and adaptively updating the cache in this embodiment is a general algorithm. Since the cache is based on LRU or LFU during the update process, the cache update process can store the frequently read high-priority data in the cache, ensuring that the hotspot device is resident in the cache, and can also periodically read data from the physical device and store it in the cache by adding threads to ensure the accuracy and real-time of the data in the cache. There is no need to configure the priority of different data when updating the cache, and there is no need to know the device type, device characteristics, software information, operating system information, software level and other information. The software information, time information, operating system information, temperature sensor, voltage and current sensor, and power consumption sensor data can all be placed in the cache. Through the cache adaptive update method, only the target data of the required target object needs to be read from the cache to ensure the accuracy and real-time of the read data. The cache on the server side adopts the LRU or LFU mechanism, and the data of the physical device is continuously polled and stored in the cache through the process, and the data in the cache is adaptively updated. This adaptive mechanism ensures that the external changes to the cache do not need to be perceived, and the cache can be used directly.
[0105] Step 303, determine whether the target data of the target object is stored in the cache, if yes, execute step 304, otherwise execute step 306;
[0106] Step 304: Obtain target data from the cache;
[0107] Step 305: The cache is adaptively updated;
[0108] The update of the cache includes two aspects. One aspect is the update of the objects in the cache, that is, the objects to which the data stored in the cache belongs are updated. For example, the cache originally stores the data of the temperature sensor. After the update, the cache stores the data of the power supply and removes the data of the temperature sensor. The other aspect is the update of the data in the cache, that is, the update of the data of any object in the cache. For example, when the object is a temperature sensor, the data of the temperature sensor can be read periodically, and the data of the temperature sensor stored in the cache can be periodically updated to ensure the accuracy and real-time performance of the data of the temperature sensor in the cache.
[0109] The cache update in this embodiment is updated through LRU or LFU adaptively updating the cache, and there is a thread in the background that continuously obtains the real-time data of the object from the object, so as to ensure the accuracy of the data in the cache. The data of frequently used hot objects will always be stored in the cache, which guarantees the real-time nature of the data to a certain extent. The cache update in this embodiment is based on the LRU or LFU algorithm, and the data of different objects are stored in the cache. The background continuously loops through a process and reads the data of the physical device through the device address, so as to update the data in the cache and ensure the real-time nature of the cached data. LRU is a memory data elimination strategy, and its common use is when the memory is insufficient and the least recently used data needs to be eliminated. LRU is often used as an elimination strategy for cache systems. For example Figure 4 As shown, this embodiment provides a schematic diagram of LRU cache update. When the target object to be queried is device 3, if the cache hits (that is, there is data of device 3 in the cache), the data of device 3 is sent to the parsing module, and the cache is updated, that is, the data of device 3 is placed at the beginning of the cache. When the device to be queried is device 10, and there is no data of device 10 in the cache, the last data of device 4 in the cache is deleted, and the relevant data of device 10 (including device attributes such as device name and device data) is placed at the beginning of the cache. The data of device 10 is updated in the cache when the background process is updated next time, which is convenient for the next access.
[0110] Step 306, determine whether the target data is static data, if so, execute step 307, otherwise execute step 308;
[0111] Step 307: Obtain target data from the memory;
[0112] Step 308 : directly read the target data from the target object and execute step 305 .
[0113] This embodiment adopts an adaptive update cache method to provide a more efficient data access method, which not only meets the real-time requirements of data acquisition and reduces the power consumption of the server, but also extends the service life of the server device to a certain extent, and comprehensively improves the economic benefits and environmental protection level of the server device.
[0114] like Figure 5 As shown, this embodiment provides an implementation process for obtaining the temperature of the chassis, which is specifically as follows:
[0115] Step 500: Use the Postman tool to send a request message for querying the chassis temperature sensor to the target server, where the request message carries a data packet containing temperature sensor information;
[0116] Among them, the device number of the temperature sensor, the address of the sensor, data characteristics (static or dynamic) and other related information are packaged and written into the Postman tool. Postman will send the data packet to the BMC (Baseboard Management Controller) server of the target server.
[0117] Step 501: The server parses the data packet and sends a query request message to the cache module;
[0118] Among them, after the parsing module on the server receives the data packet sent by Postman, it parses the data packet to obtain the device identification and / or device address of the device that needs to be accessed, and sends a query request message to the cache module. The query request message is used to query whether the target data of the device exists, and the query request message carries the device identification and / or device address.
[0119] Step 502, the cache module checks whether the target data exists in the cache, if so, execute step 503, otherwise execute step 505;
[0120] Step 503: The cache module sends the target data to the parsing module, and the parsing module packages the target data and sends it to Postman;
[0121] Step 504: Update cache data based on the LRU algorithm;
[0122] Step 505: the cache module sends null value data to the parsing module;
[0123] Step 506, the cache module determines whether the target data is static data, if so, execute step 507, otherwise execute step 508;
[0124] Step 507: The cache module reads the target data from the memory;
[0125] Step 508 : The cache module reads the target data from the device, stores the target data into the cache, and executes step 504 .
[0126] The data acquisition method based on the cache adaptive update mechanism provided in this embodiment can obtain device data in time and ensure the real-time performance of the data. For decision-making with high requirements for the real-time performance of device data, it can achieve the result of timely adjustment, such as heat dissipation, so as to ensure the stable and efficient operation of the server. Through the adaptive cache update algorithm, the cache data is updated in time, and the operation quality of the server is greatly improved, which has the advantages of fast, accurate, low cost, and self-adaptation. Taking the monitoring of the battery of the server as an example, if the voltage must be read every time the monitoring is performed, the voltage value is obtained very slowly due to the need to communicate with the hardware, so the real-time performance of the direct communication method is poor. In order to avoid direct communication with the hardware, the common monitoring process will open up a thread for polling to read the voltage of the button battery, put it in the shared memory, and the voltage stored in the shared memory can be directly read during monitoring. Since the access to the button battery affects the life, a fixed value such as reading once every 20 seconds is set during polling, and the polling method will result in low CPU utilization. Therefore, this embodiment optimizes the monitoring method through an adaptive cache update mechanism. By placing the need to access the button battery in the cache, the thread that maintains the cache will access the specific device, thus solving the problem of CPU waste and low CPU utilization caused by CPU polling query. Usually, the program has the principle of locality. Accessing the button battery may occur locally many times. At this time, the battery data is in the cache, so the cache data is directly sent out, which solves the problem that each monitoring needs to be monitored with the hardware and the real-time performance is poor. And through the cache method, the life of the device can be effectively protected. There is no need to mechanically poll and search for the button battery once every 20 seconds, but to adaptively obtain the device, that is, monitor when needed. Devices with high frequency of use (high priority) will adaptively reside in the cache so that high-frequency communication with the hardware can be achieved, while devices with low frequency are not in the cache and communicate with the hardware device (physical device) when used, so the CPU utilization rate can be greatly improved, power consumption is reduced, and the device is guaranteed to run efficiently and normally. This efficient access method not only meets the real-time requirements of acquiring the device and reduces power consumption, but also extends the service life of the device to a certain extent.
[0127] The data acquisition method provided in this embodiment has the following specific advantages: (1) High efficiency. By classifying the devices into hot spots with high access frequency and low access frequency, low-frequency devices are directly accessed with the physical device, while high-frequency devices are accessed by pre-loading through the cache. (2) Energy saving. The cache mechanism reduces the program's access rate to useless devices, thereby reducing the CPU usage rate, making the server fan control more timely and the rotation speed more accurate. (3) Improving the stability of the server. Through the cache mechanism, the BMC can run more efficiently and monitor the server components in a timely manner, thereby protecting the server equipment. (4) Improving economic benefits. This embodiment does not require the addition of physical devices, and improves the efficiency of the BMC program from an algorithmic perspective, thereby increasing the service life of the equipment. (5) High versatility and portability. This embodiment is adaptive and universal for various types of servers and various devices. It does not require any auxiliary methods such as manual marking and differentiation of devices, and has high versatility.
[0128] In order to reflect the degree of performance improvement of this embodiment, this embodiment provides a system performance evaluation method, which illustrates the degree of improvement of computer system performance by this embodiment based on Amdahl's law. Amdahl's law is mainly used in the calculation of system performance improvement. Amdahl's law refers to the degree of change in system performance obtained by using a faster execution method for a certain component in a computer system, which depends on the frequency of this method being used, or the proportion of the total execution time. Amdahl's law defines the speedup ratio achieved by using a specific component. Assuming that the performance of the computer will be improved by using a certain enhanced component, the ratio defined by the speedup ratio is as follows:
[0129]
[0130]
[0131] This can help us understand the effect of using the cache mechanism to improve system performance, as well as the effect of different cache strategies on the system, because different systems prefer different cache strategies.
[0132]
[0133]
[0134] For example, obtaining sensor data accounts for 60% of the entire task. Due to the added cache mechanism, the processing speed is increased by 5 times, and the processing speed of the entire system is increased to 1.923 times the original. The calculation formula is as follows:
[0135]
[0136] It can be seen from the above formula that the data acquisition method provided in this embodiment can effectively improve the processing speed of the server and the performance of data processing.
[0137] This embodiment utilizes a cache mechanism to distinguish devices in the server. This is an adaptive method that does not require any assistance such as manual marking and distinguishing of devices. The method is more efficient and has better portability and versatility. This embodiment provides updates to device data in the cache. By opening up threads, the cache is updated by continuously obtaining target data from the target object based on the object information in the cache, thereby ensuring the accuracy and real-time nature of the data in the cache. This embodiment also provides updates to the cache itself, utilizing the LRU / LFU algorithm to adaptively update the cache itself, ensuring that hotspot devices are always resident in the cache. The method provided in this embodiment has high heat dissipation efficiency, and the heat dissipation strategy adjusts the fan speed in a timely manner according to the temperature in the server, thereby ensuring stable operation of the server.
[0138] Based on the same inventive concept, an embodiment of the present invention further provides a server. Since the server is the server in the method in the embodiment of the present invention, and the principle of solving the problem by the server is similar to that of the method, the implementation of the server can refer to the implementation of the method, and the repeated parts will not be repeated.
[0139] like Figure 6 As shown, the server includes a processor 600 and a memory 601, wherein the memory 601 is used to store a program executable by the processor 600, and the processor 600 is used to read the program in the memory 601 and perform the following steps:
[0140] Obtaining the object information sent by the demand side, and determining the target object according to the object information;
[0141] Acquire target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0142] The target data is sent to the demand end.
[0143] As an optional implementation manner, the processor 600 is further configured to execute:
[0144] The priorities of objects in the cache are updated in an LRU or LFU manner, wherein the access frequencies of objects with different priorities are in different frequency intervals.
[0145] As an optional implementation manner, the processor 600 is further configured to execute:
[0146] Using threads, reading data of at least one object on the server according to a preset period;
[0147] According to the read data, data of at least one object in the cache is updated.
[0148] As an optional implementation manner, if the target data of the target object is not obtained from the cache, the processor 600 is further configured to execute:
[0149] Determining data features of the target data according to the object information, wherein the data features are used to represent static characteristics or dynamic characteristics of the data;
[0150] The target data is acquired from the target object or memory according to data features of the target data.
[0151] As an optional implementation manner, the processor 600 is specifically configured to execute:
[0152] If the data feature of the target data is static, then obtaining the target data from the memory; or,
[0153] If the data feature of the target data is dynamic, the target data is acquired from the target object.
[0154] As an optional implementation manner, the data feature of the target data is dynamic; the processor 600 is further configured to execute:
[0155] The target data of the target object is added to the cache, and the priorities of the target object and other objects except the target object are updated, and / or, the data of the target object in the cache is updated using the target data.
[0156] As an optional implementation,
[0157] The server object includes physical equipment and / or software information; or
[0158] The demand side includes client side and / or server side functional modules.
[0159] Based on the same inventive concept, an embodiment of the present invention further provides an electronic device. Since the electronic device is the electronic device in the method in the embodiment of the present invention, and the principle of solving the problem by the electronic device is similar to that of the method, the implementation of the electronic device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0160] like Figure 7 As shown, the electronic device includes a processor 700 and a memory 701, wherein the memory 701 is used to store a program executable by the processor 700, and the processor 700 is used to read the program in the memory 701 and perform the following steps:
[0161] Obtaining the object information sent by the demand side, and determining the target object according to the object information;
[0162] Acquire target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0163] The target data is sent to the demand end.
[0164] As an optional implementation manner, the processor 700 is further configured to execute:
[0165] The priorities of objects in the cache are updated in an LRU or LFU manner, wherein the access frequencies of objects with different priorities are in different frequency intervals.
[0166] As an optional implementation manner, the processor 700 is further configured to execute:
[0167] Using threads, reading data of at least one object on the server according to a preset period;
[0168] According to the read data, data of at least one object in the cache is updated.
[0169] As an optional implementation manner, if the target data of the target object is not obtained from the cache, the processor 700 is further configured to execute:
[0170] Determining data features of the target data according to the object information, wherein the data features are used to represent static characteristics or dynamic characteristics of the data;
[0171] The target data is acquired from the target object or memory according to data features of the target data.
[0172] As an optional implementation manner, the processor 700 is specifically configured to execute:
[0173] If the data feature of the target data is static, then obtaining the target data from the memory; or,
[0174] If the data feature of the target data is dynamic, the target data is acquired from the target object.
[0175] As an optional implementation manner, the data feature of the target data is dynamic; the processor 700 is further configured to execute:
[0176] The target data of the target object is added to the cache, and the priorities of the target object and other objects except the target object are updated, and / or, the data of the target object in the cache is updated using the target data.
[0177] As an optional implementation,
[0178] The server object includes physical equipment and / or software information; or
[0179] The demand side includes client side and / or server side functional modules.
[0180] Based on the same inventive concept, an embodiment of the present invention further provides a data acquisition device. Since the device is the device in the method in the embodiment of the present invention, and the principle of solving the problem by the device is similar to that of the method, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be repeated.
[0181] like Figure 8 As shown, the device comprises:
[0182] The object acquisition module 800 is used to acquire the object information sent by the demand side and determine the target object according to the object information;
[0183] The data acquisition module 801 is used to acquire the target data of the target object from a cache, wherein the cache stores data of at least one object of the server;
[0184] The data sending module 802 is used to send the target data to the demand end.
[0185] As an optional implementation, the update module is further included to:
[0186] The priorities of objects in the cache are updated in an LRU or LFU manner, wherein the access frequencies of objects with different priorities are in different frequency intervals.
[0187] As an optional implementation manner, the update module is further configured to:
[0188] Using threads, reading data of at least one object on the server according to a preset period;
[0189] According to the read data, data of at least one object in the cache is updated.
[0190] As an optional implementation manner, if the target data of the target object is not obtained from the cache, the data acquisition module 801 is further specifically used for:
[0191] Determining data features of the target data according to the object information, wherein the data features are used to represent static characteristics or dynamic characteristics of the data;
[0192] The target data is acquired from the target object or memory according to data features of the target data.
[0193] As an optional implementation, the data acquisition module 801 is specifically used for:
[0194] If the data feature of the target data is static, then obtaining the target data from the memory; or,
[0195] If the data feature of the target data is dynamic, the target data is acquired from the target object.
[0196] As an optional implementation manner, the data feature of the target data is dynamic; and the update module is further configured to:
[0197] The target data of the target object is added to the cache, and the priorities of the target object and other objects except the target object are updated, and / or, the data of the target object in the cache is updated using the target data.
[0198] As an optional implementation,
[0199] The server object includes physical equipment and / or software information; or
[0200] The demand side includes client side and / or server side functional modules.
[0201] Based on the same inventive concept, an embodiment of the present disclosure provides a computer storage medium, the computer storage medium includes: a computer program code, when the computer program code is run on a computer, the computer executes any of the data acquisition methods discussed above. Since the principle of solving the problem by the above-mentioned computer storage medium is similar to that of the data acquisition method, the implementation of the above-mentioned computer storage medium can refer to the implementation of the method, and the repeated parts will not be repeated.
[0202] In the specific implementation process, the computer storage medium may include: Universal Serial Bus Flash Drive (USB), mobile hard disk, read-only memory (ROM), random access memory (RAM), magnetic disk or optical disk, and other storage media that can store program codes.
[0203] Based on the same inventive concept, the embodiment of the present disclosure also provides a computer program product, which includes: computer program code, when the computer program code is run on a computer, the computer executes any of the data acquisition methods discussed above. Since the principle of solving the problem by the above computer program product is similar to that of the data acquisition method, the implementation of the above computer program product can refer to the implementation of the method, and the repeated parts will not be repeated.
[0204] The computer program product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination thereof. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more conductors, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0205] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) containing computer-usable program code.
[0206] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that has the functions specified in one or more boxes.
[0207] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0208] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0209] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
Claims
1. A data acquisition method, characterized in that: Applied to the server, the method includes: Obtaining the object information sent by the demand side, and determining the target object according to the object information; Acquire target data of the target object from a cache, wherein the cache stores data of at least one object of the server; The target data is sent to the demand end.
2. The method according to claim 1, characterized in that The method further includes: The priorities of objects in the cache are updated in an LRU or LFU manner, wherein the access frequencies of objects with different priorities are in different frequency intervals.
3. The method according to claim 1, characterized in that The method further includes: Using threads, reading data of at least one object on the server according to a preset period; According to the read data, data of at least one object in the cache is updated.
4. The method according to claim 1, characterized in that If the target data of the target object is not obtained from the cache, the method further includes: Determining data features of the target data according to the object information, wherein the data features are used to represent static characteristics or dynamic characteristics of the data; The target data is acquired from the target object or memory according to data features of the target data.
5. The method according to claim 4, characterized in that The acquiring the target data from the target object or memory according to the data feature of the target data includes: If the data feature of the target data is static, then obtaining the target data from the memory; or, If the data feature of the target data is dynamic, the target data is acquired from the target object.
6. The method according to claim 4, characterized in that The data feature of the target data is dynamic; The method further includes: The target data of the target object is added to the cache, and the priorities of the target object and other objects except the target object are updated, and / or, the data of the target object in the cache is updated using the target data.
7. The method according to any one of claims 1 to 6, characterized in that: The server object includes physical equipment and / or software information; or The demand side includes client side and / or server side functional modules.
8. A server, characterized in that: The method comprises a processor and a memory, wherein the memory is used to store a program executable by the processor, and the processor is used to read the program in the memory and execute the steps of any one of the methods of claims 1 to 7.
9. An electronic device, characterized in that: The electronic device comprises a processor and a memory, wherein the memory is used to store a program executable by the processor, and the processor is used to read the program in the memory and execute the steps of any one of the methods of claims 1 to 7.
10. A computer storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Data caching method and device, computer equipment and storage medium
CN110018969A
Data processing method, device and system and computer readable storage medium
CN112579282A
Data caching processing method and system, calculation equipment and readable storage medium
CN113032432A
Cited By
Data acquisition method based on active metadata
CN121743563A