CN114489943A - Data access method and device - Google Patents

Data access method and device Download PDF

Info

Publication number
CN114489943A
CN114489943A CN202210078450.7A CN202210078450A CN114489943A CN 114489943 A CN114489943 A CN 114489943A CN 202210078450 A CN202210078450 A CN 202210078450A CN 114489943 A CN114489943 A CN 114489943A
Authority
CN
China
Prior art keywords
data
target
container
duration
type
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202210078450.7A
Other languages
Chinese (zh)
Inventor
廖横
金庆瑜
王洪炼
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chongqing Aoputai Communication Technology Co ltd
Original Assignee
Chongqing Aoputai Communication Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chongqing Aoputai Communication Technology Co ltd filed Critical Chongqing Aoputai Communication Technology Co ltd
Priority to CN202210078450.7A priority Critical patent/CN114489943A/en
Publication of CN114489943A publication Critical patent/CN114489943A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • G06F2009/45583Memory management, e.g. access or allocation

Abstract

The application provides a data access method and a device, wherein the method comprises the following steps: receiving a first read request from network management equipment, wherein the first read request is used for requesting to read target data in the network equipment, at least one type of data is stored in the network equipment, the at least one type of data corresponds to at least one container one to one, each container is used for caching the corresponding type of data, each container corresponds to a refresh duration, and the effective duration of the cached data in each container is not greater than the corresponding refresh duration; determining a corresponding target container based on the type of the target data; reading target data from a target container; and sending the target data to the network management equipment. Each container is provided with a refreshing time length, and the effective time length of the cache data in each container is not more than the corresponding refreshing time length, so that the data in each container can be updated in time, and the timeliness of the data is ensured when the network management equipment acquires the data from the container.

Description

