CN101770485A - Method and device for adding table items, and method, device and system for processing table items - Google Patents

Method and device for adding table items, and method, device and system for processing table items Download PDF

Info

Publication number
CN101770485A
CN101770485A CN200810247426A CN200810247426A CN101770485A CN 101770485 A CN101770485 A CN 101770485A CN 200810247426 A CN200810247426 A CN 200810247426A CN 200810247426 A CN200810247426 A CN 200810247426A CN 101770485 A CN101770485 A CN 101770485A
Authority
CN
China
Prior art keywords
key word
list item
ram
tcam
bucket
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
CN200810247426A
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.)
Huawei Technologies Co Ltd
Original Assignee
Huawei Technologies 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 Huawei Technologies Co Ltd filed Critical Huawei Technologies Co Ltd
Priority to CN200810247426A priority Critical patent/CN101770485A/en
Publication of CN101770485A publication Critical patent/CN101770485A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention relates to a method and a device for adding table items, and a method, a device and a system for processing the table items, wherein the method for adding the table items comprises the following steps of: receiving a table item adding request, wherein the table item adding request carries a first keyword and an index of one table item requesting to be added; and querying whether a barrel corresponding to the first keyword in a random access memory (RAM) is full or not, if so, adding the first keyword and the index in a ternary content addressable memory (TCAM). The method for adding the table item is used for adding the table item generating conflicts because the barrel in the RAM is full in the TCAM so as to ensure that all table items can be added successfully; the capacity of the RAM does not need to be increased so that the RAM resource is saved and the storable table item capacity is extended under the condition that the RAM resource is constant.

Description

