1. Field of the Invention
This invention relates to the specific area of computer technology associated with the data structures useful in networking tasks. More specifically, it relates to dynamic data search structures that add large numbers of active file entries to data tables or delete such file entries from these tables.
2. Discussion of Related Art
To assist in the understanding of the present invention and related art, the following abbreviations and acronyms used herein are defined as follows:
Many commonly used networking tasks are organized by structuring various data bases (i.e. routing tables, active session state, etc.). Hash tables are often used with various mechanisms for resolving the case of multiple entries hashing to the same location (i.e. Patricia tree via chained pointers or “pattern search control blocks” (PSCBs) to the desired entry). Organization and maintenance of these data structures varies significantly according to the associated applications. In a first class, many of these data structures are static (at least when viewed over a short period of time), and are updated by a network administrator only in response to occasional network configuration changes, if at all. In a second class, routing tables may be updated based on communications with other routers in the network. There is a third class of data structures. These data structures may be characterized as dynamic, responding to normal data traffic by adding entries useful in processing subsequent traffic sharing some specific characteristics. Examples of such data structures include layer 2 MAC address tables used in bridging functions, and various session-based data structures. Since a session entry is kept only as long as a session is active, session-based structures are likely the most dynamic and, therefore, create the biggest challenge.
One specific challenge with dynamic tables is that these data structures will eventually get full. Even if there are basic procedures (i.e. detection of the end of a session) to remove obsolete entries, an occasional missing packet can cause these data bases to grow without bound, eventually overflowing available memory. A standard technique for controlling the total number of entries is to apply various aging or timer functions to active entries. These mechanisms test each active entry periodically to determine how long it has been since it was last used.
A limitation with the structure illustrated in
In some applications, it may be desirable to maintain a session entry after the session is terminated, within the limits of the storage capacity of the processing system. This may be useful in the case where a new session is established with the same parameters that were used for a previous session. In this case, session establishment may be simplified by making use of a session state previously used by the same flow. In such an implementation, it would be desirable to modify the structure of
The TCP protocol requires that hosts maintain session information for a maximum segment lifetime (MSL) for sessions that have seen a FIN packet and sent a FIN packet. The Internet Engineering Task Force (IETF) Request For Comments (RFC) 793 specifies the MSL as two minutes. This requirement is for the exceptional case in which the final ACK is lost in the network and the remote host would retransmit its FIN. Sessions in this state are said to be in the 2MSL state. This specification is not usually a problem for end systems whose number of sessions in the 2MSL state is relatively small. For load balancer devices which manage TCP sessions for many thousands of host systems at rates of 10,000s of new sessions per second, this requirement becomes significant. The storage required to store two minutes worth of “old” sessions becomes very large. Furthermore, when load balancer software is moved to Network Processors where the memory available for session tables may be limited, this requirement can become a severe limiting factor to the desired session rate (which would otherwise be obtainable with the performance capability of NPs).
It is an objective of the present invention to provide enhanced data search structures that efficiently handle large numbers of active entries with a high rate of session addition and deletion.
It is a further objective of the present invention to maximize the memory resources available for active sessions and to minimize the performance impact both from code actions and from memory bandwidth utilization.
Another objective of the subject invention is to support more precise time-out capabilities.
Yet another objective is to allocate new session entries from those in the maximum segment lifetime (MSL) state, such as 2MSL, when the free list of session entries has no entries available.
One aspect of the present invention is to include the free queue of session entries in the same timer loop used for timer control blocks assigned to active sessions, thus minimizing the overhead for insertions.
Yet another aspect is to partition the timing loop into multiple shorter loops, each with its own timer support task in order to better support different time-out values or different expected packet response times for different packet types. An additional feature is for the system to provide for new session entries even though the free queue is empty. This is achieved by maintaining a separate timer loop of “soft entries” that can be removed from the 2MSL state to make room for new session entry information. The oldest soft entry is removed from the list.
An additional aspect of this invention is the dynamic adjustment of the number of empty entries in the timer loop(s) in order to better control the accuracy of the timer process. Still further, the free queue for active sessions is organized in order of session age, enabling a cache function of terminated sessions for applications that might expect repeat sessions between the same client and server.
An additional feature is for the system to provide 2MSL state entries even though the free queue is full. This is achieved by maintaining a FIFO list of soft entries that can be removed from the 2MSL list to make room for new connection entry information into the 2MSL by removing the oldest soft entry in the FIFO list.
The invention also relates to a method for managing dynamic data search structures such as those in a search tree. The method includes providing a data search structure containing multiple data entries with at least one data entry associated with said structure. An association is established between each data entry and a corresponding timer control block. The data search structure typically comprises a direct table, and a search tree with at least one pattern search control block (PSCB) associated with each of the data entries in the direct table. At least one data entry comprising an active session is associated with at least one of said pattern search control blocks or one of the direct table entries. A first timer loop is provided to maintain active sessions and a second timer loop is provided to receive and maintain sessions that are no longer active. These sessions in the second loop are normally retained in a maximum segment lifetime (MSL) state. A free queue is provided for the first timer loop. This free queue includes available sessions for new entries in the search tree and removes obsolete sessions from the search tree. A free queue is provided for the second timer loop so that an active session can be moved from the active state to the MSL state. The method also includes the further step of providing a FIFO list of MSL entries. The oldest MSL entry is then removed to accommodate information on a connection entry for the most recently deleted session entry. A pool of spare buffers can also be provided for adjusting timer requirements in the first and the second free queues.
The invention also relates to data search structures wherein the data entries comprise active entries, and one or more soft entries that are in a maximum segment lifetime state and that are available for use for new entries. The active entries are chained together to form one timing loop, and the soft entries are chained together to form another loop. One or more available entries are used for new entries ahead of soft entries. These available entries are outside of the two loops and are chained to one another in a FIFO queue that determines their availability for use for new entries. The soft entries are chained together in a second FIFO queue and are used in that order for a new entry if the list of available entries in the queue of available entries is empty.
The invention also relates to a computer implemented medium for providing the instructions for moving obsolete sessions from an active list to a 2MSL soft entry and to maintain a FIFO list of soft entries. The instructions also enable the oldest entry on the FIFO list to be removed to make room for a new session.
As mentioned previously,
These problems are overcome with the present invention as shown in
Timer management is significantly different than in the data structures of
The system illustrated in
From the perspective of the free queue head pointer, the ordering of time-out values leads to a convenient property of the free queue. Because of this ordering, the empty entry at the head of the queue represents the least recently used (oldest) entry. This facilitates the implementation of a cache function for terminated sessions that might be applicable to a subsequent session between the same client and server. To make use of this cache function, a session termination action would leave the PSCB connected to the session entry. Then, if a subsequent session matched the session definition, routing information from the old session entry could be used to reduce the overhead of setting up the new session. Optionally, an explicitly terminated session might be recirculated with a restarted timer value in order to lengthen the time this session data will be retained. This becomes a trade-off between memory utilization and efficiency of setting up new sessions.
One particular application of this invention is now discussed. This application applies to TCP sessions in the 2MSL state. A tree similar to that shown in
When a session is moved from the active state to the 2MSL state, the first entry from the second free queue 420 (ready for the next session 432) is used. The relevant contents of the active session entry are copied to the new entry and the second free queue pointer is advanced. The old entry is removed from the PSCB chain and the new entry is added to the PSCB chain at the same spot.
The second timer loop contains entries in the order that they entered the 2MSL state. It should be noted that the normal transition of session entries is from the active state to the 2MSL state and then to the free (not assigned) state. Because of this, the free queue of the first timer loop will naturally be depleted and must be replenished from the second timer loop. An important aspect of this invention is that if no empty (not assigned) sessions are available on the second timer loop, the oldest 2MSL session can be used. For this reason, the entries in the second list are called “soft entries” because they are still part of the tree, but they are eligible for removal. The use of soft entries may prematurely shorten the 2MSL state but this is preferable to refusing the new session. In order to reuse an entry in the 2MSL state, the entry would need to be removed from the PSCB chain. The entry would then be removed from the second timer loop and inserted into the first timer loop. Note that this movement could be performed by a background task or at the time that a new session needs to be created.
Alternatively, the 2MSL list could be implemented without the enhanced data structure of
A flowchart 600 for adding a new session entry to the search tree of
A flowchart for moving a 2MSL entry from the soft list to the available list is shown in
The present invention is applicable to applications other than TCP where session entries move from a state of higher importance to a state of lesser importance. In the case of TCP, it is very important to keep sessions in the table before the 2MSL state. When sessions are in 2MSL, it is desirable to keep them in the search tree, but it is more desirable to allow new sessions.
Although the discussion has been directed to specific search structures, such as those using a direct table and pattern search control blocks, the invention is likewise useful with other search structures, such as hash tables, particularly large hash tables having serial resolution of collisions, and CAMs (content addressable memories), particularly tertiary CAMs. Likewise, any other search application with similar structures can take advantage of the unique features this invention.
In an alternate design where sessions have an infinite 2MSL time, there could be one free list which contains both the available and soft entries. In this case, a flag would need to be maintained in the entry which indicates whether the entry is connected to the search tree or not. When an entry is used from the free list, the flag must be examined to see if it needs to be removed from the search tree. After a period of time, the free list will contain only soft entries and all new sessions will result in the oldest entry being reused. This approach has the benefit of a simpler design, but the disadvantage that the tree is always “full”, possibly resulting in longer search times.
While the invention has been described in combination with specific embodiments thereof, there are many alternatives, modifications, and variations that are likewise deemed to be within the scope thereof. Accordingly, the invention is intended to embrace all such alternatives, modifications and variations as fall within the spirit and scope of the present invention as defined and limited by the appended claims.
This application is related to copending and commonly assigned patent application, U.S. Ser. No. 09/543,531, docket number RAL919990139US1, filed Apr. 6, 2000 and entitled “Full Match (FM) Search Algorithm Implementation for a Network Processor”, and patent application entitled “Data Structure Supporting Random Delete and Aging/Timer Function”, docket number RPS920020070US1, filed simultaneously herewith, the contents of which are incorporated hereinto.