Data access method and device
Technical Field
The present application relates to the field of communications technologies, and in particular, to a data access method and apparatus.
Background
With the rapid development of the internet, more and more network devices are provided, so that the management of the network devices is very important. Simple Network Management Protocol (SNMP) defines a uniform interface and protocol for a network device, so that the network management device can manage the network device using a uniform specification.
Currently, a network management device may send an access request to a network device based on SNMP, so that the network device reads required data from a cache region and returns the data to the network management device. However, this method may not meet the requirement of some time-sensitive data, that is, for some data with a faster update speed, the data read from the buffer by the network device is not the updated data, which results in a larger error of the acquired data.
Therefore, it is desirable to provide a data access method to meet the time-sensitive requirement of data, thereby reducing errors.
Disclosure of Invention
The application provides a data access method and a data access device, which are used for meeting the timeliness requirement of data and reducing data errors.
In a first aspect, the present application provides a data access method, which may be performed by a network device, or may also be performed by a component (e.g., a chip, a system-on-a-chip, etc.) configured in the network device, and is not limited in this application.
Illustratively, the method comprises: receiving a first read request from network management equipment, wherein the first read request is used for requesting to read target data in the network equipment, at least one type of data is stored in the network equipment, the at least one type of data corresponds to at least one container one to one, each container is used for caching the corresponding type of data, each container corresponds to a refresh time length, and the effective time length of the cached data in each container is not more than the corresponding refresh time length; determining a corresponding target container based on the type of the target data; reading the target data from the target container; and sending the target data to the network management equipment.
In the technical scheme, different types of data correspond to different containers, and the refresh time length is preconfigured for each container, so that the effective time length of the data cached in the container is not more than the refresh time length, the timeliness of the data in the container is further ensured, the data acquired by the network equipment from the container meets the requirement of timeliness, and the error can be effectively reduced.
With reference to the first aspect, in a certain possible implementation manner of the first aspect, the reading the target data from the target container includes: determining whether the write-in duration of the cache data in the target container reaches a refresh duration; under the condition that the writing duration of the cache data does not reach the refreshing duration, reading the target data from the target container; or under the condition that the writing duration of the cache data reaches the refreshing duration, writing all the data of the type of the target data read from the memory of the network equipment into the target container, and reading the target data from the target container.
With reference to the first aspect, in a certain possible implementation manner of the first aspect, before determining whether a write duration of the cache data in the target container reaches a refresh duration, the method further includes: determining whether the cache data is stored in the target container; and the determining whether the write duration of the cache data in the target container reaches the refresh duration includes: and under the condition that the cache data is stored in the target container, determining whether the writing duration of the cache data reaches the refreshing duration.
With reference to the first aspect, in a certain possible implementation manner of the first aspect, after the target data is sent to the network management device, the method further includes: and under the condition that the writing duration of the cache data reaches the refreshing duration, emptying the cache data.
With reference to the first aspect, in a certain possible implementation manner of the first aspect, the method further includes: creating a thread for one or more read requests, including the first read request, the thread to read the target data from the target container.
With reference to the first aspect, in a certain possible implementation manner of the first aspect, the first read request includes an Object Identifier (OID) of the target data, where the OID includes a type identifier and a data identifier, the type identifier is used to identify a type to which the target data belongs, and in data of the same type in the network device, each data identifier corresponds to one piece of data.
With reference to the first aspect, in a certain possible implementation manner of the first aspect, the determining, based on a type to which the target data belongs, a corresponding target container includes: determining the type of the target data based on the type identification in the OID in the first read request; and determining the target container corresponding to the type based on the mapping relation between at least one type and at least one container which are prestored.
In a second aspect, the present application provides a data access apparatus comprising means for implementing the method described in the first aspect and any possible implementation manner of the first aspect.
In a third aspect, the present application provides a data access device comprising a processor. The processor is coupled to the memory and is operable to execute the computer program in the memory to implement the method of the first aspect as well as any possible implementation manner of the first aspect.
Optionally, the apparatus in the third aspect further comprises a memory.
Optionally, the apparatus of the third aspect further comprises a communication interface, the processor being coupled to the communication interface.
In a fourth aspect, the present application provides a chip system, which includes at least one processor, and is configured to support implementation of functions involved in any one of the possible implementations of the first aspect and the first aspect, for example, receiving or processing data involved in the above methods, and the like.
In one possible design, the system-on-chip further includes a memory to hold program instructions and data, the memory being located within the processor or external to the processor.
The chip system may be formed by a chip, and may also include a chip and other discrete devices.
In a fifth aspect, the present application provides a computer-readable storage medium having stored thereon a computer program (which may also be referred to as code, or instructions), which when executed by a processor, causes the method of any one of the possible implementations of the first aspect and the first aspect described above to be performed.
In a sixth aspect, the present application provides a computer program product comprising: computer program (also called code, or instructions), which when executed, causes the method in any of the possible implementations of the first aspect and the first aspect described above to be performed.
It should be understood that the second aspect to the sixth aspect of the present application correspond to the technical solutions of the first aspect of the present application, and the beneficial effects achieved by the aspects and the corresponding possible implementations are similar and will not be described again.
Drawings
FIG. 1 is a schematic diagram of a scenario suitable for use in a method provided by an embodiment of the present application;
FIG. 2 is a schematic flow chart diagram of a data access method provided by an embodiment of the present application;
FIG. 3 is a schematic diagram of a container and a thread according to an embodiment of the present disclosure;
fig. 4 is a schematic flowchart of a network device reading target data from a target container according to an embodiment of the present application;
FIG. 5 is a schematic block diagram of a data access device provided by an embodiment of the present application;
fig. 6 is a further schematic block diagram of a data access device provided in an embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
To better understand the data access method provided by the embodiments of the present application, first, the terms referred to in the present application will be briefly described.
1. SNMP: is a simple network management protocol for network device management, which belongs to application layer protocol. The SNMP can define a uniform interface and protocol for different types of equipment, equipment produced by different manufacturers and equipment of different models, so that an administrator can manage the network equipment in different physical spaces through a network, and the management efficiency of the network equipment is greatly improved.
2. Network Management System (NMS): also called a management station, may be used to take charge of issuing of network management commands, data storage and data analysis, and the NMS is the initiator of network management operations. In the present application, the NMS may be deployed on a network management device, for example, may be deployed on a server, and the server may perform management tasks on the network device. An SNMP Agent (Agent) is operated on each network device to be managed and is used for realizing the communication between the network device and the network management device. Therefore, the interaction between the network management device and the network device described below can be regarded as the interaction between the NMS and the SNMP Agent. The following describes a data access method provided by the present application from an interaction between a network management device and a network device.
3. Management Information Base (MIB): the network management equipment and the network equipment carry out interface unification through the MIB, and the MIB defines managed data in the network equipment. Network management equipment and network equipment define corresponding MIB data, so that the two parties can identify the data of the other party and realize communication. The network management equipment requests the data defined in the MIB from the network equipment, and after the network equipment identifies the data, the requested data is converted into a format defined by the MIB and is sent to the network management equipment, so that one management operation is completed. The MIB stores the corresponding relation between the data and the OID.
In this application, the OID of the data includes a type identifier and a data identifier, where the type identifier is used to identify a type to which the data belongs, the data identifier is used to identify different data in the same type of data, and each data identifier corresponds to one piece of data. For example, the data identification may be an identification generated based on a key value pair (key value) of the data.
4. Vector (vector): a sequence container (sequence container) that encapsulates dynamically sized arrays, like any other type of container, can hold objects of various types. In the embodiment of the present application, the containers described below may be, for example, vectors, each of which corresponds to one type of data.
In order to facilitate understanding of the data access method provided in the embodiment of the present application, an application scenario of the data access method provided in the embodiment of the present application will be described below. It can be understood that the application scenarios described in the embodiments of the present application are for more clearly illustrating the technical solutions in the embodiments of the present application, and do not constitute limitations on the technical solutions provided in the embodiments of the present application.
Fig. 1 is a schematic view of a scenario applicable to a method provided in an embodiment of the present application. As shown in fig. 1, the network management device 110 may communicate with network devices such as the switch 120 and the router 130 based on SNMP, so as to manage the network devices. It should be noted that the switch 120 and the router 130 both support SNMP functions. In addition, the network device mentioned in the embodiment of the present application may refer to a network device supporting an SNMP function. Illustratively, the network management device 110 may send a request to the switch 120 if it needs to obtain data from the switch 120, and the switch 120 returns the data to the network management device 110 after receiving the request, so that the network management device 110 obtains the needed data.
It should be understood that the network devices shown in fig. 1 are only examples, and the number and types of the network devices are not limited in the embodiments of the present application. For example, the network device may also include a bridge, wireless access point or hub, etc. For example, the network device may be a computer or the like supporting the SNMP function, or in other words, may be any device supporting the SNMP function. In addition, the network management device 110 may be, for example, a server that implements a management function for the network device.
At present, there is a known technology in which when a network management device needs to acquire data, a read request is sent to a network device, and accordingly, the network device receives the read request. Further, the network device queries data to be searched in the cache region, and if the data exists in the cache region, the network device sends the data to the network management device. It can be understood that for some data with higher timeliness requirement, i.e. some data updated in real time, the data in the buffer may not be the latest updated data, that is, the data obtained from the buffer by the above method is not the latest data, and therefore, the timeliness requirement of the data cannot be met.
Therefore, the application provides a data access method, different types of data correspond to different containers, a refresh time length is preconfigured for each container, the effective time length of the data cached in the container is not more than the refresh time length, and the network device reads the target data from the target container corresponding to the type of the target data and returns the target data to the network management device. The data acquired by the network management equipment meets the requirement of timeliness, and further reduces errors.
The data access method provided by the embodiment of the application will be described in detail below with reference to the accompanying drawings. It should be understood that the embodiments shown below describe the method from the perspective of a network management device interacting with a network device. It should also be understood that, although the embodiments shown below are described by taking an example of interaction between a network management device and a network device, no limitation should be made to the execution subject of the method. The method provided by the embodiment of the present application can be executed as long as it is possible to execute a program in which codes of the method provided by the embodiment of the present application are recorded. For example, the network device may be replaced with a component (e.g., a chip, a system-on-chip, etc.) configured in the network device or other functional modules capable of calling the program and executing the program. The embodiments of the present application do not limit this.
Fig. 2 is a schematic flow chart of a data access method provided in an embodiment of the present application. The data access method 200 shown in fig. 2 may include steps 210 through 240. The various steps in method 200 are described in detail below.
In step 210, the network management device sends a first read request to the network device. Accordingly, the network device receives a first read request from the network management device.
The network device stores at least one type of data, the at least one type of data corresponds to at least one container one to one, each container is used for caching the corresponding type of data, each container corresponds to a refresh duration, and the effective duration of the cached data in each container is not greater than the corresponding refresh duration. In the embodiment of the present application, there may be one or more network management devices. Each network management device may send one or more read requests. Thus, the network device may receive one or more read requests. In a case that the network device receives multiple read requests, the multiple read requests may be from different network management devices or may be from the same network management device, which is not limited in this embodiment of the present application.
Illustratively, the data stored in the network device includes routing data and device information data. The routing data may be a routing table, for example, and the device information data may be related information about the device, for example. The routing data corresponds to a container, which is marked as a first container and used for caching the routing data, and the device information data corresponds to a container, which is marked as a second container and used for caching related data of the device information. In addition, the first container and the second container respectively correspond to a refreshing time length, and the effective time length of the cache data in each container is not more than the corresponding refreshing time length. Wherein the effective duration of the buffered data is counted from the time the data is written into the container.
Optionally, the network device may create a thread for one or more read requests, including the first read request, the thread to read the target data from the target container.
The one or more read requests including the first read request are read requests from the same network management device and are read requests for the same target data, and the network device may create a thread for the one or more read requests. Thus, after receiving a first read request, the network device first determines whether to tunnel a thread for the first read request. For example, it may be determined by an Agent in the network device whether a thread has been opened for the first read request. If the network device has created a thread for a read request other than the first read request in the one or more read requests, the first read request may multiplex the thread, that is, the target data may be acquired by multiplexing the created thread. And if the network equipment does not open up the read request creating thread except the first read request in the one or more read requests, opening up a new thread for the first read request.
One possible implementation manner is that the network device may determine whether to open a thread for the first read request according to an Internet Protocol (IP) address of the packet carrying the first read request. Specifically, after receiving a message carrying a first read request, the network device determines an IP address of the message, and if a thread corresponding to the IP already exists in the multiple threads, it is not necessary to create a new thread, that is, the network device already creates threads for one or more read requests including the first read request, and the network device can acquire target data by multiplexing the created threads; and if the thread corresponding to the IP address does not exist in the plurality of threads, opening up a new thread for the first read request.
It should be understood that the network device may also create different threads for read requests from different network management devices. For example, the network management device 1 and the network management device 2 respectively send a read request 1 and a read request 2 to the network device, and then the network device may respectively create a thread 1 and a thread 2 for the read request 1 and the read request 2.
In step 220, the network device determines a corresponding target container based on the type to which the target data belongs.
It has been mentioned above that at least one type of data corresponds one-to-one to at least one container. The mapping relationship of the at least one type of data to the at least one container may be pre-stored in the network device. When receiving the first read request, the network device may determine a target container corresponding to the first read request based on the correspondence and a type to which target data to be read in the first read request belongs.
For example, the network device parses the first read request, and determines a type to which target data to be read belongs, for example, the type of the target data is device information data, and then the network device may determine a target container corresponding to the target data, where the target data is cached in the target container. In other words, the network device may read the desired target data from the target container.
Optionally, the first read request may include an OID of the target data, so as to determine a target container corresponding to the target data.
The OID includes a type identifier and a data identifier, where the type identifier is used to identify a type to which the target data belongs, and each data identifier corresponds to one piece of data in the same type of data in the network device. For example, the data identification may be an identification generated based on a key-value pair of the data.
The network device may determine a type to which the target data belongs based on the type identifier in the OID in the first read request, and determine a target container corresponding to the type based on a mapping relationship between at least one type and at least one container that are pre-stored.
Illustratively, the MIB of the network device stores a mapping relationship between the data type and the container and a corresponding relationship between the OID and the data type. After receiving the first read request, the network device determines the type of data corresponding to the type identifier from the MIB based on the type identifier in the OID carried in the first read request, and determines a target container corresponding to the target data based on a mapping relationship between a pre-stored data type and the container, so as to read the target data from the target container.
Alternatively, the first read request may be a read (get) request or a read next (getnext) request. It should be understood that the network device may also receive other types of requests from the network management device, for example, a write request, such as a configuration (set) request, from the network management device, which is not limited in this embodiment of the present application. The get request is sent to the network equipment by the network management equipment and is used for the network management equipment to extract data from the network equipment; the getnext request is sent to the network equipment by the network management equipment and is used for the network management equipment to extract the next data following the current data from the network equipment; the set request is sent to the network device by the network management device and is used for setting one or more data of the network device, so that the network management device can use the set request to remotely set the data of the network device.
Fig. 3 is a schematic diagram of a relationship between a container and a thread according to an embodiment of the present application. As shown in fig. 3, the network device receives a plurality of read requests, each read request corresponds to a thread, such as thread 1 to thread n shown in the figure, the network device includes a plurality of containers, such as container 1 to container m, data types in the plurality of read requests all correspond to container 2, that is, the network device needs to read data from container 2. Wherein n and m are both positive integers. The size of m depends on how many types of data are in the network device, one container for each type of data. It should be understood that the above multiple threads may also access different containers, for example, thread 1 accesses container 1, thread 2 and thread 3 accesses container 2, and the like, which is not limited in this embodiment of the application.
In step 230, the network device reads the target data from the target container.
After the network device determines the target container, the network device reads the target data from the target container so as to send the target data to the network management device.
One possible implementation is that the network device determines whether the write duration of the cached data in the target container reaches the refresh duration. Under the condition that the writing duration of the cache data does not reach the refreshing duration, the network equipment can directly read the target data from the target container; when the write duration of the cache data reaches the refresh duration, the network device may write all data of the type to which the target data read from the memory belongs into the target container, and read the target data from the target container. The cache data writing duration reaching the refreshing duration means that the cache data writing duration is greater than or equal to the refreshing duration, and the cache data writing duration not reaching the refreshing duration means that the cache data writing duration is less than the refreshing duration.
It should be noted that, the network device may determine whether the write-in duration of the cache data in the target container reaches the refresh duration, or the network device may determine whether the write-in duration of the cache data in the target container exceeds the refresh duration. In addition, under the condition that the writing duration of the cache data does not exceed the refreshing duration, the network equipment can directly read the target data from the target container; when the write duration of the cache data exceeds the refresh duration, the network device may write all data of the type to which the target data read from the memory belongs into the target container, and read the target data from the target container. The writing duration exceeding the refreshing duration means that the writing duration is greater than the refreshing duration, and the writing duration not exceeding the refreshing duration means that the writing duration is less than or equal to the refreshing duration.
As previously described, for each read request, there is a corresponding thread to perform the corresponding processing. In this embodiment, the step of reading the target data may be specifically realized by processing a thread corresponding to the read request.
It can be understood that the valid duration of the cache data in the target container is not greater than the refresh duration, and the data of the target container needs to be updated when the write duration of the cache data reaches the refresh duration. In addition, under the condition that the writing time of the cache data reaches the refreshing time, the network device writes all the data of the type to which the target data read from the memory of the network device belongs into the target container, so that the newly written data covers the data in the original target container, namely, the data with the writing time exceeding the effective time is refreshed.
Illustratively, all data of the type to which the target data in the memory of the network device belongs is written into the target container, so as to ensure the timeliness of the data read from the target container by the network device. For example, if the data type of the target data is the route data, the network device writes all the route data in the memory into the target container when the write duration of the cache data reaches the refresh duration, so that the network device can obtain the target data from the target container.
It should be understood that, in the above process, the network device writes all data of the type to which the target data belongs to the target container only by way of example, and the network device may also read the target data from the memory and write the target data into the target container to read the target data from the target container. The data of the type is not required to be written again when other threads read the data of the same type, and frequent writing of the data into the target container is avoided.
Optionally, before determining whether the write duration of the cached data in the target container reaches the refresh duration, the method further includes: determining whether cache data exists in the target container; correspondingly, determining whether the write-in duration of the cache data in the target container exceeds the refresh duration, specifically may include: and under the condition that the cache data are stored in the target container, determining whether the writing duration of the cache data reaches the refreshing duration.
It can be understood that the network device may further determine whether the target container stores the cache data, further determine whether the write time of the cache data reaches the refresh time if the cache data exists, and directly write all data of the type to which the target data belongs into the target container if the cache data does not exist.
In step 240, the network device sends the target data to the network management device. Accordingly, the network management device receives the target data from the network device.
After the network device reads the target data from the target container, the target data is packaged and sent to the network management device, and then the network management device obtains the target data.
Optionally, after sending the target data to the network management device, the method further includes: and the network equipment empties the cache data under the condition that the writing duration of the cache data reaches the refreshing duration.
After the network equipment sends the target data, if the write-in duration of the cache data reaches the refreshing duration, the cache data is cleared, so that the memory occupation of the target container is reduced, and the memory overhead is reduced.
One possible implementation is that the network device determines whether the write duration of the cached data reaches the refresh duration. When the writing duration reaches the refreshing duration, the network equipment empties the cache data in the target container; and under the condition that the writing duration does not reach the refreshing duration, the network equipment ends the first reading request.
In yet another possible implementation manner, the network device may further determine whether to empty the target container based on the number of the read threads and the OID corresponding to the target data. It is understood that the OID includes a type identifier and a data identifier, and the type identifier in the target container is the same, but different data can be distinguished based on the data identifier. Each piece of data corresponds to a data identification.
Illustratively, in the case that the number of the read threads is 0 and the OID of the target data is the last OID in the target container, the network device empties the cached data in the target container. The OID of the target data is the last OID in the target container, and means whether the data identifier corresponding to the target data is the last of the multiple data identifiers in the target container for the data identifier part in the OID.
Fig. 4 is an example of a network device reading target data from a target container according to an embodiment of the present application.
As shown in fig. 4, in step 410, the network device determines whether cached data exists in the target container.
After the network device determines the target container, it further determines whether cache data exists in the target container. For example, whether the target container contains the cache data is determined according to the data amount in the target container. If the data quantity in the target container is 0, the network device determines that no cache data exists in the target container, and if the data quantity in the target container is not 0, the network device determines that cache data exists in the target container.
When determining that the target container stores the cache data, the network device executes step 420 to determine whether the write-in duration of the cache data in the target container reaches the refresh duration; in the event that it is determined that cached data does not exist in the target container, step 430 is performed.
In step 420, the network device determines whether the write duration of the cached data in the target container reaches the refresh duration.
The network device executes step 430 when the write duration of the data in the target container reaches the refresh duration, and executes step 440 when the write duration of the data in the target container does not reach the refresh duration.
In step 430, the network device writes all data of the type to which the target data belongs in the target container, and updates the time at which the data is written.
It is understood that the network device may write the data before writing all data of the type to which the target data belongs to the target container, so that other threads cannot write the data at the same time. In addition, the network device releases the write lock after writing the above-mentioned write target container.
In step 440, the network device increments the read thread count by 1.
And under the condition that the target container stores cache data and the writing duration of the cache data does not reach the refreshing duration, the network equipment adds 1 to the read thread count so as to read the target data. It should be understood that the network device may also lock the data to facilitate reading the target data.
In step 450, the network device reads target data from the target container.
And the network equipment reads the target data from the target container after adding 1 to the read thread count.
In step 460, the network device sends the target data to the network management device.
And after the network equipment reads the target data, packaging the target data and sending the target data to the network management equipment. At the same time, the count of the read thread is decremented by 1.
In step 470, the network device determines whether the OID of the target data is the last OID in the target container. If yes, go to step 480 to determine whether the read thread count is 0; if not, the read request is ended.
In step 480, the network device determines whether the read thread count is 0.
If yes, the network device performs step 490 to empty the data in the target container; if not, the read request is ended. The network device may impose a write lock before emptying the data in the target container so that other threads cannot perform a write operation on the data. In addition, the network device releases the write lock after emptying the data in the target container.
It can be understood that, if the type of the request received by the network device from the network management device is a set request, the network device writes a lock, configures the data in the memory of the network device, and updates the data to the target container. In addition, the network device releases the write lock after updating the target data to the target container.
It should be noted that the method shown in fig. 4 is only exemplary, and in an actual application scenario, the network device may further include more or fewer steps to read the target data from the target container, as long as the target data is read from the target container, which is not limited in this embodiment of the application. In addition, the sequence of the steps shown in fig. 4 is only an example, and in some embodiments, the steps of the method shown in fig. 4 may have other sequences. For example, steps 470 and 480 may be permuted.
Based on the technical scheme, different types of data correspond to different containers, and the refreshing time length is preconfigured for each container, so that the effective time length of the data cached in the container is not more than the refreshing time length, the timeliness of the data in the container is further ensured, the data acquired by the network equipment from the container meets the requirement of timeliness, and the data error is further effectively reduced.
The data access device provided by the embodiment of the present application will be described in detail below with reference to fig. 5 and 6.
Fig. 5 is a schematic block diagram of a data access apparatus 500 provided in an embodiment of the present application. As shown in fig. 5, the apparatus 500 may include: a transceiving unit 510 and a processing unit 520. The units of the apparatus 500 may be used to implement the method described in any of the embodiments shown in fig. 2-4.
Exemplarily, when the apparatus 500 is used to implement the function of the network device in the method 200 shown in fig. 2, the transceiver unit 510 may be configured to receive a first read request from the network management device, where the first read request is used to request to read target data in the network device, where at least one type of data is stored in the network device, where the at least one type of data corresponds to at least one container one-to-one, each container is used to cache the corresponding type of data, and each container corresponds to one refresh duration, and an effective duration of cached data in each container is not greater than the corresponding refresh duration; the processing unit 520 may be configured to determine a corresponding target container based on a type to which the target data belongs, and read the target data from the target container; the transceiving unit 510 is further configured to send the target data to the network management device.
Optionally, the processing unit 520 is specifically configured to determine whether a write duration of the cache data in the target container reaches a refresh duration; under the condition that the writing duration of the cache data does not reach the refreshing duration, reading the target data from the target container; or under the condition that the writing duration of the cache data reaches the refreshing duration, writing all the data of the type of the target data read from the memory of the network equipment into the target container, and reading the target data from the target container.
Optionally, the processing unit 520 is further configured to determine whether the cache data is stored in the target container; and the determining whether the write duration of the cache data in the target container reaches the refresh duration includes: and under the condition that the cache data is stored in the target container, determining whether the writing duration of the cache data reaches the refreshing duration.
Optionally, the processing unit 520 is further configured to clear the cache data when the write duration of the cache data reaches the refresh duration.
Optionally, the processing unit 520 is further configured to create a thread for one or more read requests including the first read request, where the thread is configured to read the target data from the target container.
Optionally, the first read request includes an OID of the target data, where the OID includes a type identifier and a data identifier, where the type identifier is used to identify a type to which the target data belongs, and in data of the same type in the network device, each data identifier corresponds to one piece of data.
Optionally, the processing unit 520 is specifically configured to determine, based on a type identifier in the OID in the first read request, a type to which the target data belongs; determining the target container corresponding to the type based on the mapping relation between at least one type and at least one container which are prestored
It should be understood that the division of the units in the embodiments of the present application is illustrative, and is only one logical function division, and there may be other division manners in actual implementation. In addition, functional units in the embodiments of the present application may be integrated into one processor, may exist alone physically, or may be integrated into one unit from two or more units. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
Fig. 6 is a further schematic block diagram of a data access device provided in an embodiment of the present application.
As shown in fig. 6, the data access device 600 may include at least one processor 610 for implementing the method described in any of the embodiments shown in fig. 2-4.
Exemplarily, when the data access apparatus 600 is used to implement the function of the network device in the method 200 shown in fig. 2, the processor 610 may be configured to receive a first read request from the network management device, where the first read request is used to request to read target data in the network device, where at least one type of data is stored in the network device, where the at least one type of data is in one-to-one correspondence with at least one container, each container is used to cache the corresponding type of data, and each container corresponds to a refresh duration, and an effective duration of the cached data in each container is not greater than the corresponding refresh duration; determining a corresponding target container based on the type of the target data; reading the target data from the target container; and sending the target data to the network management equipment. For details, reference is made to the detailed description of the method embodiments, which is not repeated herein.
The data access device 600 may also include at least one memory 620 that may be used to store program instructions and/or monitoring information, etc. The memory 620 is coupled to the processor 610. The coupling in the embodiments of the present application is an indirect coupling or a communication connection between devices, units or modules, and may be an electrical, mechanical or other form for information interaction between the devices, units or modules. The processor 610 may operate in conjunction with the memory 620. The processor 610 may execute program instructions stored in the memory 620. At least one of the at least one memory may be included in the processor.
The data access apparatus 600 may also include a communication interface 630 for communicating with other devices over a transmission medium, such that the apparatus 600 may communicate with other devices. The communication interface 630 may be, for example, a transceiver, an interface, a bus, a circuit, or a device capable of performing a transceiving function. Processor 610 may use communication interface 630 to send and receive data and/or information and to implement the methods described in any of the embodiments shown in fig. 2-4.
The specific connection medium between the processor 610, the memory 620 and the communication interface 630 is not limited in the embodiments of the present application. In fig. 6, the processor 610, the memory 620, and the communication interface 630 are connected by a bus 640. The bus 640 is represented by a thick line in fig. 6, and the connection between other components is merely illustrative and not intended to be limiting. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 6, but this is not intended to represent only one bus or type of bus.
The present application further provides a computer program product, the computer program product comprising: a computer program (also referred to as code, or instructions), which when executed, causes a computer to perform a method as described in any one of the embodiments shown in fig. 2-4.
The present application also provides a computer-readable storage medium having stored thereon a computer program (also referred to as code, or instructions). When executed, cause a computer to perform a method as described in any one of the embodiments shown in fig. 2-4.
It should be understood that the processor in the embodiments of the present application may be an integrated circuit chip having signal processing capability. In implementation, the steps of the above method embodiments may be performed by integrated logic circuits of hardware in a processor or instructions in the form of software. The processor may be a general purpose processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components. The various methods, steps, and logic blocks disclosed in the embodiments of the present application may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present application may be directly implemented by a hardware decoding processor, or implemented by a combination of hardware and software modules in the decoding processor. The software module may be located in ram, flash memory, rom, prom, or eprom, registers, etc. storage media as is well known in the art. The storage medium is located in a memory, and a processor reads information in the memory and completes the steps of the method in combination with hardware of the processor.
It will also be appreciated that the memory in the embodiments of the subject application can be either volatile memory or nonvolatile memory, or can include both volatile and nonvolatile memory. The non-volatile memory may be a read-only memory (ROM), a Programmable ROM (PROM), an Erasable PROM (EPROM), an electrically Erasable EPROM (EEPROM), or a flash memory. Volatile memory can be Random Access Memory (RAM), which acts as external cache memory. By way of example, but not limitation, many forms of RAM are available, such as Static Random Access Memory (SRAM), Dynamic Random Access Memory (DRAM), Synchronous Dynamic Random Access Memory (SDRAM), double data rate SDRAM, enhanced SDRAM, SLDRAM, Synchronous Link DRAM (SLDRAM), and direct rambus RAM (DR RAM). It should be noted that the memory of the systems and methods described herein is intended to comprise, without being limited to, these and any other suitable types of memory.
As used in this specification, the terms "unit," "module," and the like are intended to refer to a computer-related entity, either hardware, firmware, a combination of hardware and software, or software in execution. The units and modules in the embodiment of the application have the same meaning and can be used in a crossed manner.
Those of ordinary skill in the art will appreciate that the various illustrative logical blocks and steps (step) described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application. In the several embodiments provided in the present application, it should be understood that the disclosed apparatus, device and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
In the above embodiments, the functions of the functional units may be fully or partially implemented by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions (programs). The procedures or functions described in accordance with the embodiments of the present application are generated in whole or in part when the computer program instructions (programs) are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website, computer, server, or data center to another website, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., a floppy disk, a hard disk, a magnetic tape), an optical medium (e.g., a Digital Versatile Disk (DVD)), or a semiconductor medium (e.g., a Solid State Disk (SSD)), among others.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a U disk, a removable hard disk, a ROM, a RAM, a magnetic disk, or an optical disk.
The above description is only for the specific embodiments of the present application, but the scope of the present application is not limited thereto, and any person skilled in the art can easily conceive of the changes or substitutions within the technical scope of the present application, and shall be covered by the scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.