List item adding method and device and list item disposal route, Apparatus and system
Technical field
The embodiment of the invention relates to communication technical field, particularly a kind of list item adding method and device and list item disposal route, Apparatus and system.
Background technology
Hash (Hash) computing is the core algorithm of exact-match lookup.Hash operation is to use specific hash function to deposit the content of a certain key word in the particular address storage means, is widely used in exact-match lookup.When the user adds a certain list item in storer, by function f (Key)=h the key word Key of this information is carried out Hash operation, wherein f () is specific hash function, Key is the key word that needs storage item, h is the Hash address that needs the list item of storage, h the position (slot) in this corresponding stored space, address all deposits this Key value and the corresponding information of this Key value in this Hash address h.When searching, the Key value is carried out Hash operation obtain the information that corresponding Hash address h just can obtain to be needed.But during the information of interpolation, if two Key values are carried out Hash operation obtains same Hash address value, for example: f (Key1)=f (Key2)=M, then two information may need to deposit among the same Hash address M, therefore may produce hash-collision.
Prior art solves the method for hash-collision by software, for example: the storage of linked list method, be after the process Hash operation when adding list item, conflict list item deposited in the chained list, if then can deposit the list item of conflict in the next room in this chained list, when searching list item, find the chained list of this list item correspondence by Hash operation, travel through chained list then, obtain lookup result then.The speed of this method traversal chained list has determined searching speed.Prior art is by the method for hardware solution hash-collision, for example: when adding list item, will deposit hardware random access memory (RandomAccess Memory through the list item that conflicts after the Hash calculation in; Hereinafter to be referred as: bucket (being similar to the chained list in the software) RAM), when searching list item, read the list item (being similar to the traversal chained list) in the bucket of the cryptographic hash correspondence that Hash operation obtains, the list item that will search is compared one by one with the list item of reading then, obtain lookup result, this method reads the efficient that the speed of list item in the bucket of RAM has determined to search computing, and list item is many more in the bucket of RAM, and the speed that reads is slow more.Fig. 1 is the storage mode of list item in RAM through Hash operation, and as shown in Figure 1, Barrel represents bucket, and Key represents list item, and Index represents the index of Key correspondence; The list item that is numbered y in Key x (y) expression is numbered in the bucket of x.RAM is divided into different bucket (being similar to the chained list in the software) according to the cryptographic hash of searching list item.At first RAM is divided into several buckets, for example m barrel, fixing address of each barrel correspondence.Determine the list item number that each barrel can be stored, for example n according to the capacity of bucket and the length of list item.When adding list item, adopt hash function that the Key that issues interpolation is carried out Hash operation and obtain a bucket address, find corresponding bucket, again list item is write position idle in this barrel according to this barrel address; When searching list item, adopt the same hash function when adding list item to carry out obtaining a barrel address after the Hash operation to issuing the Key that searches, find corresponding bucket according to the bucket address, all list items in the bucket are read, with the list item read with issue the Key that searches and compare one by one, if the list item identical with Key arranged, then the index (Index) in the bucket of this Key correspondence is returned, think to search and hit; If the list item identical with Key then do not thought and do not mated list item, return search miss.Wherein hash algorithm has a variety ofly, and only general reference is wherein a certain here, specifically adopts which kind of algorithm also to need to select according to specific design.
Because the finiteness of RAM resource, under the fixing situation of the number m of bucket, the degree of depth of bucket is that the number n of list item in each barrel also has the corresponding upper limit, and promptly n value can not be infinitely great or enough big, when existence is barrel full.Hash algorithm is not a perfect algorithm, it is abstract to the function of few mapping relations more than one, the Hash address value that is a plurality of different list items may be identical, need to store in the same bucket after may having n list item process Hash operation greater than ladle capacity, if this bucket is full, toward the interior list item that adds of this bucket conflict will appear again.This conflict all has relation with hash algorithm, the size of RAM resource and the distribution of list item structure adopted.Prior art adopts RAM to store under the situation that hash algorithm and list item structure are determined, can be by increasing the probability that the dark RAM of the being resource of bucket reduces to clash, but the generation that can not avoid conflict fully, thus limited the capacity of the list item among the RAM.
In realizing process of the present invention, the inventor finds that there are the following problems at least in the prior art:
Because because of the full probability correlation that clashes of bucket, the RAM bucket is dark big more among RAM resource and the RAM, the list item that can store in each barrel is many more, and the probability that clashes is just more little, but the RAM resource of the dark big more needs of RAM bucket is just big more.Therefore, if adopt the method that increases the RAM resource to reduce collision probability, can waste storage space, increase cost and reduce seek rate.
Summary of the invention
The embodiment of the invention provides a kind of list item adding method and device and list item disposal route, Apparatus and system, when successfully adding, searching list item, saves the RAM storage space, reduces cost, and improves seek rate.
The embodiment of the invention provides a kind of list item adding method, comprising:
Receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Whether full, if full, described first key word and index are added into three-state content addressing memory TCAM if inquiring about this first key word bucket of correspondence in random access memory ram.
The embodiment of the invention provides a kind of list item disposal route again, comprising:
Receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Whether full, if full, described first key word and index are added into three-state content addressing memory TCAM if inquiring about this first key word bucket of correspondence in random access memory ram;
Receive the list item search request, described first key word that the request of carrying in the described list item search request is searched;
Search the list item of the described first key word correspondence, return the index of the list item corresponding with described first key word.
The embodiment of the invention provides a kind of list item adding set, comprising:
First receiver module is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Adding module, whether at random access memory ram corresponding bucket full, if full, then described first key word and index are added into three-state content addressing memory TCAM if being used for inquiring about this first key word.
The embodiment of the invention provides a kind of list item treating apparatus again, comprising:
First receiver module is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Adding module, whether at random access memory ram corresponding bucket full, if full, described first key word and index are added into three-state content addressing memory TCAM if being used for inquiring about this first key word;
Second receiver module is used to receive the list item search request, described first key word that the request of carrying in the described list item search request is searched;
Return module, be used to search the list item of the described first key word correspondence, return the index of the list item corresponding with described first key word.
The embodiment of the invention also provides a kind of list item disposal system, comprising:
Algorithm engine, random access memory ram and three-state content addressing memory TCAM;
Described algorithm engine is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added; Whether full, if full, described first key word and index are added into described TCAM if inquiring about this first key word bucket of correspondence in described RAM.
The embodiment of the invention provides a kind of list item adding method and device and list item disposal route, Apparatus and system, with among the RAM because of the full list item that clashes of bucket adds into TCAM, avoided the conflict of list item, guarantee that all list items can both add success; Therefore need not to increase the RAM capacity, saved the RAM resource, and under the fixing situation of RAM resource, the list item capacity of having expanded that can store.
Description of drawings
Fig. 1 is the storage mode of list item in RAM through Hash operation;
Fig. 2 is the structural representation of the system that sends instructions under the present invention;
Fig. 3 is the process flow diagram of list item adding method embodiment of the present invention;
Fig. 4 is the process flow diagram of list item disposal route first embodiment of the present invention;
Fig. 5 is the process flow diagram of list item disposal route second embodiment of the present invention;
Fig. 6 is the synoptic diagram of list item adding set embodiment of the present invention;
Fig. 7 is the synoptic diagram of list item treating apparatus embodiment of the present invention;
Fig. 8 is the synoptic diagram of list item disposal system embodiment of the present invention.
Embodiment
Below by drawings and Examples, technical scheme of the present invention is described in further detail.
According to the capacity (M) of RAM resource space, the occupation space amount (N) of every list item can calculate the list item capacity (S) of RAM, and computing formula is S=M/N, then S is rounded or rounds up.Wherein the implication that S is rounded up is: the surplus capacity that goes out of M/N is tried one's best mean allocation in the space of list item correspondence, make S remain integer, for example: when M be 128 and N when being 60 S be 2, then remaining 8 on average can be assigned in 2 list items, every list item corresponding space in RAM is the N+4=64 position, 60 storage item, 4 is empty.Owing in RAM, can't search fast, must list item be mapped to different buckets (storage space of appointment among the RAM) by Hash operation, thereby dwindle seek scope and search speed with raising, so just have number and the identical situation of cryptographic hash occurs greater than a plurality of list items of single ladle capacity, because the bucket internal memory that the identical meeting of cryptographic hash causes the cryptographic hash correspondence is the following situation of all list items, Here it is hash-collision.According to adopted the bucket the degree of depth (d) promptly the bucket capacity, barrel number (m), the structure of list item and the collision probability (η) of the list item that hash algorithm can calculate, make η be lower than the design acceptable upper limit, thereby the relation of determining m and d there is sufficient relatively space to store to guarantee the list item with identical cryptographic hash.The computing formula of the number (m) of bucket: m=S/d, result of calculation m rounds.Yet because conflict still exists, can not guarantee that all list items can both store in the bucket, wherein Tong capacity is represented the number of the list item that can store in the bucket, barrel number represent can to hold among the RAM barrel number.
The embodiment of the invention adopts three-state content addressing memory (Ternary Content AddressableMemory; Hereinafter to be referred as: TCAM) store the list item that can not create because bucket completely clashes among these RAM, be used to compensate the RAM resource.Fig. 2 is the structural representation of the system that sends instructions under the present invention, as shown in Figure 2, the following of forwarding engine 1 sends instructions through algorithm engine 2 parsings, to build table instruction be table item adding request if forwarding engine sends instructions for 1 time, then judgement is created in the random access memory (RAM) 17 or is created in the three-state content addressing memory (TCAM) 19, and wherein RAM can be the outer double-speed internal memory of sheet/novel dynamic RAM (Double Data Rate/ReducedLatency Dynamic Random-Access Memory; Hereinafter to be referred as: DDR/RLDRAM) or sheet inter-sync dynamic RAM (Synchronous Dynamic Random AccessMemory; Hereinafter to be referred as: SDRAM).If under the look-up command that sends instructions be the list item search request, then search TCAM and/or RAM.The embodiment of the invention is with field programmable gate array (Field-Programmable Gate Array; Hereinafter to be referred as: FPGA) hardware algorithm carries out exact-match lookup.
Fig. 3 is the process flow diagram of list item adding method embodiment of the present invention, and as shown in Figure 3, this list item adding method may further comprise the steps:
Step 101, reception table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added.
The user upgrades the record in the random access memory ram or when storing, the new record that will add is that list item sends to RAM, this process can realize by sending table item adding request, carry the first key word Key1 and the index Index of the list item that needs interpolation in this table item adding request.After algorithm engine receives this table item adding request, the list item that request in the table item adding request is added is handled.
Step 102, whether full, if full, described first key word and index are added into three-state content addressing memory TCAM if inquiring about this first key word corresponding bucket in random access memory ram.
Wherein algorithm engine can be obtained the bucket address of this first key word correspondence in this RAM according to first key word of the list item of this request interpolation.For example: adopting hash function f (the Key1)=X of certain setting that this Key1 is carried out Hash operation, is the bucket address of Hash operation value X for this list item correspondence in RAM with cryptographic hash then.Suppose can store a bar list item in the bucket of X correspondence, represent that then the bucket of this first key word correspondence is full if stored a bar list item this moment, if the list item that stored this moment is less than a bar, then represent this first key word correspondence barrel less than.If the bucket of X correspondence less than, then algorithm engine is added clear position in this barrel into first key word and index; If the bucket of X correspondence is full, then algorithm engine is added into TCAM with first key word and the index of the list item of request interpolation.
Whether successful algorithm engine return the interpolation results messages of the process of this time adding, as long as TCAM satisfies design specification, capacity can be unrestricted, can guarantee the successful interpolation of list item.TCAM can use key word to search when searching.If the list item that request is added is added into TCAM, in search procedure, algorithm engine then can not only be visited RAM but also visit TCAM according to the value of this first key word Key1, just can find this list item.
Present embodiment because of the full list item that clashes of bucket adds into TCAM, guarantees that all list items can both add success with RAM; And need not to increase the RAM capacity, therefore saved the RAM resource, and under the situation that the RAM resource is fixed, expanded storable list item capacity.
Fig. 4 is the process flow diagram of list item disposal route first embodiment of the present invention, and as shown in Figure 4, on the basis of list item adding method embodiment of the present invention, this list item disposal route may further comprise the steps:
Step 201, reception table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added.
After algorithm engine receives the table item adding request of user's transmission, the list item that request in the table item adding request is added is handled.
Step 202, whether full, if full, described first key word and index are added into three-state content addressing memory TCAM if inquiring about this first key word corresponding bucket in random access memory ram.
Algorithm engine is carried out Hash operation to first key word of the list item that this request is added, and can obtain the bucket address of this first key word correspondence in this RAM.If the bucket of this barrel address correspondence less than, then algorithm engine is added clear position in this barrel into first key word and index; If the bucket of this barrel address correspondence is full, then algorithm engine is added into TCAM with first key word and the index of the list item of request interpolation.Particularly, the method for described first key word and index being added RAM into or TCAM can not repeat them here with reference to the description among the list item adding method embodiment of the present invention.
Step 203, reception list item search request, described first key word that the request of carrying in the described list item search request is searched.
Carry out after list item adds according to step 201 and 202, the list item that request was added when algorithm engine can expire bucket among the RAM add into TCAM.When carrying out quick exact-match lookup, after algorithm engine receives the list item search request, can conduct interviews to RAM and TCAM according to the first key word Key1 that carries in this list item query requests.
Step 204, search the list item of the described first key word correspondence, return the index of the list item corresponding with described first key word.
The list item that to ask to add when algorithm engine has expired as if bucket in RAM adds into TCAM, then when carrying out quick exact-match lookup, because the memory location of the list item of the first key word Key1 correspondence of the list item that request is searched in not knowing to send instructions down, after algorithm engine receives the list item search request, just need to judge whether there be the list item corresponding among RAM or the TCAM with first key word.Wherein the algorithm engine process of searching the TCAM list item among the TCAM and reading the ram table item in corresponding with described first key word bucket among the RAM does not have strict sequential relationship, can be provided with according to the size of TCAM and RAM particular capacity.
A kind of scheme is: search the TCAM list item among the TCAM, and read the ram table item in the bucket corresponding with described first key word among the RAM; Judge whether there be the TCAM list item corresponding among the described TCAM,, then return the index of the TCAM list item corresponding with described first key word if exist with described first key word; If do not exist, then judge in the described ram table item of reading whether have the ram table item corresponding with described first key word, if exist, then return the index of the ram table item corresponding with described first key word.
Another kind of scheme is: search the TCAM list item among the TCAM; Judge whether there be the TCAM list item corresponding among the described TCAM,, then return the index of the TCAM list item corresponding with described first key word if exist with described first key word; If do not exist, then read the ram table item in the bucket corresponding among the RAM with described first key word, and judge in the described ram table item of reading whether have the ram table item corresponding with described first key word, if exist, then return the index of the ram table item corresponding with described first key word.
Also have a kind of scheme to be: to read the ram table item in the bucket corresponding among the RAM with described first key word; Judge in the described ram table item of reading whether have the ram table item corresponding,, then return the index of the ram table item corresponding with described first key word if exist with described first key word; If do not exist, then search the TCAM list item among the TCAM, and judge whether there be the TCAM list item corresponding among the described TCAM with described first key word, if exist, then return the index of the TCAM list item corresponding with described first key word.
Wherein algorithm engine read among the RAM with the corresponding bucket of described first key word in the method for ram table item can be: adopt hash function f () identical when adding list item that described first key word is carried out Hash operation, for example: f (Key1)=X, then, read the interior ram table item of bucket of described bucket address correspondence with the bucket address of Hash operation value X as described first key word correspondence in described RAM.
Search when hitting, algorithm engine only need be returned the index of searching the list item correspondence of hitting and get final product, and can not return the other guide in the list item that hits.Algorithm engine also can be returned the message of searching success when hitting table item index returning, and perhaps searches in TCAM and RAM when all miss, returns the inquiry failure.
Owing to the restriction that speed is subjected to the RAM interface rate of searching of accurately mating, the time-delay of once reading whole barrelage certificate among the RAM is bigger, if can not satisfy the rate requirement of searching fast, then can also further improve the speed of searching by the methods such as the degree of depth that increase the RAM number, reduce bucket.
Present embodiment can find the list item that is stored among the RAM by visit TCAM and RAM, also can find because of the full list item that is stored among the TCAM of bucket among the RAM, because of need not to increase the barrel dark of RAM, has saved the RAM resource, has reduced the access times to RAM; Utilize the high-speed searching performance of TCAM chip, improved the speed of exact-match lookup, under the situation that the RAM resource is fixed, expanded storable list item capacity.
Fig. 5 is the process flow diagram of list item disposal route second embodiment of the present invention, as shown in Figure 5, this list item disposal route is on the basis of list item disposal route first embodiment of the present invention, and step 203 and step 204 that the list item that algorithm engine is searched request in this list item disposal route is searched can may further comprise the steps:
Step 300, begin to search execution in step 301, step 302.
Wherein search when beginning, execution in step 301 and step 302 simultaneously, also can first execution in step 301 execution in step 302 again, perhaps first execution in step 302 is execution in step 301 again.
Step 301, search the TCAM list item among the TCAM, execution in step 304.
Step 302, the first key word Key1 that request is searched carry out Hash operation.
Algorithm engine is carried out Hash operation to Key1, the hash function that the function that this Hash operation adopts adopts during with the interpolation list item is identical, f (Key1)=X, the Hash operation value X that calculates is exactly the bucket address of Key1 correspondence in RAM, can find the bucket of Key1 correspondence in RAM according to this barrel address.
Step 303, read the ram table item in the bucket of Key1 correspondence among the RAM, execution in step 305.
Step 304, judge whether to search among the TCAM and hit, if execution in step 306 then, otherwise execution in step 305.
Step 305, judge whether to search among the RAM and hit, if execution in step 306 then, otherwise execution in step 307.
Owing to have only the list item of conflict just can be deposited in the TCAM chip, hit if from the TCAM chip, search, be in the key word of the TCAM list item stored among the TCAM key word identical with Key1 to be arranged, then algorithm engine can directly be returned the index of the TCAM list item that hits, needn't handle the ram table item among the RAM that reads, because can not occur same the ram table item that hit corresponding among the RAM again with the key word that need search.If TCAM searches miss, then the algorithm engine Key1 that needs all key words that will read out in the bucket and request to search compares one by one, judgement from the pairing bucket of Y in whether the key word identical with Key1 is arranged all ram table items of reading, then think to search and hit if having, algorithm engine is returned the index of the ram table item correspondence of hitting, if then do not think search miss.
Step 306, return the index of searching the list item correspondence of hitting, execution in step 308.
Step 307, return and search miss Query Result message, execution in step 308.
Step 308, return the message and the result phase of searching end.
Search when hitting, algorithm engine only need be returned the index of searching the list item correspondence of hitting and get final product, and can not return the other guide in the list item that hits.In TCAM and RAM, search when all miss, can return the inquiry failure.Wherein step 306,308 can be carried out simultaneously, promptly returns the stop bit of this time searching end and result phase (hit, miss, failure cause etc.) in the index that returns the list item correspondence of hitting.Step 307,308 also can be carried out simultaneously, promptly returns the stop bit and the result phase of this time searching end when returning miss Query Result message.
Wherein do not have strict sequential relationship between the step 301,302,303,304 and 305, can execution in step execution in step 302,303 301 time, execution in step 304 then; Also can first execution in step 301,304, step 304 judge TCAM miss after, execution in step 302,303,305 again; All right first execution in step 302,303,305 is judged the miss back of RAM execution in step 301 in step 305.
Present embodiment is when searching the list item that has added, and visit TCAM and RAM can find to be stored among the RAM and because of the RAM bucket has expired the list item that is stored among the TCAM, has reduced the access times to RAM; Utilize the high-speed searching performance of TCAM chip, improved the speed of exact-match lookup, expanded the capacity of storable list item fixedly the time in the RAM resource.
One of ordinary skill in the art will appreciate that: all or part of step that realizes said method embodiment can be finished by the relevant hardware of programmed instruction, aforesaid program can be stored in the computer read/write memory medium, this program is carried out the step that comprises said method embodiment when carrying out; And aforementioned storage medium comprises: various media that can be program code stored such as ROM, RAM, magnetic disc or CD.
Fig. 6 is the synoptic diagram of list item adding set embodiment of the present invention, and as shown in Figure 6, this list item adding set comprises first receiver module 3 and adds module 5.Wherein first receiver module 3 is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added; Whether interpolation module 5 is used for inquiring about this first key word full at the bucket of random access memory (RAM) 17 correspondences, if full, then described first key word and index added into three-state content addressing memory (TCAM) 19.
Particularly, in the time of need adding a list item in RAM, the user sends table item adding request, carries the first key word Key1 and the index Index of the list item that needs interpolation in this table item adding request.After first receiver module 3 receives this interpolation list item request, add module 5 can be obtained this list item correspondence in this RAM according to the value of the Key1 in this table item adding request bucket address.Add module 5 and can comprise acquiring unit 51, judging unit 53 and adding device 55.Wherein acquiring unit 51 is used for obtaining described first key word in the corresponding bucket address of described RAM; Judging unit 53 is used to judge whether the bucket of described bucket address correspondence is full; Adding device 55 is used for then described first key word and index being added into TCAM if described first key word is full at the corresponding bucket of RAM.Further, add that module 5 also is used for if described first key word the corresponding bucket of RAM less than, then described first key word and index are added the clear position in the into described bucket.The hash function that acquiring unit 51 can adopt certain setting carries out Hash operation to obtain Key1 corresponding bucket address in RAM to Key1, f (Key1)=X for example, and then Hash operation value X be this list item corresponding barrel address in RAM.53 of judging units judge according to the bar number of the list item of the list item capacity of this barrel and actual storage whether this bucket is full, suppose the X correspondence the bucket in can store a bar list item, represent that then this bucket is full if stored a bar list item this moment, if this moment, the list item stored was less than a bar, then represent this bucket less than.If the bucket of X correspondence less than, then adding device 55 adds clear position in this barrel into the key word of this list item and index; If the bucket of X correspondence is full, then adding device 55 adds into TCAM with the key word and the index of this list item, if add successfully, then can return and add successful interpolation results messages.As long as general TCAM satisfies design specification, capacity can be unrestricted, can guarantee the successful interpolation of list item.
Present embodiment list item adding set adds into TCAM by adding module with the list item that conflicts among the RAM, guarantees that all list items can both add success; Need not to increase the RAM capacity, thereby saved the RAM resource, under the situation that the RAM resource is fixed, expanded storable list item capacity.
Fig. 7 is the synoptic diagram of list item treating apparatus embodiment of the present invention, and as shown in Figure 7, this list item treating apparatus comprises: first receiver module 3, add module 5, second receiver module 7 and return module 9.Wherein first receiver module 3 is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added; Whether interpolation module 5 is used for inquiring about this first key word full at the bucket of random access memory (RAM) 17 correspondences, if it is full, described first key word and index are added into three-state content addressing memory (TCAM) 19, if less than, described first key word and index can be added the clear position of bucket corresponding in the random access memory (RAM) 17 into; Second receiver module 7 is used to receive the list item search request, first key word that the request of carrying in the described list item search request is searched; Return module 9 and be used for existing and the corresponding list items of described first key word, then return the index of the list item corresponding with described first key word as if three-state content addressing memory (TCAM) 19 or random access memory (RAM) 17.
Particularly, in the time of need adding a list item in RAM, the user sends table item adding request, carries the first key word Key1 and the index Index of the list item that needs interpolation in this table item adding request.After first receiver module 3 receives this interpolation list item request, add module 5 can be obtained this list item correspondence in this RAM according to the value of the Key1 in this table item adding request bucket address.Wherein first receiver module 3 and interpolation module 5 can adopt the structure among the list item adding set embodiment of the present invention.After second receiver module 7 receives the list item search request,, then return the index that module 9 is returned the list item corresponding with described first key word if exist and the corresponding list item of described first key word among TCAM or the RAM.Further, returning module 9 can comprise and search unit 91 and reading unit 92.Wherein search the TCAM list item that unit 91 is used for searching TCAM; Reading unit 92 is used for reading the ram table item in the RAM bucket corresponding with described first key word.Return module 9 and can also comprise that first returns unit 93 and second and return unit 94, wherein first return unit 93 and be used for when there be the TCAM list item corresponding with described first key word in described TCAM, returning the index of the TCAM list item corresponding with described first key word; Second returns unit 94 is used for returning the index of the ram table item corresponding with described first key word when there be the ram table item corresponding with described first key word in the described ram table item of reading.After receiving the list item look-up command, searching unit 91 can search in the TCAM chip, reading unit 92 identical hash function f (Key1)=X when adopting with the interpolation list item, the Hash operation value X that calculates the first key word Key1 is the bucket address, reads the whole list items in the corresponding bucket among the RAM.Can in RAM, find corresponding bucket according to this barrel address, and read out ram table items all in this barrel.If when searching the unit and searching TCAM and reading unit and read RAM and carry out simultaneously, in TCAM, search and hit if search unit 91, then first return the index that unit 93 can return the TCAM list item that hits, and indicate reading unit 92 to stop to read; If with reading unit 92 that read with the corresponding bucket of Key1 in the contrast of ram table item hit, then second return the index that unit 94 can return the ram table item that hits, and indicate and search unit 91 and stop to search.If all miss in RAM and TCAM, then return module 9 and can also return and search failure.Certainly search unit 91 and search TCAM and reading unit 92 and read RAM and also can not work simultaneously, promptly search unit 91 search TCAM miss after, reading unit 92 reads RAM again; Perhaps the list item from RAM, read of reading unit 92 miss after, search unit 91 and search TCAM again.
Present embodiment list item treating apparatus return module searches TCAM and RAM, can find the list item that deposits among RAM and the TCAM, dark because of the bucket that need not to increase RAM, saved the RAM resource, reduced access times to RAM; Utilize the high-speed searching performance of TCAM chip, improved the speed of exact-match lookup, under the situation that the RAM resource is fixed, expanded storable list item capacity.
Fig. 8 is the synoptic diagram of list item disposal system embodiment of the present invention, and as shown in Figure 8, this list item disposal system comprises: comprise algorithm engine 2, random access memory (RAM) 17 and three-state content addressing memory (TCAM) 19.Wherein algorithm engine 2 is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added; Whether full, if full, described first key word and index are added into described TCAM if inquiring about this first key word bucket of correspondence in described RAM; If less than, described first key word and index can be added into described RAM.
Particularly, after algorithm engine 2 receives down and sends instructions, need resolve sending instructions under this, judge that it still is the list item look-up command that the list item that sends instructions under this adds instruction, be table item adding request if send instructions under described, then algorithm engine 2 is carried out list item and is added processing, first key word and the index of the list item that the request of carrying in the described table item adding request is added.Be whether algorithm engine 2 these first key words of inquiry bucket of correspondence in random access memory (RAM) 17 is full,, first key word and index added into three-state content addressing memory (TCAM) 19 if full; If less than, described first key word and index can be added into random access memory (RAM) 17.Be the list item search request if send instructions under described, then algorithm engine 2 is carried out list item and is searched processing, therefore this algorithm engine 2 also is used to receive the list item search request, described first key word that the request of carrying in the described list item search request is searched, search the list item of the described first key word correspondence then, return the index of the list item corresponding with described first key word.In the present embodiment algorithm engine 2 carry out method that list item add to handle can be with reference to the description among list item adding method first embodiment of the present invention, algorithm engine 2 is carried out list item and is searched the method for processing and can not repeat them here with reference to the description among first, second embodiment of list item disposal route of the present invention.
Present embodiment by algorithm engine with random access memory because of the full list item that clashes of bucket adds in the three-state content addressing memory, guarantee that list item can add success, expanded the list item capacity that can store; Can find the list item that is stored in three-state content addressing memory or the random access memory by algorithm engine,, improve the speed of exact-match lookup owing to utilize the high-speed searching performance of three-state content addressing memory chip; And owing to need not to reduce the probability of list item conflict, thereby saved the random access memory resource by the method that increases random access memory capacity.
It should be noted that at last: above embodiment only in order to technical scheme of the present invention to be described, is not intended to limit; Although with reference to previous embodiment the present invention is had been described in detail, those of ordinary skill in the art is to be understood that: it still can be made amendment to the technical scheme that aforementioned each embodiment put down in writing, and perhaps part technical characterictic wherein is equal to replacement; And these modifications or replacement do not make the essence of appropriate technical solution break away from the spirit and scope of various embodiments of the present invention technical scheme.

