Software hot upgrade method and device, computer device, readable storage medium and program product
By sending the data table of the old version process to the new version process and storing it in the address space during the software hot upgrade process, and by deleting entries in the target dp flow table that were not found, the problem of hardware flow table detachment was solved, and seamless association and data consistency between software flow table and hardware flow table were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA TELECOM CLOUD TECH CO LTD
- Filing Date
- 2025-05-06
- Publication Date
- 2026-05-01
AI Technical Summary
During a software hot upgrade, the upgraded software version cannot directly inherit the flow table rules of the old version, which leads to a conflict between the hardware flow table and the new software logic. Clearing the hardware flow table will cause a brief interruption of traffic and cause the hardware flow table to become unmanaged.
During the software hot upgrade process, the data path dp flow table, dirty table, connection tracking ct table, and flow operation cache foc table of the old version process are sent to the new version process and stored in the address space. By deleting entries in the address space that do not find the target dp flow table, the number of dirty entries is obtained. Once the number is less than the preset number, the data migration is completed to ensure data consistency between the old and new processes.
It enables the reassociation of software flow tables with hardware flow tables without the hardware being aware of it, avoiding the loss of control over hardware flow tables and ensuring seamless system switching and data consistency.
Smart Images

Figure CN120540682B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of software upgrade technology, and in particular to a software hot upgrade method, apparatus, computer equipment, computer-readable storage medium, and computer program product. Background Technology
[0002] During a software hot upgrade, if the upgraded software version cannot directly inherit the flow table rules of the old version, the old rules in the hardware flow table may conflict with the new software logic. In this case, the hardware flow table needs to be cleared to avoid incorrect forwarding. However, clearing the hardware flow table will cause a brief traffic interruption, which may trigger hardware flow table management. Summary of the Invention
[0003] Therefore, it is necessary to provide a software hot-upgrade method, apparatus, computer device, computer-readable storage medium, and computer program product that can avoid hardware flow table detachment in order to address the above-mentioned technical problems.
[0004] Firstly, this application provides a software hot-upgrade method, the method comprising:
[0005] During a software hot upgrade, the data path dp flow table, dirty table, connection tracing ct table, and flow operation cache foc table of the old version process are sent to the new version process, and the data received by the new version process is stored in the address space of the new version process; among them, the dirty table includes the dirty table of the ct table and the dirty table of the foc table.
[0006] For any forc table entry in the forc table stored in the address space, delete the statistical count corresponding to the old version process in the forc table entry, and based on the index of the dp flow table recorded in the forc table entry, query the target dp flow table corresponding to the forc table entry from the dp flow table stored in the address space.
[0007] If the target dp flow table is not found, mark the corresponding table position in the dirty table stored in the address space as dirty;
[0008] Get the number of dirty entries in the dirty table stored in the address space. If the number is not less than the preset number, return the steps to send the data path dp flow table, dirty table, connection tracing ct table and flow operation cache foc table of the old version process of the software to the new version process of the software, and continue to execute until the number is less than the preset number.
[0009] In one embodiment, sending the data path dp flow table and dirty table of the old version process of the software to the new version process includes:
[0010] At the start of a software hot upgrade, a domain message channel is created between the new version process and the old version process.
[0011] The dp flow table of the old version process is sent to the new version process through the domain message channel;
[0012] Once the dp flow table has been sent, the dirty table of the old version process in the software's shared memory is copied to the address space, and the dirty table bit of the copied dirty table is cleared.
[0013] In one embodiment, sending the connection tracking table (CT) and the stream operation cache (FOC) table of the older version of the software process to the newer version of the software process includes:
[0014] Based on clearing the dirty table bit, the ct table and forc table in shared memory are mapped to the address space;
[0015] During a software hot upgrade, for any entry in any table of the CT table or FOC table in shared memory, if the entry exists in the address space, the entry in the address space is deleted, and the entry in shared memory is copied to the address space.
[0016] In one embodiment, after mapping the ct table and forc table in shared memory to the address space, the method further includes:
[0017] During a software hot upgrade, for any table position in the dirty table of the old version process, if the table position is a dirty table position and the state of the corresponding table entry of the dirty table position is a deletion state, the corresponding dp flow table stored in the address space is deleted; where the corresponding table entry is an entry in the ct table or the foc table.
[0018] In one embodiment, storing the data received by the new version process into the address space of the new version process includes:
[0019] Update the aging time of the dp flow table received by the new version process, and store the dp flow table with the updated aging time into the address space.
[0020] In one embodiment, after querying the target DP flow table corresponding to the FOC entry from the DP flow table stored in the address space, the method further includes:
[0021] If the target dp flow table is found, retrieve the corresponding statistical count of the new version process from the target dp flow table and update the corresponding statistical count of the new version process to the foc table entry.
[0022] Construct the association between the forc table entries and the target dp flow table.
[0023] Secondly, this application also provides a software hot-upgrade device, the device comprising:
[0024] The sending module is used to send the data path dp flow table, dirty table, connection tracing ct table, and flow operation cache foc table of the old version process of the software to the new version process of the software during the software hot upgrade process, and to store the data received by the new version process into the address space of the new version process; wherein, the dirty table includes the dirty table of ct table and the dirty table of foc table;
[0025] The deletion module is used to delete the statistical counts corresponding to the old version process from any forc table entry in the forc table stored in the address space, and to query the target dp flow table corresponding to the forc table entry from the dp flow table stored in the address space based on the index of the dp flow table recorded in the forc table entry.
[0026] The dirty labeling module is used to label the corresponding table position in the dirty labeling table stored in the address space as dirty if the target DP flow table is not found.
[0027] The acquisition module is used to obtain the number of dirty entries in the dirty table stored in the address space. If the number is not less than the preset number, it returns the steps of sending the data path dp flow table, dirty table, connection tracking ct table and stream operation cache foc table of the old version process of the software to the new version process of the software, and continues to execute until the number is less than the preset number.
[0028] Thirdly, this application also provides a computer device. The computer device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps of the methods in any of the above embodiments.
[0029] Fourthly, this application also provides a computer-readable storage medium. The computer-readable storage medium stores a computer program thereon, which, when executed by a processor, implements the steps of the methods in any of the above embodiments.
[0030] Fifthly, this application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the steps of the methods in any of the above embodiments.
[0031] The aforementioned software hot upgrade method, apparatus, computer equipment, computer-readable storage medium, and computer program product, during the software hot upgrade process, send the DP flow table, dirty table, CT table, and FOC table of the old version process of the software to the new version process of the software, and store the data received by the new version process in the address space of the new version process; for any FOC table entry in the FOC table stored in the address space, delete the statistical count corresponding to the old version process in the FOC table entry, and query the target DP flow table corresponding to the FOC table entry from the DP flow table stored in the address space based on the index of the DP flow table recorded in the FOC table entry; if the target DP flow table is not found, mark the table position corresponding to the FOC table entry in the dirty table stored in the address space as dirty; obtain the number of marked table positions in the dirty table stored in the address space, and if the number is not less than a preset number, return to the step of sending the data path DP flow table, dirty table, connection tracking CT table, and stream operation cache FOC table of the old version process of the software to the new version process of the software, and continue execution until the number is less than the preset number. The method provided in this application can effectively solve the problem of hardware flow table detachment during software hot upgrade, thereby enabling the re-association of software flow table and hardware flow table without the hardware's awareness. Attached Figure Description
[0032] To more clearly illustrate the technical solutions in the embodiments of this application or related technologies, the drawings used in the description of the embodiments of this application or related technologies will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0033] Figure 1 This is a flowchart illustrating a software hot upgrade method in one embodiment;
[0034] Figure 2 This is a flowchart illustrating a table sending method in one embodiment;
[0035] Figure 3 This is a flowchart illustrating the software hot upgrade method in another embodiment;
[0036] Figure 4 This is a structural block diagram of a software hot-upgrade device in one embodiment;
[0037] Figure 5 This is an internal structural diagram of a computer device in one embodiment. Detailed Implementation
[0038] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0039] In one embodiment, such as Figure 1 As shown, a software hot-upgrade method is provided. This embodiment illustrates the method applied to a terminal, but it is understood that the method can also be applied to a server, and to a system including both a terminal and a server, and is implemented through interaction between the terminal and the server. In this embodiment, the method includes the following steps:
[0040] S102. During the software hot upgrade process, the data path dp flow table, dirty table, connection tracking ct table, and flow operation cache foc table of the old version process of the software are sent to the new version process of the software, and the data received by the new version process is stored in the address space of the new version process; wherein, the dirty table includes the dirty table of the ct table and the dirty table of the foc table.
[0041] Among them, software hot upgrade refers to the technology of updating or upgrading running software without interrupting services or restarting the system; old version process refers to the process instance that was running before the hot upgrade, that is, the original process that has not yet applied new code or configuration; new version process refers to the process instance that was started after the hot upgrade, usually loaded with new code, configuration or functions; dp (datapath flow entry) is a table or data structure used to record and track the flow path of data in a system or network; ct table (conntrack entry) is a core data structure in network devices or software-defined networks, used to dynamically record and manage the state information of network connections; foc (Flow OffloadingCache) table is a high-performance caching structure used to optimize the real-time computing and query performance of streaming data; dirty table is an intermediate table that temporarily stores data to be processed, used to mark and manage the incomplete / pending correction state of data changes or computing processes.
[0042] Optionally, the software may be, but is not limited to, OpenVSwitch, an open-source virtual switch software primarily used to implement high-performance network switching functions in virtualized environments.
[0043] Optionally, before a software hot upgrade begins, the ct table, forc table, and dirty table of the old version process are mapped from the software's shared memory to large page memory.
[0044] Optionally, the old version process's CT table, FOC table, and marked dirty table are stored in the software's shared memory. The new version process will mmap the old version process's CT table, FOC table, and marked dirty table from the shared memory, and simultaneously create the new version process's CT table and FOC table. mmap (Memory Mapping) is a mechanism that directly maps file or device memory to the process's address space.
[0045] S104. For any forc table entry in the forc table stored in the address space, delete the statistical count corresponding to the old version process in the forc table entry, and based on the index of the dp flow table recorded in the forc table entry, query the target dp flow table corresponding to the forc table entry from the dp flow table stored in the address space.
[0046] Among them, the statistical count is a dynamic indicator related to file operations recorded in the foc table entry, which is usually used for performance monitoring, resource allocation or policy decision-making; the index of the dp flow table is a key value (such as an integer index or hash value) stored in the foc table entry that points to the dp flow table, and is used to quickly associate the foc table entry with its underlying data flow.
[0047] S106. If the target dp flow table is not found, mark the corresponding table position in the dirty table stored in the address space as dirty.
[0048] Optionally, if the target dp flow table is not found, marking the corresponding table position in the dirty table stored in the address space as dirty is a fault isolation and delay processing mechanism to ensure that the system can still operate safely when the metadata is inconsistent.
[0049] S108. Obtain the number of dirty entries in the dirty table stored in the address space. If the number is not less than the preset number, return to the step of sending the data path dp flow table, dirty table, connection tracking ct table and stream operation cache foc table of the old version process of the software to the new version process of the software, and continue to execute until the number is less than the preset number.
[0050] Optionally, if the number of dirty entries is not less than a preset number, the new version process sends a message to the old version process to continue synchronizing and adding DP flow tables. The old version process then synchronizes and adds DP flow tables to the new version process, and sends a DP flow table synchronization end message after synchronization is complete. If no new DP flow tables are added, the old version process sends a DP flow table synchronization end message to the new version process. After receiving the DP flow table synchronization end message, the new version process obtains the dirty entries table from the old version process and copies it to the address space of the new version process. At this point, the dirty entries table is not cleared, and the old version process's CT table and FOC table are synchronized based on the dirty entries table.
[0051] Optionally, if the number of dirty bits is less than a preset number, a last synchronization message is sent to the old version process, and the old version process closes packet receiving after receiving this message.
[0052] Optionally, after synchronization is complete, the new version process umap (unmaps) the shared memory of the old version process and destroys the domain message channel between the new version process and the old version process.
[0053] In the above software hot upgrade method, during the software hot upgrade process, the DP flow table, dirty table, CT table, and FOC table of the old version process of the software are sent to the new version process of the software, and the data received by the new version process is stored in the address space of the new version process. For any FOC table entry in the address space stored in the FOC table, the statistical count corresponding to the old version process in the FOC table entry is deleted, and based on the index of the DP flow table recorded in the FOC table entry, the target DP flow table corresponding to the FOC table entry is queried from the DP flow table stored in the address space. If the target DP flow table is not found, the table position corresponding to the FOC table entry in the dirty table stored in the address space is marked as dirty. The number of table positions marked as dirty in the dirty table stored in the address space is obtained. If the number is not less than a preset number, the step of sending the data path DP flow table, dirty table, connection tracking CT table, and stream operation cache FOC table of the old version process of the software to the new version process of the software is returned, and the process continues until the number is less than the preset number. The method provided in this application can effectively solve the problem of hardware flow table detachment during software hot upgrade, thereby enabling the re-association of software flow table and hardware flow table without the hardware's awareness.
[0054] In some embodiments, such as Figure 2 As shown, the data path dp flow table and dirty table of the old version process of the software are sent to the new version process of the software, including:
[0055] S202. At the start of a software hot upgrade, create a domain message channel between the new version process and the old version process.
[0056] S204. Send the dp flow table of the old version process to the new version process through the domain message channel.
[0057] S206. After the dp flow table is sent, copy the dirty table of the old version process from the software's shared memory to the address space, and clear the dirty table bit of the copied dirty table.
[0058] Among them, the domain message channel (Unix Domain Socket) is a mechanism for inter-process communication (IPC) on the same host, which allows different versions of processes (new and old versions) to exchange data; the dirty table bit is a binary flag in the dirty table used to mark whether a data page has been modified.
[0059] Optionally, after the dp flow table is sent, a dp flow table synchronization completion message is sent to the new version process. After receiving the synchronization completion message, the new version process copies the dirty table of the old version process from the software's shared memory to the address space of the new version process, and clears the dirty table bit of the copied dirty table. At the same time, it continues to update the old version process's foc table and ct table in shared memory and sets their dirty tables.
[0060] In this embodiment, the dp flow table of the old version process is sent to the new version process through the domain message channel. After the dp flow table is sent, the dirty table of the old version process in the shared memory of the software is copied to the address space, and the dirty table bit of the copied dirty table is cleared. This can migrate the data of the old version process to the new version process more efficiently and accurately.
[0061] In some embodiments, sending the connection tracking table (CT) and the flow operation cache (FOC) table of the old version of the software process to the new version of the software process includes: mapping the CT table and FOC table in shared memory to the address space based on clearing the dirty table bits of the dirty table; during the software hot upgrade process, for any entry of any table in the CT table or FOC table in shared memory, if the entry exists in the address space, deleting the entry in the address space and copying the entry in shared memory to the address space.
[0062] Optionally, during a software hot upgrade, the old version process may have modified the entries in the forc table or ct table while running, and the new version process may have loaded outdated or partially initialized entries when it starts. This may result in the entries of the old version process being different from the corresponding entries of the new version process. In order to ensure data consistency between the old and new processes, it is necessary to delete the entries of the new version process and migrate the entries of the old version process to the address space of the new version process.
[0063] In this embodiment, during the software hot upgrade process, for any entry in any table of the ct table or foc table in shared memory, if the entry exists in the address space, the entry in the address space is deleted, and the entry in shared memory is copied to the address space, which can achieve seamless switching between old and new processes and data consistency.
[0064] In some embodiments, after mapping the ct table and foc table in shared memory to the address space, the method further includes: during a software hot upgrade, for any table position in the dirty table of the old version process, if the table position is a dirty table position and the state of the corresponding table entry of the dirty table position is a deletion state, deleting the dp flow table corresponding to the table position stored in the address space; wherein the corresponding table entry is an entry in the ct table or the foc table.
[0065] Optionally, the old version process may have performed logical deletion on some entries, but these entries are still retained in the address space of the new version process. In this case, in order to ensure consistency between the old and new processes, it is necessary to delete the corresponding dp flow table stored in the address space of the new version process.
[0066] In this embodiment, when the table position is a dirty table position and the state of the corresponding table entry of the dirty table position is a deleted state, deleting the dp flow table corresponding to the table position stored in the address space can ensure that the new and old processes have consistent understanding of the deleted table entries, avoid the new process retaining invalid data that should be deleted, and thus ensure the consistency of the system state and the efficiency of resource reclamation.
[0067] In some embodiments, storing the data received by the new version process into the address space of the new version process includes: updating the aging duration of the dp flow table received by the new version process, and storing the dp flow table with the updated aging duration into the address space.
[0068] The aging time refers to the maximum time a flow table entry remains in the flow table after it has not been matched (i.e., no packet hit). When a flow table entry exceeds the aging time and is not used, the device will automatically delete the entry to release resources and keep the flow table fresh.
[0069] In this embodiment, by updating the aging time of the dp flow table received by the new version process, the flow table is prevented from being filled with old and useless entries, which would affect the processing efficiency of new flows.
[0070] In some embodiments, after querying the target dp flow table corresponding to the foc entry from the dp flow table stored in the address space, the method further includes: if the target dp flow table is found, obtaining the statistical count corresponding to the new version process from the target dp flow table, and updating the statistical count corresponding to the new version process to the foc entry; and constructing the association between the foc entry and the target dp flow table.
[0071] Optionally, by periodically pulling statistics from the dp flow table and updating the foc entries, it can be ensured that the foc controller has the latest network status.
[0072] In this embodiment, the statistical counts corresponding to the new version process are obtained from the target dp flow table, and the statistical counts corresponding to the new version process are updated to the foc table entry, which can achieve efficient, consistent and scalable flow table management.
[0073] In one embodiment, such as Figure 3 As shown, another method for hot software upgrades is provided, which includes the following:
[0074] 1) Openvswitch maps ct table entries, forc table entries, and dirty tables of ct and forc table entries to large pages using shared memory.
[0075] 2) After a hot upgrade begins, the new process and the old process create Unix domain message channels for the dp flow tables. The new process mmap maps the shared memory of the ct table entries, foroc table, and dirty table created by the old process. At the same time, the new process creates its own ct table and foroc table.
[0076] 3) The old process first sends the dp flow table to the new process using the dp flow table channel.
[0077] 4) After receiving the flow table, the new process installs the dp flow table locally. At the same time, it updates the aging time of the dp flow table.
[0078] 5) After the DP flow table is sent, the old process sends a DP flow table synchronization completion message to the new process. Upon receiving the message, the new process retrieves the dirty table recording the changes in FOC and CT from the old process, copies it locally, clears the corresponding dirty table bits, and then the old process continues to update FOC and CT and set the dirty table.
[0079] 6) The new process retrieves the forcible and ct tables from the shared memory created by the old process based on the dirty table copied locally, and copies them to the new process. If the entry already exists in the new process, the existing entry is deleted, and the latest entry is retrieved from the old process and copied to the new process. If the dirty table is set, and the forcible and ct entries are in the deleted state, the corresponding flow table entries that already exist in the new process are deleted.
[0080] 7) After the entries are synchronized to the new process, the counts related to the old process in the foroc entry are cleared. The dp flow table is queried based on the index recorded in the foroc entry. If the dp flow table count that updates the foroc entry is found, the dp flow table records the associated foroc entry. If the query fails, the dirty flag corresponding to the foroc entry of the old process is marked as dirty.
[0081] 8) After table entry synchronization is complete, the new process checks the number of dirty entries in the old process's table that are set. If the number of set entries is greater than the minimum synchronization threshold, the new process sends a signal to the old process to continue synchronizing the newly added DP flow table. If no new DP flow table entries are added, the old process will directly send a DP flow table synchronization end flag. The new process continues as in steps 5), 6), and 7) to synchronize CT and FOC entries based on the dirty table.
[0082] 9) If the number of newly added dirty tables is less than the minimum synchronization threshold, then send the last synchronization message to the old process.
[0083] 10) After the old process receives the last synchronization message, it closes the packet receiving function.
[0084] 11) The old process synchronously adds the dp flow table to the new process. After synchronization is complete, a dp flow table synchronization completion flag is sent.
[0085] 12) After the new process receives the dp flow table synchronization completion mark from the old process, it obtains the old process's dirty table and copies it locally. At this time, the dirty table is not cleared. The foroc and ct table entries are synchronized according to the dirty table. See 5), 6), and 7) Synchronize table entries.
[0086] 13) After synchronization, the new process umap the shared memory created by the old process. Destroy the dp flow table transmission channel.
[0087] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0088] Based on the same inventive concept, this application also provides a software hot upgrade apparatus for implementing the software hot upgrade method described above. The solution provided by this apparatus is similar to the implementation scheme described in the above method; therefore, the specific limitations in one or more software hot upgrade apparatus embodiments provided below can be found in the limitations of the software hot upgrade method described above, and will not be repeated here.
[0089] In one exemplary embodiment, such as Figure 4As shown, a software hot upgrade device 400 is provided, including: a sending module 401, a deletion module 402, a dirty marking module 403, and an acquisition module 404, wherein:
[0090] The sending module 401 is used to send the data path dp flow table, dirty table, connection tracking ct table and flow operation cache foc table of the old version process of the software to the new version process of the software during the software hot upgrade process, and to store the data received by the new version process in the address space of the new version process; wherein, the dirty table includes the dirty table of ct table and the dirty table of foc table.
[0091] The deletion module 402 is used to delete the statistical counts corresponding to the old version process in any forc table entry in the forc table stored in the address space, and to query the target dp flow table corresponding to the forc table entry from the dp flow table stored in the address space based on the index of the dp flow table recorded in the forc table entry.
[0092] The dirty labeling module 403 is used to label the table position corresponding to the foc table entry in the dirty labeling table stored in the address space as dirty when the target dp flow table is not found.
[0093] The acquisition module 404 is used to acquire the number of dirty entries in the dirty table stored in the address space. If the number is not less than a preset number, it returns the steps of sending the data path dp flow table, dirty table, connection tracking ct table and flow operation cache foc table of the old version process of the software to the new version process of the software, and continues to execute until the number is less than the preset number.
[0094] In some embodiments, the sending module 401 is further configured to create a domain message channel between the new version process and the old version process at the start of a software hot upgrade; send the dp flow table of the old version process to the new version process through the domain message channel; and, after the dp flow table is sent, copy the dirty table of the old version process from the shared memory of the software to the address space, and clear the dirty table bit of the copied dirty table.
[0095] In some embodiments, the sending module 401 is further configured to map the ct table and foc table in shared memory to the address space based on clearing the dirty table bit of the dirty table; during the software hot upgrade process, for any entry of any table in the ct table or foc table in shared memory, if the entry exists in the address space, the entry in the address space is deleted and the entry in shared memory is copied to the address space.
[0096] In some embodiments, the sending module 401 is further configured to, during the software hot upgrade process, for any table position in the dirty table of the old version process, if the table position is a dirty table position and the state of the corresponding table entry of the dirty table position is a deletion state, delete the dp flow table corresponding to the table position stored in the address space; wherein the corresponding table entry is an entry in the ct table or the foc table.
[0097] In some embodiments, the sending module 401 is further configured to update the aging duration of the dp flow table received by the new version process, and store the dp flow table with the updated aging duration into the address space.
[0098] In some embodiments, the deletion module 402 is further configured to, when the target dp flow table is found, obtain the corresponding statistical count of the new version process from the target dp flow table, and update the corresponding statistical count of the new version process to the foc table entry; and construct the association relationship between the foc table entry and the target dp flow table.
[0099] Each module in the aforementioned software hot-upgrade device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device, or stored in the memory of a computer device as software, so that the processor can call and execute the operations corresponding to each module.
[0100] In one exemplary embodiment, a computer device is provided, which may be a terminal, and its internal structure diagram may be as follows: Figure 5 As shown, the computer device includes a processor, memory, input / output interfaces, a communication interface, a display unit, and an input device. The processor, memory, and input / output interfaces are connected via a system bus, and the communication interface, display unit, and input device are also connected to the system bus via the input / output interfaces. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system and computer programs. The internal memory provides an environment for the operation of the operating system and computer programs stored in the non-volatile storage media. The input / output interfaces are used for exchanging information between the processor and external devices. The communication interface is used for wired or wireless communication with external terminals; wireless communication can be achieved through Wi-Fi, mobile cellular networks, Near Field Communication (NFC), or other technologies. When the computer program is executed by the processor, it implements a software hot-upgrade method.
[0101] Those skilled in the art will understand that Figure 5The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0102] In an exemplary embodiment, a computer device is provided, including a memory and a processor. The memory stores a computer program, and the processor executes the computer program to perform the following steps: During a software hot upgrade, the data path dp flow table, dirty table, connection trace ct table, and flow operation cache foc table of the old version of the software are sent to the new version of the software, and the data received by the new version process is stored in the address space of the new version process; wherein, the dirty table includes the dirty table of the ct table and the dirty table of the foc table; for any foc table entry stored in the address space, the entry that is related to the old version is deleted. This process performs corresponding statistical counts and, based on the index of the DP flow table recorded in the FOC table entry, queries the target DP flow table corresponding to the FOC table entry from the DP flow table stored in the address space. If the target DP flow table is not found, the table position corresponding to the FOC table entry in the dirty table stored in the address space is marked as dirty. The number of marked table positions in the dirty table stored in the address space is obtained. If the number is not less than a preset number, the process returns to the steps of sending the data path DP flow table, dirty table, connection tracing CT table, and flow operation cache FOC table of the old version of the software process to the new version of the software process, and continues to execute until the number is less than the preset number.
[0103] In one embodiment, the process of sending the data path (dp) flow table and dirty table of the old version process of the software to the new version process when the processor executes the computer program includes: at the beginning of a software hot upgrade, creating a domain message channel between the new version process and the old version process; sending the dp flow table of the old version process to the new version process through the domain message channel; and after the dp flow table is sent, copying the dirty table of the old version process from the shared memory of the software to the address space, and clearing the dirty table bit of the copied dirty table.
[0104] In one embodiment, the process of sending the connection tracking table (CT) and the flow operation cache (FOC) table of the old version of the software process to the new version of the software process when the processor executes the computer program includes: mapping the CT table and FOC table in shared memory to the address space based on clearing the dirty table bit to mark the dirty table; during the software hot upgrade process, for any entry of any table in the CT table or FOC table in shared memory, if the entry exists in the address space, deleting the entry in the address space and copying the entry in shared memory to the address space.
[0105] In one embodiment, after the processor maps the ct table and foc table in shared memory to the address space when executing the computer program, the method further includes: during a software hot upgrade, for any table position in the dirty table of the old version process, if the table position is a dirty table position and the state of the corresponding table entry of the dirty table position is a deletion state, deleting the dp flow table corresponding to the table position stored in the address space; wherein the corresponding table entry is an entry in the ct table or the foc table.
[0106] In one embodiment, the process of storing data received by a new version process into the address space of the new version process when the processor executes a computer program includes: updating the aging time of the dp flow table received by the new version process, and storing the dp flow table with the updated aging time into the address space.
[0107] In one embodiment, after the processor executes the computer program and queries the target dp flow table corresponding to the forc entry from the dp flow table stored in the address space, the process further includes: if the target dp flow table is found, obtaining the statistical count corresponding to the new version process from the target dp flow table and updating the statistical count corresponding to the new version process to the forc entry; and constructing the association between the forc entry and the target dp flow table.
[0108] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it performs the following steps: During a software hot upgrade, the data path (dp) flow table, dirty table, connection trace (ct) table, and flow operation cache (foc) table of the old version process of the software are sent to the new version process of the software, and the data received by the new version process is stored in the address space of the new version process; wherein, the dirty table includes the dirty table of the ct table and the dirty table of the foc table; for any foc table entry stored in the address space, the entry corresponding to the old version process is deleted. The process involves counting and, based on the index of the DP flow table recorded in the FOC entry, querying the target DP flow table corresponding to the FOC entry from the DP flow table stored in the address space. If the target DP flow table is not found, the corresponding table position in the dirty table stored in the address space is marked as dirty. The number of marked table positions in the dirty table stored in the address space is obtained. If the number is not less than a preset number, the process returns to the steps of sending the data path DP flow table, dirty table, connection tracking CT table, and flow operation cache FOC table of the old version process of the software to the new version process of the software, and continues execution until the number is less than the preset number.
[0109] In one embodiment, the process of sending the data path (dp) flow table and dirty table of the old version process of the software to the new version process when the computer program is executed by the processor includes: at the beginning of a software hot upgrade, creating a domain message channel between the new version process and the old version process; sending the dp flow table of the old version process to the new version process through the domain message channel; and after the dp flow table is sent, copying the dirty table of the old version process from the shared memory of the software to the address space, and clearing the dirty table bit of the copied dirty table.
[0110] In one embodiment, the process of sending the connection tracking table (CT) and the flow operation cache (FOC) table of the old version of the software process to the new version of the software process when the computer program is executed by the processor includes: mapping the CT table and FOC table in shared memory to the address space based on clearing the dirty table bit of the dirty table; during the software hot upgrade process, for any entry of any table in the CT table or FOC table in shared memory, if the entry exists in the address space, deleting the entry in the address space and copying the entry in shared memory to the address space.
[0111] In one embodiment, after the computer program is executed by the processor and maps the ct table and foc table in shared memory to the address space, the method further includes: during a software hot upgrade, for any table position in the dirty table of the old version process, if the table position is a dirty table position and the state of the corresponding table entry of the dirty table position is a deletion state, deleting the dp flow table corresponding to the table position stored in the address space; wherein the corresponding table entry is an entry in the ct table or the foc table.
[0112] In one embodiment, the process of storing data received by a new version process into the address space of the new version process when the computer program is executed by the processor includes: updating the aging time of the dp flow table received by the new version process, and storing the dp flow table with the updated aging time into the address space.
[0113] In one embodiment, after the computer program is executed by the processor and queries the target dp flow table corresponding to the forc entry from the dp flow table stored in the address space, the method further includes: if the target dp flow table is found, obtaining the statistical count corresponding to the new version process from the target dp flow table and updating the statistical count corresponding to the new version process to the forc entry; and constructing the association between the forc entry and the target dp flow table.
[0114] In one embodiment, a computer program product is provided, including a computer program that, when executed by a processor, performs the following steps: during a software hot upgrade, sending the data path (dp) flow table, dirty table, connection trace (ct) table, and flow operation cache (foc) table of the old version process of the software to the new version process of the software, and storing the data received by the new version process in the address space of the new version process; wherein, the dirty table includes the dirty table of the ct table and the dirty table of the foc table; for any foc table entry stored in the address space, deleting the statistics corresponding to the old version process in the foc table entry. Count the entries and, based on the index of the DP flow table recorded in the FOC entry, query the target DP flow table corresponding to the FOC entry from the DP flow table stored in the address space. If the target DP flow table is not found, mark the corresponding table position in the dirty table stored in the address space as dirty. Obtain the number of marked table positions in the dirty table stored in the address space. If the number is not less than a preset number, return to the steps of sending the data path DP flow table, dirty table, connection tracing ct table, and flow operation cache FOC table of the old version process of the software to the new version process of the software, and continue execution until the number is less than the preset number.
[0115] In one embodiment, the process of sending the data path (dp) flow table and dirty table of the old version process of the software to the new version process when the computer program is executed by the processor includes: at the beginning of a software hot upgrade, creating a domain message channel between the new version process and the old version process; sending the dp flow table of the old version process to the new version process through the domain message channel; and after the dp flow table is sent, copying the dirty table of the old version process from the shared memory of the software to the address space, and clearing the dirty table bit of the copied dirty table.
[0116] In one embodiment, the process of sending the connection tracking table (CT) and the flow operation cache (FOC) table of the old version of the software process to the new version of the software process when the computer program is executed by the processor includes: mapping the CT table and FOC table in shared memory to the address space based on clearing the dirty table bit of the dirty table; during the software hot upgrade process, for any entry of any table in the CT table or FOC table in shared memory, if the entry exists in the address space, deleting the entry in the address space and copying the entry in shared memory to the address space.
[0117] In one embodiment, after the computer program is executed by the processor and maps the ct table and foc table in shared memory to the address space, the method further includes: during a software hot upgrade, for any table position in the dirty table of the old version process, if the table position is a dirty table position and the state of the corresponding table entry of the dirty table position is a deletion state, deleting the dp flow table corresponding to the table position stored in the address space; wherein the corresponding table entry is an entry in the ct table or the foc table.
[0118] In one embodiment, the process of storing data received by a new version process into the address space of the new version process when the computer program is executed by the processor includes: updating the aging time of the dp flow table received by the new version process, and storing the dp flow table with the updated aging time into the address space.
[0119] In one embodiment, after the computer program is executed by the processor and queries the target dp flow table corresponding to the forc entry from the dp flow table stored in the address space, the method further includes: if the target dp flow table is found, obtaining the statistical count corresponding to the new version process from the target dp flow table and updating the statistical count corresponding to the new version process to the forc entry; and constructing the association between the forc entry and the target dp flow table.
[0120] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, data stored, data displayed, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of the relevant data must comply with relevant regulations.
[0121] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. Any references to memory, databases, or other media used in the embodiments provided in this application can include at least one of non-volatile memory and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive random access memory (ReRAM), magnetic random access memory (MRAM), ferroelectric random access memory (FRAM), phase change memory (PCM), graphene memory, etc. Volatile memory can include random access memory (RAM) or external cache memory, etc. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM). The databases involved in the embodiments provided in this application may include at least one type of relational database and non-relational database. Non-relational databases may include, but are not limited to, blockchain-based distributed databases. The processors involved in the embodiments provided in this application may be general-purpose processors, central processing units, graphics processing units, digital signal processors, programmable logic devices, quantum computing-based data processing logic devices, artificial intelligence (AI) processors, etc., and are not limited to these.
[0122] The technical features of the above embodiments can be combined in any way. For the sake of brevity, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this application.
[0123] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are specific and detailed, they should not be construed as limiting the scope of this patent application. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the protection scope of this application. Therefore, the protection scope of this application should be determined by the appended claims.
Claims
1. A software hot upgrade method, characterized in that, The method includes: During a software hot upgrade, the data path dp flow table, dirty table, connection tracking ct table, and flow operation cache foc table of the old version process of the software are sent to the new version process of the software, and the data received by the new version process is stored in the address space of the new version process; wherein, the dirty table includes the dirty table of the ct table and the dirty table of the foc table; For any one of the forc table entries stored in the address space, delete the statistical count corresponding to the old version process in the forc table entry, and based on the index of the dp flow table recorded in the forc table entry, query the target dp flow table corresponding to the forc table entry from the dp flow table stored in the address space. If the target dp flow table is not found, mark the corresponding table position in the dirty table stored in the address space as dirty; Obtain the number of dirty entries in the dirty table stored in the address space. If the number is not less than a preset number, return to the step of sending the data path dp flow table, dirty table, connection tracking ct table, and stream operation cache foc table of the old version process of the software to the new version process of the software, and continue execution until the number is less than the preset number.
2. The method according to claim 1, characterized in that, The step of sending the data path dp flow table, dirty table, connection trace ct table, and stream operation cache foc table of the old version process of the software to the new version process of the software includes: At the start of a software hot upgrade, a domain message channel is created between the new version process and the old version process; The old version process's dp flow table is sent to the new version process through the domain message channel; Once the dp flow table is sent, the dirty table of the old version process in the shared memory of the software is copied to the address space, and the dirty table bits of the dirty table of the old version process in the shared memory are cleared.
3. The method according to claim 2, characterized in that, The step of sending the data path dp flow table, dirty table, connection trace ct table, and stream operation cache foc table of the old version process of the software to the new version process of the software includes: Based on the dirty table copied to the address space, the ct table and the foc table in the shared memory are mapped to the address space; During the software hot upgrade process, for any entry in either the CT table or the FOC table in the shared memory, if the entry exists in the address space, the entry in the address space is deleted, and the entry in the shared memory is copied to the address space.
4. The method according to claim 3, characterized in that, After mapping the ct table and the foc table in the shared memory to the address space, the method further includes: During the software hot upgrade process, for any position in the dirty table of the old version process, if the position is a dirty position and the state of the corresponding entry of the dirty position is a deletion state, the corresponding dp flow table stored in the address space is deleted; wherein, the corresponding entry of the position is an entry in the ct table or the foc table.
5. The method according to claim 1, characterized in that, The step of storing the data received by the new version process into the address space of the new version process includes: The aging time of the dp flow table received by the new version process is updated, and the dp flow table with the updated aging time is stored in the address space.
6. The method according to claim 1, characterized in that, After querying the target DP flow table corresponding to the FOC entry from the DP flow table stored in the address space, the process further includes: If the target dp flow table is found, the corresponding statistical count of the new version process is obtained from the target dp flow table, and the corresponding statistical count of the new version process is updated to the foc table entry. Establish the association between the foc table entry and the target dp flow table.
7. A software hot-upgrade device, characterized in that, The device includes: The sending module is used to send the data path dp flow table, dirty table, connection tracking ct table, and flow operation cache foc table of the old version process of the software to the new version process of the software during the software hot upgrade process, and to store the data received by the new version process into the address space of the new version process; wherein, the dirty table includes the dirty table of the ct table and the dirty table of the foc table; The deletion module is used to delete the statistical count corresponding to the old version process in any one of the forc table entries stored in the address space, and to query the target dp flow table corresponding to the forc table entry from the dp flow table stored in the address space based on the index of the dp flow table recorded in the forc table entry. The dirty labeling module is used to mark the corresponding table position in the dirty labeling table stored in the address space as dirty if the target dp flow table is not found. The acquisition module is used to acquire the number of dirty entries in the dirty table stored in the address space. If the number is not less than a preset number, the module returns to the step of sending the data path dp flow table, dirty table, connection tracking ct table and flow operation cache foc table of the old version process of the software to the new version process of the software, and continues to execute until the number is less than the preset number.
8. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that, When the processor executes the computer program, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
10. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Multi-core SDN switch flow table management method and system based on batch updating
CN112260948A
Microcode upgrade method and apparatus
WO2021004265A1