Claims (10)

1. A method of data access, comprising:
receiving a first read request from network management equipment, wherein the first read request is used for requesting to read target data in the network equipment, at least one type of data is stored in the network equipment, the at least one type of data corresponds to at least one container one to one, each container is used for caching the corresponding type of data, each container corresponds to a refresh time length, and the effective time length of the cached data in each container is not more than the corresponding refresh time length;
determining a corresponding target container based on the type of the target data;
reading the target data from the target container;
and sending the target data to the network management equipment.
2. The method of claim 1, wherein said reading said target data from said target container comprises:
determining whether the write-in duration of the cache data in the target container reaches a refresh duration; and
under the condition that the writing duration of the cache data does not reach the refreshing duration, reading the target data from the target container; or
And under the condition that the writing duration of the cache data reaches the refreshing duration, writing all the data of the type of the target data read from the memory of the network equipment into the target container, and reading the target data from the target container.
3. The method of claim 2, wherein prior to determining whether the write duration of the cached data in the target container reaches the refresh duration, the method further comprises:
determining whether the cache data is stored in the target container; and
the determining whether the write duration of the cache data in the target container reaches the refresh duration includes:
and under the condition that the cache data is stored in the target container, determining whether the writing duration of the cache data reaches the refreshing duration.
4. The method of claim 3, wherein after sending the target data to the network management device, the method further comprises:
and under the condition that the writing duration of the cache data reaches the refreshing duration, emptying the cache data.
5. The method of claim 1, wherein the method further comprises:
creating a thread for one or more read requests, including the first read request, the thread to read the target data from the target container.
6. The method according to any one of claims 1 to 5, wherein the first read request comprises an Object Identifier (OID) of the target data, the OID comprising a type identifier and a data identifier, the type identifier being used to identify a type to which the target data belongs, and each data identifier corresponds to one piece of data in the same type of data in the network device.
7. The method of claim 6, wherein determining the corresponding target container based on the type to which the target data belongs comprises:
determining the type of the target data based on the type identification in the OID in the first read request;
and determining the target container corresponding to the type based on the mapping relation between at least one type and at least one container which are prestored.
8. A data access device comprising means for performing the method of any one of claims 1 to 7.
9. A data access apparatus comprising a processor configured to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium, comprising a computer program which, when run on a computer, causes the computer to perform the method of any one of claims 1 to 7.
CN202210078450.7A 2022-01-24 2022-01-24 Data access method and device Pending CN114489943A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210078450.7A CN114489943A (en) 2022-01-24 2022-01-24 Data access method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210078450.7A CN114489943A (en) 2022-01-24 2022-01-24 Data access method and device