Claims (14)

1. a list item adding method is characterized in that, comprising:
Receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Whether full, if full, described first key word and index are added into three-state content addressing memory TCAM if inquiring about this first key word bucket of correspondence in random access memory ram.
2. whether list item adding method according to claim 1 is characterized in that, inquire about this first key word corresponding bucket in random access memory ram and completely comprise:
Obtain the bucket address of described first key word correspondence in described RAM;
Whether the bucket of judging described bucket address correspondence is full.
3. list item adding method according to claim 2 is characterized in that, the described described first key word corresponding bucket address in described RAM that obtains comprises:
Described first key word is carried out Hash operation, with the bucket address of Hash operation value as described first key word correspondence in described RAM.
4. according to any described list item adding method of claim 1-3, it is characterized in that, if described first key word in described RAM corresponding bucket less than, described first key word and index are added clear position in the into described bucket.
5. a list item disposal route is characterized in that, comprising:
Receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Whether full, if full, described first key word and index are added into three-state content addressing memory TCAM if inquiring about this first key word bucket of correspondence in random access memory ram;
Receive the list item search request, described first key word that the request of carrying in the described list item search request is searched;
Search the list item of the described first key word correspondence, return the index of the list item corresponding with described first key word.
6. list item disposal route according to claim 5 is characterized in that, the described list item of searching the described first key word correspondence returns the index of the list item corresponding with described first key word, comprising:
Search the TCAM list item among the described TCAM, and read the ram table item in the bucket corresponding among the described RAM with described first key word; Judge whether there be the TCAM list item corresponding among the described TCAM,, then return the index of the TCAM list item corresponding with described first key word if exist with described first key word; If do not exist, then judge in the described ram table item of reading whether have the ram table item corresponding with described first key word, if exist, then return the index of the ram table item corresponding with described first key word; Or
Search the TCAM list item among the described TCAM; Judge whether there be the TCAM list item corresponding among the described TCAM,, then return the index of the TCAM list item corresponding with described first key word if exist with described first key word; If do not exist, then read the ram table item in the bucket corresponding among the described RAM with described first key word, and judge in the described ram table item of reading whether have the ram table item corresponding with described first key word, if exist, then return the index of the ram table item corresponding with described first key word; Or
Read the ram table item in the bucket corresponding among the described RAM with described first key word; Judge in the described ram table item of reading whether have the ram table item corresponding,, then return the index of the ram table item corresponding with described first key word if exist with described first key word; If do not exist, then search the TCAM list item among the described TCAM, and judge whether there be the TCAM list item corresponding among the described TCAM with described first key word, if exist, then return the index of the TCAM list item corresponding with described first key word.
7. list item disposal route according to claim 6 is characterized in that, the described ram table item that reads in the bucket corresponding with described first key word among the described RAM comprises:
Described first key word is carried out Hash operation,, read the interior ram table item of bucket of described bucket address correspondence with the bucket address of Hash operation value as described first key word correspondence in described RAM.
8. a list item adding set is characterized in that, comprising:
First receiver module is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Adding module, whether at random access memory ram corresponding bucket full, if full, then described first key word and index are added into three-state content addressing memory TCAM if being used for inquiring about this first key word.
9. list item adding set according to claim 8 is characterized in that, described interpolation module also is used for: if described first key word the corresponding bucket of described RAM less than, then described first key word and index are added the clear position in the into described bucket.
10. according to Claim 8 or 9 described list item adding sets, it is characterized in that described interpolation module comprises:
Acquiring unit is used for obtaining described first key word in the corresponding bucket address of described RAM;
Judging unit is used to judge whether the bucket of described bucket address correspondence is full;
Adding device is used for then described first key word and index being added into TCAM if described first key word is full at the corresponding bucket of described RAM.
11. a list item treating apparatus is characterized in that, comprising:
First receiver module is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added;
Adding module, whether at random access memory ram corresponding bucket full, if full, described first key word and index are added into three-state content addressing memory TCAM if being used for inquiring about this first key word;
Second receiver module is used to receive the list item search request, described first key word that the request of carrying in the described list item search request is searched;
Return module, be used to search the list item of the described first key word correspondence, return the index of the list item corresponding with described first key word.
12. list item treating apparatus according to claim 11 is characterized in that, the described module of returning comprises:
Search the unit, be used for searching the TCAM list item of described TCAM;
Reading unit is used for reading the ram table item in the described RAM bucket corresponding with described first key word;
First returns the unit, is used for returning the index of the TCAM list item corresponding with described first key word when there be the TCAM list item corresponding with described first key word in described TCAM;
Second returns the unit, is used for returning the index of the ram table item corresponding with described first key word when there be the ram table item corresponding with described first key word in the described ram table item of reading.
13. a list item disposal system comprises algorithm engine and random access memory ram, it is characterized in that also comprising three-state content addressing memory TCAM;
Described algorithm engine is used to receive table item adding request, first key word and the index of the list item that the request of carrying in the described table item adding request is added; Whether full, if full, described first key word and index are added into described TCAM if inquiring about this first key word bucket of correspondence in described RAM.
14. list item disposal system according to claim 13 is characterized in that, described algorithm engine also is used for: receive the list item search request, described first key word that the request of carrying in the described list item search request is searched; Search the list item of the described first key word correspondence, return the index of the list item corresponding with described first key word.
CN200810247426A 2008-12-31 2008-12-31 Method and device for adding table items, and method, device and system for processing table items Pending CN101770485A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN200810247426A CN101770485A (en) 2008-12-31 2008-12-31 Method and device for adding table items, and method, device and system for processing table items

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN200810247426A CN101770485A (en) 2008-12-31 2008-12-31 Method and device for adding table items, and method, device and system for processing table items

Publications (1)

Publication Number Publication Date
CN101770485A true CN101770485A (en) 2010-07-07

Family

ID=42503350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN200810247426A Pending CN101770485A (en) 2008-12-31 2008-12-31 Method and device for adding table items, and method, device and system for processing table items

Country Status (1)

Country Link
CN (1) CN101770485A (en)

Cited By (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102427414A (en) * 2011-11-25 2012-04-25 盛科网络(苏州)有限公司 Method and device for automatically testing table entry volume
CN102868578A (en) * 2012-10-11 2013-01-09 盛科网络(苏州)有限公司 Test method and test system of openflow switch table body capacity
CN102937993A (en) * 2012-11-09 2013-02-20 北京小米科技有限责任公司 Method and device for accessing keywords
CN102959548A (en) * 2012-08-22 2013-03-06 华为技术有限公司 Data storage method, search method and device
CN103345479A (en) * 2013-06-18 2013-10-09 苏州雄立科技有限公司 Novel work mode for TCAM
CN104238953A (en) * 2013-06-13 2014-12-24 中兴通讯股份有限公司 Direct table storage method and device
CN107330047A (en) * 2017-06-28 2017-11-07 华信塞姆(成都)科技有限公司 A kind of FPGA training and enquiry circuit implementation method based on perfect hash algorithm
WO2017215466A1 (en) * 2016-06-15 2017-12-21 中兴通讯股份有限公司 Table look-up method for a network processor, network processor, table look-up system and storage medium
CN107547244A (en) * 2017-05-25 2018-01-05 新华三技术有限公司 A kind of table entry processing method and device
CN111684769A (en) * 2017-11-06 2020-09-18 思想系统公司 Network system including matching processing unit of table-based action

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1932818A (en) * 2006-09-20 2007-03-21 华为技术有限公司 Data bank system and method for controlling data bank data
CN101079764A (en) * 2006-05-25 2007-11-28 李�浩 A high-speed searching method for contents in table

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101079764A (en) * 2006-05-25 2007-11-28 李�浩 A high-speed searching method for contents in table
CN1932818A (en) * 2006-09-20 2007-03-21 华为技术有限公司 Data bank system and method for controlling data bank data

Cited By (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102427414A (en) * 2011-11-25 2012-04-25 盛科网络(苏州)有限公司 Method and device for automatically testing table entry volume
CN102427414B (en) * 2011-11-25 2013-12-04 盛科网络(苏州)有限公司 Method and device for automatically testing table entry volume
CN102959548A (en) * 2012-08-22 2013-03-06 华为技术有限公司 Data storage method, search method and device
WO2014029084A1 (en) * 2012-08-22 2014-02-27 华为技术有限公司 Data storage method and search method and device
CN102959548B (en) * 2012-08-22 2015-12-09 华为技术有限公司 Date storage method, lookup method and device
CN102868578A (en) * 2012-10-11 2013-01-09 盛科网络(苏州)有限公司 Test method and test system of openflow switch table body capacity
CN102937993B (en) * 2012-11-09 2016-01-06 小米科技有限责任公司 A kind of method for access key and device
CN102937993A (en) * 2012-11-09 2013-02-20 北京小米科技有限责任公司 Method and device for accessing keywords
CN104238953A (en) * 2013-06-13 2014-12-24 中兴通讯股份有限公司 Direct table storage method and device
CN103345479A (en) * 2013-06-18 2013-10-09 苏州雄立科技有限公司 Novel work mode for TCAM
WO2017215466A1 (en) * 2016-06-15 2017-12-21 中兴通讯股份有限公司 Table look-up method for a network processor, network processor, table look-up system and storage medium
CN107547244A (en) * 2017-05-25 2018-01-05 新华三技术有限公司 A kind of table entry processing method and device
CN107330047A (en) * 2017-06-28 2017-11-07 华信塞姆(成都)科技有限公司 A kind of FPGA training and enquiry circuit implementation method based on perfect hash algorithm
CN107330047B (en) * 2017-06-28 2020-06-30 华信塞姆(成都)科技有限公司 FPGA training and inquiring circuit implementation method based on perfect Hash algorithm
CN111684769A (en) * 2017-11-06 2020-09-18 思想系统公司 Network system including matching processing unit of table-based action
CN111684769B (en) * 2017-11-06 2023-03-24 思想系统公司 Network system including matching processing unit of table-based action

Similar Documents

Publication Publication Date Title
CN101770485A (en) Method and device for adding table items, and method, device and system for processing table items
CN103116634B (en) System for supporting high concurrent cache task queue and asynchronous batch operation method thereof
CN102760101B (en) SSD-based (Solid State Disk) cache management method and system
JP6277572B2 (en) Data caching method, cache and computer system
CN101141389B (en) Reinforcement multidigit Trie tree searching method and apparatus
CN102880628B (en) Hash data storage method and device
CN110321325B (en) File index node searching method, terminal, server, system and storage medium
CN101221538B (en) System and method for implementing fast data search in caching
CN100437590C (en) Method for prefetching object
CN105740472A (en) Distributed real-time full-text search method and system
CN104809179A (en) Device and method for accessing Hash table
CN102890675B (en) Method and device for storing and finding data
US20100228914A1 (en) Data caching system and method for implementing large capacity cache
CN102012931A (en) Filter cache method and device, and cache system
CN104158744A (en) Method for building table and searching for network processor
CN102187642B (en) Method and device for adding, searching for and deleting key in hash table
CN112187875B (en) Automatic matching method and system for multi-target cluster mounting strategy of distributed system
CN101576854A (en) File access method, device and system
CN104166649B (en) Caching method and equipment for search engine
CN105915619A (en) Access heat regarded cyber space information service high performance memory caching method
CN114281712A (en) Table lookup method and device, FPGA and readable storage medium
CN103186542A (en) Data querying method and device
CN100487697C (en) Searching method by using modified hash method
CN107800652A (en) The protocol access method and device used in a switch
CN107967306B (en) Method for rapidly mining association blocks in storage system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C02 Deemed withdrawal of patent application after publication (patent law 2001)
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20100707