Publications (1)

Publication Number Publication Date
CN114489943A true CN114489943A (en) 2022-05-13

Family

ID=81474468

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210078450.7A Pending CN114489943A (en) 2022-01-24 2022-01-24 Data access method and device

Country Status (1)

Country Link
CN (1) CN114489943A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860390A (en) * 2022-07-07 2022-08-05 中航金网(北京)电子商务有限公司 Container data management method, device, program product, medium and electronic equipment

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114860390A (en) * 2022-07-07 2022-08-05 中航金网(北京)电子商务有限公司 Container data management method, device, program product, medium and electronic equipment

Similar Documents

Publication Publication Date Title
CN113596184B (en) Hybrid cloud system, gatekeeper, network access method and storage medium
CN112578997B (en) Data migration method, system and related equipment
AU2019454205B2 (en) Method and device for IP address allocation and topology management in DAS system, and storage medium
JP6763984B2 (en) Systems and methods for managing and supporting virtual host bus adapters (vHBAs) on InfiniBand (IB), and systems and methods for supporting efficient use of buffers with a single external memory interface.
WO2018041074A1 (en) Method, apparatus, and system for accessing memory device
CN114095430B (en) Access message processing method, system and working node
US20230153264A1 (en) Data transmission method, chip, and device
US20210240353A1 (en) Resource management method and apparatus
WO2023056797A1 (en) Blockchain-based data processing method, apparatus, and device, and storage medium
CN115913937B (en) Container multi-network card network configuration method, device, equipment and storage medium
CN109564502A (en) Treating method and apparatus applied to the access request in storage equipment
CN113141405A (en) Service access method, middleware system, electronic device, and storage medium
CN114489943A (en) Data access method and device
EP3964996A1 (en) Database access method and device
US20220405229A1 (en) Pcie-based communications method and apparatus
CN111698274B (en) Data processing method and device
US20020048285A1 (en) Method and device for translating telecommunication network IP addresses by a leaky-controlled memory
US8898353B1 (en) System and method for supporting virtual host bus adaptor (VHBA) over infiniband (IB) using a single external memory interface
WO2020221033A1 (en) Method for managing remote storage device by means of management device
CN114915584A (en) Message forwarding method, device and system
US9104637B2 (en) System and method for managing host bus adaptor (HBA) over infiniband (IB) using a single external memory interface
CN112887153B (en) SNMP management system
CN113452536B (en) Atomic object management method and device
US20230401116A1 (en) Logical java card runtime environment
CN111526108B (en) Method and device for preventing network attack

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination