CN105574054A - Distributed cache range query method, apparatus and system - Google Patents

Distributed cache range query method, apparatus and system Download PDF

Info

Publication number
CN105574054A
CN105574054A CN201410638522.4A CN201410638522A CN105574054A CN 105574054 A CN105574054 A CN 105574054A CN 201410638522 A CN201410638522 A CN 201410638522A CN 105574054 A CN105574054 A CN 105574054A
Authority
CN
China
Prior art keywords
node
value
ident
field
ident value
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.)
Granted
Application number
CN201410638522.4A
Other languages
Chinese (zh)
Other versions
CN105574054B (en
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.)
Advanced New Technologies Co Ltd
Advantageous New Technologies Co Ltd
Original Assignee
Alibaba Group Holding 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 Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201410638522.4A priority Critical patent/CN105574054B/en
Priority to PCT/CN2015/093311 priority patent/WO2016070751A1/en
Publication of CN105574054A publication Critical patent/CN105574054A/en
Application granted granted Critical
Publication of CN105574054B publication Critical patent/CN105574054B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention discloses a distributed cache range query method. The method comprises the steps of pre-storing an identifier value corresponding to a field value capable of being used for a range query in keywords used for mapping cache data into a storage region of a memory, and establishing a corresponding original keyword set for each identifier value separately; and in response to a received relational range query request, finding out an identifier value corresponding to an end point value in a specified range of at least one field value in at least two field values from the storage region, finding out the original keyword set corresponding to all identifier values in the specified range of the at least one field value, finding out keywords with at least two field values meeting a specified relationship from the found original keyword set, and obtaining a keyword set corresponding to the relational range query request, thereby realizing a multi-level range query decoupled to a database. In addition, the invention discloses a distributed cache range query apparatus and system.

Description

A kind of distributed caching range query method, Apparatus and system
Technical field
The present invention relates to distributed caching, particularly relate to a kind of distributed caching range query method, Apparatus and system.
Background technology
Distributed caching is a kind of data buffer storage mode data cached form with key-value (key word-data cached) be stored in by distributed cache server cluster in internal memory Hash table.Distributed caching reduces the number of times of accessing database by data cached in internal memory and object, improves data access speed.
At present, in order to support the range query of distributed caching, support that the index of range query realizes the range query to association key mainly through setting up in relevant database.When service end receives range of condition inquiry request, by the index of relevant database, go out to meet the association key of particular range according to range query condition query, then in distributed caching, directly inquire about the value obtaining correspondence according to key.
But the range query due to current distributed caching needs to be realized by database index, do not depart from the strong dependence to database, query performance is relatively poor.
Summary of the invention
In view of this, the object of the application is to provide a kind of distributed caching range query method to realize the object of range query when full decoupled with database.
In first of the embodiment of the present application, provide a kind of distributed caching range query method.Such as, the method can comprise: will be used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value; In response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding; The ident value corresponding according to the endpoint value of the specified scope of described at least one field value, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding; From the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding.
In second of the embodiment of the present application, provide a kind of distributed caching range query device.Such as, this device can comprise: pretreatment unit, for being used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value; Inquiry response unit, for in response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding; Value range acquiring unit, the ident value that the endpoint value for the specified scope according to described at least one field value is corresponding, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding; Key word acquiring unit, for from the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding.
In the 3rd of the embodiment of the present application, provide a kind of distributed caching range query system.Such as, this system can comprise: caching server, with key word, there is the data cached of mapping relations for storing, receiving the data cached inquiry request corresponding for set of keywords that send of querying server, to corresponding data cached of querying server feedback set of keywords.Querying server, for being used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value; In response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding; The ident value corresponding according to the endpoint value of the specified scope of described at least one field value, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding; From the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding, from described caching server, obtain corresponding data cached of described set of keywords, data cachedly feed back to the client sending described inquiry request by what obtain.Client, for sending relation extents inquiry request to described querying server, receives the data cached of querying server feedback.
Visible the application has following beneficial effect:
Because the embodiment of the present application will be used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value, therefore, after receiving relation extents inquiry request, the inquiry finding out ident value corresponding to the endpoint value of specified scope from described storage area can all complete in internal memory, and, ident value that can be corresponding according to the endpoint value of the specified scope of described at least one field value, find out the original key set that all ident values in the specified scope of described at least one field value are corresponding, from the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain set of keywords corresponding to described relation extents inquiry request without the need to accessing database, thus achieve and inquire about with the multilevel ranges of database decoupling zero.
Accompanying drawing explanation
In order to be illustrated more clearly in the embodiment of the present application or technical scheme of the prior art, be briefly described to the accompanying drawing used required in embodiment or description of the prior art below, apparently, the accompanying drawing that the following describes is only some embodiments recorded in the application, for those of ordinary skill in the art, under the prerequisite not paying creative work, other accompanying drawing can also be obtained according to these accompanying drawings.
A kind of distributed caching range query method flow schematic diagram that Fig. 1 provides for the application one embodiment;
Fig. 2 is the node cycle schematic diagram that the embodiment of the present application relates to;
A kind of distributed caching range query method flow schematic diagram that Fig. 3 provides for another embodiment of the application;
Fig. 4 is the original key set schematic diagram that the embodiment of the present application relates to;
A kind of distributed caching range query apparatus structure schematic diagram that Fig. 5 provides for the application one embodiment;
A kind of distributed caching range query apparatus structure schematic diagram that Fig. 6 provides for another embodiment of the application;
A kind of distributed caching range query system architecture schematic diagram that Fig. 7 provides for the embodiment of the present application.
Embodiment
Technical scheme in the application is understood better in order to make those skilled in the art person, below in conjunction with the accompanying drawing in the embodiment of the present application, technical scheme in the embodiment of the present application is clearly and completely described, obviously, described embodiment is only some embodiments of the present application, instead of whole embodiments.Based on the embodiment in the application, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, should belong to the scope of protection of the invention.
More be convenient to make the embodiment of the present application understand, first possible to the embodiment of the present application application scenarios is illustrated.Such as, the embodiment of the present application can be applied in the independent querying server different from one or more caching server for memory buffers data.Wherein, the key word be made up of hotel ID and date value and data cached mapping is saved in caching server.The querying server of method that application the embodiment of the present application provides can to receive for hotel ID and date value respectively in the relation extents inquiry request of the "AND"/"or" of respective specified scope, obtains returning set of keywords corresponding to inquiry request with relation.Such as, hotel ID can be inquired in 7 to 32 scopes and the set of keywords of date range in 20140701 to 20140731, and then hotel ID can be obtained in 7 to 32 scopes and corresponding data cached of the key word of date range in 20140701 to 20140731 from multiple stage caching server.
Below, in conjunction with above-mentioned possible application scenarios, the distributed caching range query method provide the embodiment of the present application and device are described in detail.
Such as, see Fig. 1, it is the distributed caching range query method flow schematic diagram that the embodiment of the present application provides.As shown in Figure 1, the method can comprise:
S110, will be used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value.
Such as, in order to reduce the number of nodes in node cycle, improve search efficiency, all key words can be belonged to the part repeated in the field value of same field and reject, only field values different for the value of same field is stored in advance in a storage area of internal memory.
Wherein, the storage organization being positioned at the storage area of internal memory is not limit, and such as, can be single-track link table, array, ring-type chained list etc.Such as, in some possible embodiments, can by described key word, can be used for the ident value that a kind of field value of range query is corresponding, be stored in advance in be positioned at internal memory node cycle (namely, ring-type chained list) in, wherein, the corresponding node cycle of a kind of field value, an ident value corresponding stored is in a node of node cycle, and be the routing table of each node foundation correspondence in described node cycle, described routing table have recorded the ident value of other nodes one or more determined according to preset Index Algorithm.Wherein, the described specific implementation setting up corresponding original key set respectively for each ident value can be: the node for each storaging mark value sets up corresponding original key set respectively.Be understandable that, the field value belonging to the value of same field different can think a kind of field value.
In some possible embodiments, described preset Index Algorithm can be: the ident value becoming power side's relation of 2 by the ident value spacing that a routing table records node corresponding with this routing table in node cycle.Accordingly, step S110 is specifically as follows: by key word, the ident value that field value that can be used for range query, that belong to same field is corresponding is stored in advance in the node cycle being arranged in internal memory by ident value size order, wherein, described routing table have recorded in described node cycle the ident value of the power side's relation becoming 2 with the ident value spacing of corresponding node.Typically, due to can be used for range query in data cached field value corresponding to the value that is normally more or less the same of ident value, in routing table, record becomes with the ident value spacing of a node node that the ident value of power side's relation of 2 is corresponding, can be convenient to follow-up searching, and improves search efficiency.
Certainly, preset Index Algorithm is not limited only to above that this is a kind of in embodiment, and specifically can need arrange according to actual queries efficiency, the application does not limit this.Such as, described preset Index Algorithm can also be: the ident value spacing recording node corresponding with this routing table in node cycle by routing table is the ident value of specifying constant integral multiple, etc.
Be understandable that, key (key word) can be made up of the field that various field is different, and wherein, the field that can be used for range query can comprise as, fields such as numeral, date.Such as, if need to do range query to the date, then can extract date value from each key word, be can according to the ident value of preset Index Algorithm computing by the different date value corresponding conversion extracted.In conjunction with the embodiment of upper node ring, then ident value can be stored as node cycle that is end to end, per diem time value size order sequence with the form of chained list.Such as, original key is " date-2014 08 month 07 day-hotelId-18873 ", and key word embodies date and hotel id corresponding relation, and the date " on 08 07th, 2014 " can be converted to ident value 140807.Wherein, be specially by field value order sequence from small to large by the sequence of ident value size order, also can sort for descending order.
S120, in response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding.
Such as, be stored in the embodiment of node cycle at ident value, can using any node in node cycle corresponding to described at least one field value as present node, in the routing table of described present node, find out the ident value that endpoint value apart from specified scope corresponding to described at least one field value is nearest; If it is determined that the ident value the found ident value that to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, using the ident value that finds as ident value corresponding to the endpoint value of specified scope corresponding to described at least one field value; If it is determined that the ident value the found ident value that not to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, present node is updated to the node at the ident value place found, turns back to described step of searching the nearest ident value of endpoint value apart from specified scope corresponding to described at least one field value in the routing table of present node.
Be understandable that, when specified relationship is with relation, as long as the node cycle that at least two kinds of field values described in obtaining, any one field value is corresponding, the key word of at least two kinds of field values simultaneously in the specified scope of correspondence described in can obtaining from this node cycle.Certainly, the node cycle that at least two kinds of field values described in also can obtaining, any number of field value is corresponding, the key word of at least two kinds of field values simultaneously in the specified scope of correspondence described in can therefrom finding out equally.When given query condition be or querying condition, then to need at least two kinds of field values described in obtaining the node cycle that often kind of field value is corresponding respectively, like this, just can obtain the set of keywords of often kind of field value in specified scope to get its union.
Such as, as shown in Figure 2, in conjunction with above-mentioned inquiry hotel ID in 7 to 32 scopes and date range at the application scenarios of key word of 20140701 to 20140731, node cycle 202 corresponding to node cycle 201 corresponding to hotel ID required for inquiry, date can be obtained.
Be understandable that, specified scope can comprise one or more specified scope, and endpoint value can for the endpoint value for determining specified scope interval.Such as, appointed day scope can comprise: May 1 January 1 calendar year 2001 to calendar year 2001, and, on May 1,1 day to 2002 January in 2002.Then endpoint value can comprise: 010101 and 010501,020101 and 020501.
It should be noted that, the ident value that described endpoint value is corresponding can be the ident value equal with described endpoint value, when there is not the ident value equal with described endpoint value, it can be ident value nearest with described endpoint value in described specified scope in node cycle.
Such as, in conjunction with above-mentioned inquiry hotel ID in 7 to 32 scopes and date range 20140701 to 20140731 the application scenarios of key word, the ident value that can find out the endpoint value of hotel ID scope 7 to 32 in the node cycle 201 corresponding at the hotel ID shown in Fig. 2 corresponding in node cycle 201 is respectively 8 and 30, and the ident value that can find out the endpoint value of date range 20140701 to 20140731 in the node cycle 202 corresponding on the date shown in Fig. 2 corresponding in node cycle 202 is respectively 20140703 and 20140728.
S130, the ident value corresponding according to the endpoint value of the specified scope of described at least one field value, find out the original key set that all ident values in the specified scope of described at least one field value are corresponding.
Such as, in conjunction with above-mentioned inquiry hotel ID in 7 to 32 scopes and date range 20140701 to 20140731 the application scenarios of key word, the ident value corresponding in node cycle 201 according to the endpoint value of hotel ID scope 7 to 32 is respectively 8 and 30, the ident value that the endpoint value of date range 20140701 to 20140731 is corresponding in node cycle 202 is respectively 20140703 and 20140728, node 8 is found out from node cycle 201, 10, 16, 21, 28, 30 original key set corresponding respectively, node 20140703 is found out from node cycle 202, 20140715, 20140722, 20140728 original key set corresponding respectively.
S140, from the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding.
Such as, if described specified relationship is or relation, then the ident value that at least two kinds of field values described in can finding out from storage area, the endpoint value of the specified scope of often kind of field value is corresponding.Correspondingly, original key set that can be corresponding by all ident values in the specified scope of often kind of field value in described at least two kinds of field values merges, and obtains the set of keywords that described relation extents inquiry request is corresponding.
Again such as, if described specified relationship be with relation, then the ident value that at least two kinds of field values described in can finding out from storage area, the endpoint value of the specified scope of any one or more field value is corresponding.Correspondingly, can from described at least two kinds of field values any one or more field value specified scope in original key set corresponding to all ident values in, described in finding out, the key word of at least two kinds of field values simultaneously in the specified scope of correspondence, obtains the set of keywords that described relation extents inquiry request is corresponding.
In conjunction with above-mentioned inquiry hotel ID in 7 to 32 scopes and date range 20140701 to 20140731 the application scenarios of key word, original key set that can be respectively corresponding to node 8,10,16,21,28,30, and the corresponding respectively original key set of node 20140703,20140715,20140722,20140728 is carried out getting intersection operation.
Such as, in some possible embodiments, the method that the embodiment of the present application provides can be applied in the independent querying server different from one or more caching server of memory buffers data, correspondingly, the node cycle that can be used for range query set up and routing table all can be stored in this querying server.After querying server obtains set of keywords corresponding to described relation extents inquiry request, can also download further by multithreading and concurrently from one or more caching server described, obtain corresponding data cached of described set of keywords, data cachedly return to the client sending described relation extents inquiry request by what obtain.
Visible, the method that application the embodiment of the present application provides, after receiving relation extents inquiry request, the inquiry finding out ident value corresponding to the endpoint value of specified scope from described storage area can all complete in internal memory, and, ident value that can be corresponding according to the endpoint value of the specified scope of described at least one field value, find out the original key set that all ident values in the specified scope of described at least one field value are corresponding, from the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain set of keywords corresponding to described relation extents inquiry request without the need to accessing database, thus achieve and inquire about with the multilevel ranges of database decoupling zero.
Below, the embodiment of the ident value of the power side relation of 2 is become to be described in detail for recording in node cycle with the ident value spacing of corresponding node to routing table.Such as, this embodiment can comprise:
S310, by in key word, can be used for range query, the ident value belonging to the field value of same field corresponding is stored in advance in the node cycle being arranged in internal memory by ident value size order, wherein, the corresponding node cycle of a kind of field value, an ident value corresponding stored is in a node of node cycle, and be the routing table of each node foundation correspondence in described node cycle, node for each storaging mark value sets up corresponding original key set respectively, described routing table have recorded in described node cycle the ident value of the power side's relation becoming 2 with the ident value spacing of corresponding node.
Wherein, spacing becomes the ident value of power side's relation of 2 to refer to, spacing equals 2 i-1the ident value of node, and, equal 2 when there is not spacing i-1ident value time, spacing is closest to 2 i-1node Identification.Such as, in the embodiment that some are possible, in order to pull open suitable spacing to improve search efficiency as far as possible, spacing is closest to 2 i-1ident value can get spacing and be greater than 2 i-1ident value in, spacing is closest to 2 i-1ident value, wherein, i is integer, and be more than or equal to 1, total that logarithm that the maximum ident value that is less than or equal to described node cycle interior joint gets 2 rounds up again.
Such as, node cycle as shown in Figure 2, wherein, the numerals such as 2,8,10,16 of node side mark are the ident value for identification nodes.Each node maintenance in node cycle as shown in Figure 2 routing table of a m item.Wherein, ident value represents with scale-of-two, and m is the figure place of binary identification value maximum in node cycle.If the node that in L representative ring, field value is maximum, then m is that L gets 2 logarithms and rounds up.That is: as shown in Figure 2, need by all Node distribution on ring, the value of m should be 6.In the m item routing table of each node maintenance, the ident value of i-th record of routing table equals:
The successor ((ident value+2 of this node i-1) mod2 m), (1≤i≤m).
Because routing table have recorded the ident value of the power side's relation becoming 2 with the ident value spacing of corresponding node, therefore, the immediate successor node of each node is the Section 1 of its routing table.For the ease of inquiring about endpoint node corresponding to specified scope below, in node cycle, each node also safeguards the direct precursor node of self simultaneously.In the embodiment of the present application, because the interval of the ident value of routing table record is with exponential increase, the density of the density ratio distant-end node of the node closed on corresponding node recorded in routing table is large, so, be in endpoint node process corresponding to search index specified scope below with routing table, if the end points of specified scope is away from the ident value of present node, then can jump to farther node fast according to the comparatively sparse distant-end node of routing table record to inquire about, if the end points of specified scope is close to the ident value of present node, then can jump to more exactly according to the comparatively intensive node closed on of routing table record and more inquire about close on the node of endpoint node.Therefore, be the routing table that node is set up by the embodiment of the present application, can efficient range query be carried out.
S320, in response to receiving relation extents inquiry request, any node in the node cycle that at least one field value is corresponding in described at least two kinds of field values is as present node.
S330, in the routing table of described present node, find out the nearest ident value of endpoint value apart from specified scope corresponding to described at least one field value.
If it is determined that the ident value that S340 the finds ident value that to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, using the ident value that finds as ident value corresponding to the endpoint value of specified scope corresponding to described at least one field value.
If it is determined that the ident value that S350 the finds ident value that not to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, present node is updated to the node at the ident value place found, turns back to described step of searching the nearest ident value of endpoint value apart from specified scope corresponding to described at least one field value in the routing table of present node.
Below, in conjunction with node corresponding to ident value embodiment by ident value order sequence from small to large in node cycle, the embodiment possible to the embodiment of the present application above-mentioned steps S320-S350 is described in detail.Such as, in this embodiment, the specified scope that in described at least one nodal value, certain nodal value is corresponding can be the scope between first end point value to the second endpoint value, wherein, described first end point value is less than the second endpoint value, and the possible query steps of S320-S350 can comprise:
When receiving inquiry request, can using any node in node cycle corresponding for this kind of nodal value as present node.
Judge whether there is the ident value equal with described first end point value in the field value of the routing table record of described present node.
If so, then using ident value corresponding as described first end point value for the ident value equal with described first end point value.
If not, described first end point value is judged whether between the ident value and the ident value of its direct precursor node or immediate successor node of described present node.
Be understandable that, if endpoint value the ident value of described present node and its direct precursor node or and the ident value of its immediate successor node between, then illustrate there is not the ident value equal with endpoint value in node cycle, ident value corresponding to described endpoint value can only be selected in the direct precursor node of present node, present node or immediate successor node, specifically can according to endpoint value be scope initial end points or stop end points select.If endpoint value not the ident value of described present node and its direct precursor node or and the ident value of its immediate successor node between, then illustrate that in node cycle, other positions may exist the ident value equal with endpoint value, then can jump in the routing table of present node the node at the ident value place nearest apart from described endpoint value of recording, proceed to judge.
If described first end point value is between the ident value and the ident value of its direct precursor node of described present node, then using the ident value of described present node as ident value corresponding to described first end point value.
If described first end point value is between the ident value and the ident value of its immediate successor node of described present node, then using the ident value of the immediate successor node of described present node as ident value corresponding to described first end point value.
If described first end point value is not between the ident value and the ident value of its immediate successor node of described present node, and not between the ident value and the ident value of its direct precursor node of described present node, then described present node is updated to the node that the ident value nearest apart from described first end point value that record in the routing table of described present node identifies, turns back to the described step judging whether to exist in the ident value of the routing table record of present node the ident value equal with described first end point value.
Judge whether there is the ident value equal with described second endpoint value in the ident value of the routing table record of described present node.
If so, then using the ident value that equals described second endpoint value as ident value corresponding to described second endpoint value.
If not, described second endpoint value is judged whether between the ident value and the ident value of its direct precursor node or immediate successor node of described present node.
If described second endpoint value is between the ident value and the ident value of its direct precursor node of described present node, then using the ident value of the direct precursor node of described present node as ident value corresponding to described second endpoint value.
If described second endpoint value is between the ident value and the ident value of its immediate successor node of described present node, then using the ident value of described present node as ident value corresponding to described second endpoint value.
If described second endpoint value is not between the ident value and the ident value of its immediate successor node of described present node, and not between the ident value and the ident value of its direct precursor node of described present node, then described present node is updated to the node that the ident value nearest apart from described second endpoint value that record in the routing table of described present node identifies, turns back to the described step judging whether to exist in the ident value of the routing table record of present node the ident value equal with described second endpoint value.
It should be noted that, the inquiry of the ident value corresponding for first end point value and ident value corresponding to the second endpoint value can concurrence performance simultaneously, also can successively perform, the embodiment of the present application is also unrestricted for the query execution order of the ident value of different endpoint value.
Below, node cycle shown in composition graphs 2, schematically illustrates above-mentioned query steps for the ident value inquiring about hotel ID scope 7 to 32.Be understandable that, this with numerical example only for ease of understand, if the field value that can be used for range query is non-numeric type, the field value of nonnumeric type can be converted to the ident value of numeric type.Such as, first from node 2s, according to 7 between node 2 and the immediate successor node 8 of node 2, can determine in node cycle, to there is not the node that ident value is 7.So the ident value of 7 correspondences is node 8.Then, from node 8s, according to being node 28 with the immediate node of node 32 in the routing table of node 8, the routing table jumping to node 28 is inquired about, the routing table information of query node 28, according to being node 30 with 32 immediate nodes, the routing table jumping to node 30 is inquired about, according to 32 between node 30 and its immediate successor node 33, determine in node cycle, to there is not the node that ident value is 32.So the ident value of 32 correspondences is 30.Thus according to node cycle as shown in Figure 2, be 8 in the origin identification value of specified scope, terminating ident value is 30.
S360, the ident value corresponding according to the endpoint value of the specified scope of described at least one field value, find out the original key set that all ident values in the specified scope of described at least one field value are corresponding.
Such as, ident value in conjunction with hotel ID scope 7 to 32 is the example of 8 and 30, ident value in the hotel ID scope 7 to 32 found out can comprise: 8,10,16,21,28,30, and then obtains node 8,10,16,21,28,30 original key set corresponding respectively.The embodiment of the ident value of Query Dates scope 20140701 to 20140731, with embodiment is similar above, does not repeat them here.Such as, according to the ident value 20140703 and 20140728 inquired, the original key set that node 20140703,20140715,20140722,20140728 is corresponding respectively can be obtained.
S370, from the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding.
Such as, node 8,10, the original key set that 16,21,28,30 difference are corresponding, and the original key set of node 20140703,20140715,20140722,20140728 difference correspondence can be as shown in Figure 4.According to Fig. 4, the original key set of node 8 and 30 and date node 20140715 exists occurs simultaneously, also there is common factor in the original key set of node 10 and 21 and date node 20140722, intersection operation is carried out in the original key set corresponding with date range 20140701 to 20140731 to the original key set of hotel ID scope 7 to 32 correspondence just can obtain specified relationship for set of keywords corresponding to the relation extents inquiry request of " with relation ".Such as, the set of keywords obtained is combined into 20140715-8,20140715-30,20140722-10,20140722-21.In like manner, union operation is carried out in original key set corresponding to these two scopes, can obtain the set of keywords that relation extents inquiry request that specified relationship is " or relation " is corresponding.
Visible, apply this embodiment, directly can read node cycle from internal memory, range query is carried out using the routing table of node cycle interior joint as index, depart from the dependence to database, reading speed is fast, and in the process of the ident value corresponding according to the endpoint value of routing table lookup specified scope, always jump to and search in the routing table of the node at the nearest ident value place of endpoint value, finally find out the set of keywords that relation extents inquiry request is corresponding, thus make query script become the process of binary search, reach the object of higher efficiency range inquiry.Such as, for 100,000,000 nodes, L=100,000,000, so each node needs the routing table item number safeguarded to be log 2l=27, inquiry wherein any one node needs the jumping figure of experience mostly to be logL=8 most, so the performance of inquiry is very high.
In addition, for distributed cache system, the key word of buffer memory may at any time add or delete.Meanwhile, in order to ensure node cycle and routing table consistent with the key word in buffer memory, need to add in the node cycle of routing table at node needs simultaneously or delete.Particularly, the embodiment of the present application can also comprise:
For the key word newly added in buffer memory, whether the ident value judging to can be used in the key word that newly adds the field value of range query corresponding has been present in described node cycle, if, can be used in the original key set of ident value corresponding to the field value of range query described in the described key word newly added is added, if not, ident value corresponding for the field value that can be used for range query in the described key word newly added is stored in new node, the node N of the direct precursor node that can be used as new node is found out in described node cycle, the direct precursor node upgrading the immediate successor node of described node N is described new node, upgrade the direct precursor node that described node N is described new node, for described new node sets up corresponding routing table.
For the key word deleted in buffer memory, if the field value that can be used for range query in the field of the key word of described deletion is not present in any other key word, to the node of ident value corresponding to this field value be stored as node to be deleted, the direct precursor node upgrading the immediate successor node of node to be deleted is the direct precursor node of described node to be deleted, deletes described node to be deleted from described node cycle; If there is the key word of described deletion in the original key set of other node cycles, the key word of described deletion is deleted from the original key set of other node cycles described.
And, according to preset Index Algorithm, on by affecting or affect by the deletion of described node to be deleted and need the routing table of renewal to upgrade adding of described new node.
Below, the renewal how carrying out routing table is illustrated.Such as: the ident value of i-th in conjunction with above-mentioned routing table equals the successor ((ident value+2 of this node i-1) mod2 m), the embodiment of (1≤i≤m), if newly added node P in node cycle, then can by following steps on add by P affect and need upgrade routing table upgrade:
The successor ((ident value+2 of this node is equaled according to the ident value of i-th i-1) mod2 m), carry out recurrence renewal to the information of the routing table record of the predecessor node of node P, until the predecessor node that recurrence arrives can not meet two conditions upgraded simultaneously, recurrence stops.Wherein said two conditions are: condition one: recurrence to predecessor node S and node P between the spacing of ident value be more than or equal to 2 i-1.Because if the distance of ident value is less than 2 between node S and node P i-1, then i-th one of node S routing table fix on node P after, so routing table i-th do not need upgrade.Condition two: satisfy condition one prerequisite under, current i-th needs of routing table of node S are after node P.Because if the routing table information of node S i-th is before node P.Illustrate that P node is the node after current i-th, do not need to upgrade routing table currentitem.
According to the judgement of above-mentioned two conditions, the routing table information of the predecessor node of newly added node can be upgraded exactly along link point predetermined order order reverse direction recurrence.Due to identical to the principle of the renewal of routing table on the renewal of routing table and above-mentioned impact by newly added node by deletion of node affects, do not repeat them here.Because insert or deletion of node, can not have an impact to the routing table of the descendant node of present node, only can affect the predecessor node of present node.This just requires that each node is except needs maintaining routing list information, also needs to safeguard direct precursor node.In recurrence renewal process, if node S needs i-th that upgrades routing table, so the direct precursor node of node S also may need to upgrade routing table information, otherwise, if node S does not need to upgrade routing table information, then the predecessor node of S does not need to upgrade routing table information yet.Recurrence upgrades routing table information and terminates.
Such as, as shown in Figure 2, newly added node is node 30, along the routing table information of the link point counterclockwise recurrence more predecessor node of new node 30, from predecessor node 28 always recurrence be updated to node 16.As shown in Figure 2, the 1st of node 28 routing table, the 2nd is updated to 30 from 33.During owing to being updated to node 16, meet two conditions upgrading routing table time different, the routing table information of node 16 does not change, and therefore, terminates recurrence and upgrades.
Corresponding with the distributed caching range query method that the embodiment of the present application provides, the embodiment of the present application additionally provides a kind of distributed caching range query device.
Such as, see Fig. 5, it is the distributed caching range query apparatus structure schematic diagram that the embodiment of the present application provides.As shown in Figure 5, this device can comprise:
Pretreatment unit 510, may be used for being used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value.
Inquiry response unit 520, may be used in response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding.
Value range acquiring unit 530, may be used for the ident value corresponding according to the endpoint value of the specified scope of described at least one field value, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding.
Key word acquiring unit 540, may be used for from the original key set found out, and at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding.
Wherein, described pretreatment unit 510, specifically may be used in described key word, can be used for the ident value that a kind of field value of range query is corresponding, be stored in advance in the node cycle being arranged in internal memory, wherein, the corresponding node cycle of a kind of field value, an ident value corresponding stored in a node of node cycle, and is the routing table of each node foundation correspondence in described node cycle, and described routing table have recorded the ident value of other nodes one or more determined according to preset Index Algorithm.
In some possible embodiments, described inquiry response unit 520 can comprise:
Search subelement 521, may be used in response to receiving relation extents inquiry request, any node in the node cycle that described at least one field value is corresponding, as present node, finds out the ident value that endpoint value apart from specified scope corresponding to described at least one field value is nearest in the routing table of described present node.First judges subelement 522, if it is determined that the ident value that may be used for the finding ident value that to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, using the ident value that finds as ident value corresponding to the endpoint value of specified scope corresponding to described at least one field value.Second judges subelement 523, if it is determined that the ident value that may be used for the finding ident value that not to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, present node is updated to the node at the ident value place found, searches subelement described in triggering in the routing table of present node, search the nearest ident value of endpoint value apart from specified scope corresponding to described at least one field value.
In some possible embodiments, described pretreatment unit 510, specifically may be used in key word, can be used for range query, the ident value belonging to the field value of same field corresponding is stored in advance in the node cycle being arranged in internal memory by ident value size order, wherein, the corresponding node cycle of a kind of field value, an ident value corresponding stored is in a node of node cycle, and be the routing table of each node foundation correspondence in described node cycle, described routing table have recorded in described node cycle the ident value of the power side's relation becoming 2 with the ident value spacing of corresponding node.
Below, described routing table be have recorded in described node cycle become the embodiment of the field value of power side's relation of 2 to be described in detail with the field value spacing of corresponding node.Suppose that the node in described node cycle sorts by ident value order from small to large, the specified scope that in described at least one nodal value, certain nodal value is corresponding can be the scope between first end point value to the second endpoint value, wherein, described first end point value is less than the second endpoint value.For the inquiry of ident value corresponding to first end point value, search subelement 521 described in the embodiment of the present application, as shown in Figure 6, can comprise:
Set out subelement 5210, may be used for when receiving inquiry request, using any node in node cycle corresponding for this kind of nodal value as present node.
First end points judgment sub-unit 5211, may be used for whether there is the ident value equal with described first end point value in the ident value of the routing table record judging described present node.
First end points determination subelement 5212, it is determined that the presence of if may be used for described first end points judgment sub-unit 5211, then using ident value corresponding as described first end point value for the ident value equal with described first end point value.
First end points is continuous sentences subelement 5213, if may be used for described first end points judgment sub-unit 5211 to judge not exist, judge described first end point value whether between the ident value and the ident value of its direct precursor node or immediate successor node of described present node.
First end points continues stator unit 5214, if may be used for described first end points to continue and sentence subelement 5213 and judge that described first end point value is between the ident value and the ident value of its direct precursor node of described present node, then using the ident value of described present node as ident value corresponding to described first end point value; If described first end points continues and sentences subelement 5213 and judge that described first end point value is between the ident value and the ident value of its immediate successor node of described present node, then using the ident value of the immediate successor node of described present node as ident value corresponding to described first end point value.
Wherein, described second judges subelement 523, if may be used for described first end points to continue and sentence subelement 5213 and judge described first end point value not between the ident value and the ident value of its immediate successor node of described present node, and not between the ident value and the ident value of its direct precursor node of described present node, then described present node is updated to the node at the ident value place nearest apart from described first end point value of recording in the routing table of described present node, again triggers described first end points judgment sub-unit 5211 and perform.
For the inquiry of ident value corresponding to the second endpoint value, search subelement 521 described in the embodiment of the present application, as shown in Figure 6, can also comprise:
Second end points judgment sub-unit 5215, may be used for whether there is the ident value equal with described second endpoint value in the ident value of the routing table record judging described present node.
Second end points determination subelement 5216, it is determined that the presence of if may be used for described second end points judgment sub-unit 5215, then using ident value that the ident value equal with described endpoint value is nearest apart from described second endpoint value in described node cycle.
Second end points is continuous sentences subelement 5217, if may be used for described second end points judgment sub-unit 5215 to judge not exist, judge described second endpoint value whether between the ident value and the ident value of its direct precursor node or immediate successor node of described present node.
Second end points continues stator unit 5218, if may be used for described second end points to continue and sentence subelement 5217 and judge that described second endpoint value is between the ident value and the ident value of its direct precursor node of described present node, then using ident value that the direct precursor node of described present node is nearest apart from described second endpoint value in described node cycle; If described second end points continues and sentences subelement 5217 and judge that described second endpoint value is between the ident value and the ident value of its immediate successor node of described present node, then using ident value that the ident value of described present node is nearest apart from described second endpoint value in described node cycle.
Wherein, described second judges subelement 523, if may be used for described second end points to continue and sentence subelement 5217 and judge described second endpoint value not between the ident value and the ident value of its immediate successor node of described present node, and not between the ident value and the ident value of its direct precursor node of described present node, then described present node is updated to the node at the ident value place nearest apart from described second endpoint value of recording in the routing table of described present node, again triggers described second end points judgment sub-unit 5215 and perform.
Below, then to the embodiment of the present application to add in node cycle or the embodiment of deletion of node is introduced.Such as, the device that the embodiment of the present application provides can also comprise:
Node adds unit 550, may be used for the key word for newly adding in buffer memory, whether the ident value judging to can be used in the key word that newly adds the field value of range query corresponding has been present in described node cycle, if, can be used in the original key set of ident value corresponding to the field value of range query described in the described key word newly added is added, if not, ident value corresponding for the field value that can be used for range query in the described key word newly added is stored in new node, the node N of the direct precursor node that can be used as new node is found out in described node cycle, the direct precursor node upgrading the immediate successor node of described node N is described new node, upgrade the direct precursor node that described node N is described new node, for described new node sets up corresponding routing table,
Knot removal unit 551, may be used for the key word for deleting in buffer memory, if the field value that can be used for range query in the field of the key word of described deletion is not present in any other key word, to the node of ident value corresponding to this field value be stored as node to be deleted, the direct precursor node upgrading the immediate successor node of node to be deleted is the direct precursor node of described node to be deleted, deletes described node to be deleted from described node cycle; If there is the key word of described deletion in the original key set of other node cycles, the key word of described deletion is deleted from the original key set of other node cycles described.
And routing update unit 552, may be used for according to preset Index Algorithm, on by affecting or affect by the deletion of described node to be deleted and need the routing table of renewal to upgrade adding of described new node.
Below, then in conjunction with some possible application scenarioss of the embodiment of the present invention schematically illustrate.
Such as, in some possible embodiments, according to consistent hashing rule, the kay-value information of each node can be stored at one or more caching server of distributed cache system.In order to improve query performance, the device that the embodiment of the present application provides can be configured in the independent querying server different from one or more caching server for memory buffers data.Correspondingly, this device can also comprise: data feedback unit 560, may be used for after key word acquiring unit obtains set of keywords corresponding to described relation extents inquiry request, downloaded by multithreading and concurrently from one or more caching server described, obtain corresponding data cached of described set of keywords, data cachedly return to the client sending described relation extents inquiry request by what obtain.
Visible, the device that configuration the embodiment of the present application provides, directly this node cycle can be read from internal memory by inquiry response unit 520, range query is carried out using the routing table of node cycle interior joint as index, depart from the dependence to database, reading speed is fast, and in the process of the ident value corresponding according to the endpoint value of routing table lookup specified scope, always jump to and search in the routing table of the node at the nearest ident value place of endpoint value, finally make key word acquiring unit 540 can find out set of keywords corresponding to relation extents inquiry request, thus make query script become the process of binary search, reach the object of higher efficiency range inquiry.
It should be noted that, subelement 521 is searched described in the embodiment of the present application, first judges subelement 522, second judges subelement 523, set out subelement 5210, first end points judgment sub-unit 5211, first end points determination subelement 5212, first end points is continuous sentences subelement 5213, first end points continues stator unit 5214, second end points judgment sub-unit 5215, second end points determination subelement 5216, second end points is continuous sentences subelement 5217, second end points continues stator unit 5218, node adds unit 550, knot removal unit 551, routing update unit 552, and data feedback unit 560 is in figure 6 with dotted lines, to represent that these unit or subelement are not the necessary unit of the device that the embodiment of the present application provides.
Corresponding with above-mentioned distributed caching range query method, the embodiment of the present application additionally provides a kind of distributed caching range query system.
Such as, see Fig. 7, it is the distributed caching range query system architecture schematic diagram that the embodiment of the present application provides.As shown in Figure 7, this system can comprise:
Caching server 710, may be used for storing and has the data cached of mapping relations with key word, receives the data cached inquiry request corresponding for set of keywords that send of querying server, to corresponding data cached of querying server feedback set of keywords.
Querying server 720, may be used for being used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value; In response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding; The ident value corresponding according to the endpoint value of the specified scope of described at least one field value, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding; From the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding, from described caching server, obtain corresponding data cached of described set of keywords, data cachedly feed back to the client sending described inquiry request by what obtain.
Client 730, may be used for sending relation extents inquiry request to described querying server, receives the data cached of querying server feedback.
Such as, caching server 710 can have a platform or multiple stage.Different node cycle and the routing table of what the embodiment of the present application was set up can be used for range query all can be stored in this independent querying server 720.Such as, this querying server 720 can determine according to relational query request the node cycle needing reading, using any node in node cycle as present node, carry out subsequent query step, after obtaining set of keywords corresponding to inquiry request, can be downloaded by multithreading and concurrently from one or more caching server described, obtain corresponding data cached of described set of keywords, data cachedly return to the client sending described relation extents inquiry request by what obtain.
For convenience of description, various unit is divided into describe respectively with function when describing above device.Certainly, the function of each unit can be realized in same or multiple software and/or hardware when implementing of the present invention.
As seen through the above description of the embodiments, those skilled in the art can be well understood to the mode that the present invention can add required general hardware platform by software and realizes.Based on such understanding, technical scheme of the present invention can embody with the form of software product the part that prior art contributes in essence in other words, this computer software product can be stored in storage medium, as ROM/RAM, magnetic disc, CD etc., comprising some instructions in order to make a computer equipment (can be personal computer, server, or the network equipment etc.) perform the method described in some part of each embodiment of the present invention or embodiment.
Each embodiment in this instructions all adopts the mode of going forward one by one to describe, between each embodiment identical similar part mutually see, what each embodiment stressed is the difference with other embodiments.Especially, for system embodiment, because it is substantially similar to embodiment of the method, so description is fairly simple, relevant part illustrates see the part of embodiment of the method.
The present invention can be used in numerous general or special purpose computing system environment or configuration.Such as: personal computer, server computer, handheld device or portable set, laptop device, multicomputer system, system, set top box, programmable consumer-elcetronics devices, network PC, small-size computer, mainframe computer, the distributed computing environment comprising above any system or equipment etc. based on microprocessor.
The present invention can describe in the general context of computer executable instructions, such as program module.Usually, program module comprises the routine, program, object, assembly, data structure etc. that perform particular task or realize particular abstract data type.Also can put into practice the present invention in a distributed computing environment, in these distributed computing environment, be executed the task by the remote processing devices be connected by communication network.In a distributed computing environment, program module can be arranged in the local and remote computer-readable storage medium comprising memory device.
It should be noted that, in this article, the such as relational terms of first and second grades and so on is only used for an entity or operation to separate with another entity or operational zone, and not necessarily requires or imply the relation that there is any this reality between these entities or operation or sequentially.And, term " comprises ", " comprising " or its any other variant are intended to contain comprising of nonexcludability, thus make to comprise the process of a series of key element, method, article or equipment and not only comprise those key elements, but also comprise other key elements clearly do not listed, or also comprise by the intrinsic key element of this process, method, article or equipment.When not more restrictions, the key element limited by statement " comprising ... ", and be not precluded within process, method, article or the equipment comprising described key element and also there is other identical element.
The foregoing is only preferred embodiment of the present invention, be not intended to limit protection scope of the present invention.All any amendments done within the spirit and principles in the present invention, equivalent replacement, improvement etc., be all included in protection scope of the present invention.

Claims (12)

1. a distributed caching range query method, is characterized in that, comprising:
To be used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value;
In response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding;
The ident value corresponding according to the endpoint value of the specified scope of described at least one field value, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding;
From the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding.
2. method according to claim 1, is characterized in that, describedly in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding by being used for, and the storage area being stored in advance in internal memory comprises:
By in described key word, can be used for the ident value that a kind of field value of range query is corresponding, be stored in advance in the node cycle being arranged in internal memory, wherein, the corresponding node cycle of a kind of field value, an ident value corresponding stored in a node of node cycle, and is the routing table of each node foundation correspondence in described node cycle, and described routing table have recorded the ident value of other nodes one or more determined according to preset Index Algorithm;
Wherein, described is that each ident value sets up being implemented as of corresponding original key set respectively: the node for each storaging mark value sets up corresponding original key set respectively;
Described find out from described storage area described in the endpoint value of the specified scope of at least one field value is corresponding at least two kinds of field values ident value comprise:
Any node in the node cycle that described at least one field value is corresponding, as present node, finds out the ident value that endpoint value apart from specified scope corresponding to described at least one field value is nearest in the routing table of described present node;
If it is determined that the ident value the found ident value that to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, using the ident value that finds as ident value corresponding to the endpoint value of specified scope corresponding to described at least one field value;
If it is determined that the ident value the found ident value that not to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest, present node is updated to the node at the ident value place found, turns back to described step of searching the nearest ident value of endpoint value apart from specified scope corresponding to described at least one field value in the routing table of present node.
3. method according to claim 2, is characterized in that, described by key word, can be used for the ident value that a kind of field value of range query is corresponding, is stored in advance in the node cycle being arranged in internal memory and comprises:
By in key word, the ident value that field value that can be used for range query, that belong to same field is corresponding is stored in advance in the node cycle being arranged in internal memory by ident value size order, wherein, described routing table have recorded in described node cycle the ident value of the power side's relation becoming 2 with the ident value spacing of corresponding node.
4. method according to claim 1, is characterized in that, also comprises:
For the key word newly added in buffer memory, whether the ident value judging to can be used in the key word that newly adds the field value of range query corresponding has been present in described node cycle, if, can be used in the original key set of ident value corresponding to the field value of range query described in the described key word newly added is added, if not, ident value corresponding for the field value that can be used for range query in the described key word newly added is stored in new node, the node N of the direct precursor node that can be used as new node is found out in described node cycle, the direct precursor node upgrading the immediate successor node of described node N is described new node, upgrade the direct precursor node that described node N is described new node, for described new node sets up corresponding routing table,
For the key word deleted in buffer memory, if the field value that can be used for range query in the field of the key word of described deletion is not present in any other key word, to the node of ident value corresponding to this field value be stored as node to be deleted, the direct precursor node upgrading the immediate successor node of node to be deleted is the direct precursor node of described node to be deleted, deletes described node to be deleted from described node cycle; If there is the key word of described deletion in the original key set of other node cycles, the key word of described deletion is deleted from the original key set of other node cycles described;
And, according to preset Index Algorithm, on by affecting or affect by the deletion of described node to be deleted and need the routing table of renewal to upgrade adding of described new node.
5. method according to claim 1, is characterized in that, described method is applied in the querying server different from one or more caching server for memory buffers data;
After obtaining set of keywords corresponding to described relation extents inquiry request, also comprise: downloaded by multithreading and concurrently from one or more caching server described, obtain corresponding data cached of described set of keywords, data cachedly return to the client sending described relation extents inquiry request by what obtain.
6. method according to claim 1, is characterized in that,
If described specified relationship is or relation, being implemented as of the ident value that at least two kinds of field values described in finding out from storage area then, the endpoint value of the specified scope of at least one field value is corresponding, the ident value that at least two kinds of field values described in finding out from storage area, the endpoint value of the specified scope of often kind of field value is corresponding; The described original key set from finding out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain being implemented as of set of keywords corresponding to described relation extents inquiry request, original key set corresponding for all ident values in the specified scope of often kind of field value in described at least two kinds of field values is merged, obtains the set of keywords that described relation extents inquiry request is corresponding;
If described specified relationship be with relation, being implemented as of the ident value that at least two kinds of field values described in finding out from storage area then, the endpoint value of the specified scope of at least one field value is corresponding, the ident value that at least two kinds of field values described in finding out from storage area, the endpoint value of the specified scope of any one or more field value is corresponding; The described original key set from finding out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain being implemented as of set of keywords corresponding to described relation extents inquiry request, from described at least two kinds of field values any one or more field value specified scope in original key set corresponding to all ident values in, described in finding out, the key word of at least two kinds of field values simultaneously in the specified scope of correspondence, obtains the set of keywords that described relation extents inquiry request is corresponding.
7. a distributed caching range query device, is characterized in that, comprising:
Pretreatment unit, for being used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value;
Inquiry response unit, for in response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding;
Value range acquiring unit, the ident value that the endpoint value for the specified scope according to described at least one field value is corresponding, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding;
Key word acquiring unit, for from the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding.
8. device according to claim 7, it is characterized in that, described pretreatment unit, specifically for by described key word, can be used for the ident value that a kind of field value of range query is corresponding, be stored in advance in the node cycle being arranged in internal memory, wherein, the corresponding node cycle of a kind of field value, an ident value corresponding stored is in a node of node cycle, and be the routing table of each node foundation correspondence in described node cycle, described routing table have recorded the ident value of other nodes one or more determined according to preset Index Algorithm;
Described inquiry response unit comprises:
Search subelement, for in response to receiving relation extents inquiry request, any node in the node cycle that described at least one field value is corresponding, as present node, finds out the ident value that endpoint value apart from specified scope corresponding to described at least one field value is nearest in the routing table of described present node;
First judges subelement, if it is determined that the ident value that to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest of the ident value for finding, using the ident value that finds as ident value corresponding to the endpoint value of specified scope corresponding to described at least one field value;
Second judges subelement, if it is determined that the ident value that not to be the endpoint value of specified scope corresponding apart from described at least one field value in the node cycle that described at least one field value is corresponding nearest of the ident value for finding, present node is updated to the node at the ident value place found, searches subelement described in triggering in the routing table of present node, search the nearest ident value of endpoint value apart from specified scope corresponding to described at least one field value.
9. device according to claim 8, it is characterized in that, described pretreatment unit, specifically for by key word, the ident value that field value that can be used for range query, that belong to same field is corresponding is stored in advance in the node cycle being arranged in internal memory by ident value size order, wherein, described routing table have recorded in described node cycle the ident value of the power side's relation becoming 2 with the ident value spacing of corresponding node.
10. device according to claim 7, is characterized in that, also comprises:
Node adds unit, for for the key word newly added in buffer memory, whether the ident value judging to can be used in the key word that newly adds the field value of range query corresponding has been present in described node cycle, if, can be used in the original key set of ident value corresponding to the field value of range query described in the described key word newly added is added, if not, ident value corresponding for the field value that can be used for range query in the described key word newly added is stored in new node, the node N of the direct precursor node that can be used as new node is found out in described node cycle, the direct precursor node upgrading the immediate successor node of described node N is described new node, upgrade the direct precursor node that described node N is described new node, for described new node sets up corresponding routing table,
Knot removal unit, for for the key word deleted in buffer memory, if the field value that can be used for range query in the field of the key word of described deletion is not present in any other key word, to the node of ident value corresponding to this field value be stored as node to be deleted, the direct precursor node upgrading the immediate successor node of node to be deleted is the direct precursor node of described node to be deleted, deletes described node to be deleted from described node cycle; If there is the key word of described deletion in the original key set of other node cycles, the key word of described deletion is deleted from the original key set of other node cycles described;
And routing update unit, for according to preset Index Algorithm, on by affecting or affect by the deletion of described node to be deleted and need the routing table of renewal to upgrade adding of described new node.
11. devices according to claim 7, is characterized in that, described device is configured in the querying server different from one or more caching server for memory buffers data;
Described device also comprises: data feedback unit, for obtain set of keywords corresponding to described relation extents inquiry request at key word acquiring unit after, downloaded by multithreading and concurrently from one or more caching server described, obtain corresponding data cached of described set of keywords, data cachedly return to the client sending described relation extents inquiry request by what obtain.
12. 1 kinds of distributed caching range query systems, is characterized in that, comprising:
Caching server, has the data cached of mapping relations for storing with key word, receives the data cached inquiry request corresponding for set of keywords that send of querying server, to corresponding data cached of querying server feedback set of keywords;
Querying server, for being used in the key word of mapped cache data, can be used for the ident value that the field value of range query is corresponding, be stored in advance in the storage area of internal memory, and, for each ident value sets up corresponding original key set respectively, wherein, described original key set is made up of the key word including field value corresponding to this ident value; In response to receiving relation extents inquiry request, wherein, described relation extents inquiry request carries the specified scope of at least two kinds of field values, and the specified relationship that described at least two kinds of field values should meet, the ident value that at least two kinds of field values described in finding out from described storage area, the endpoint value of the specified scope of at least one field value is corresponding; The ident value corresponding according to the endpoint value of the specified scope of described at least one field value, finds out the original key set that all ident values in the specified scope of described at least one field value are corresponding; From the original key set found out, at least two kinds of field values described in finding out meet the key word of described specified relationship, obtain the set of keywords that described relation extents inquiry request is corresponding, from described caching server, obtain corresponding data cached of described set of keywords, data cachedly feed back to the client sending described inquiry request by what obtain;
Client, for sending relation extents inquiry request to described querying server, receives the data cached of querying server feedback.
CN201410638522.4A 2014-11-06 2014-11-06 A kind of distributed caching range query method, apparatus and system Active CN105574054B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201410638522.4A CN105574054B (en) 2014-11-06 2014-11-06 A kind of distributed caching range query method, apparatus and system
PCT/CN2015/093311 WO2016070751A1 (en) 2014-11-06 2015-10-30 Distributed cache range querying method, device, and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410638522.4A CN105574054B (en) 2014-11-06 2014-11-06 A kind of distributed caching range query method, apparatus and system

Publications (2)

Publication Number Publication Date
CN105574054A true CN105574054A (en) 2016-05-11
CN105574054B CN105574054B (en) 2018-12-28

Family

ID=55884193

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410638522.4A Active CN105574054B (en) 2014-11-06 2014-11-06 A kind of distributed caching range query method, apparatus and system

Country Status (2)

Country Link
CN (1) CN105574054B (en)
WO (1) WO2016070751A1 (en)

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106777378A (en) * 2017-02-13 2017-05-31 北京小米移动软件有限公司 The method and apparatus for accessing user data
CN107545039A (en) * 2017-07-31 2018-01-05 腾讯科技(深圳)有限公司 The index acquisition methods and device of keyword, computer equipment and storage medium
WO2018059430A1 (en) * 2016-09-27 2018-04-05 新华三技术有限公司 Database searching
CN108090064A (en) * 2016-11-21 2018-05-29 腾讯科技(深圳)有限公司 A kind of data query method, apparatus, data storage server and system
CN108108310A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of data processing method, device and server
WO2018188416A1 (en) * 2017-04-14 2018-10-18 华为技术有限公司 Data search method and apparatus, and related devices
CN111338821A (en) * 2020-02-25 2020-06-26 北京思特奇信息技术股份有限公司 Method, system and electronic equipment for realizing data load balance
CN112597248A (en) * 2020-12-26 2021-04-02 中国农业银行股份有限公司 Big data partition storage method and device
CN113535716A (en) * 2021-06-23 2021-10-22 浙江浙大中控信息技术有限公司 Efficient data storage and query management method

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114625798B (en) * 2020-12-14 2023-03-24 金篆信科有限责任公司 Data retrieval method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102289508A (en) * 2011-08-31 2011-12-21 上海西本网络科技有限公司 Distributed cache array and data inquiry method thereof
US20120317121A1 (en) * 2011-06-09 2012-12-13 Salesforce.Com, Inc. Methods and systems for using distributed memory and set operations to process social networks
US20130173634A1 (en) * 2011-12-30 2013-07-04 Microsoft Corporation Identifying files stored on client devices as web-based search results
CN103853727A (en) * 2012-11-29 2014-06-11 深圳中兴力维技术有限公司 Method and system for improving large data volume query performance
CN103942289A (en) * 2014-04-12 2014-07-23 广西师范大学 Memory caching method oriented to range querying on Hadoop

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120317121A1 (en) * 2011-06-09 2012-12-13 Salesforce.Com, Inc. Methods and systems for using distributed memory and set operations to process social networks
CN102289508A (en) * 2011-08-31 2011-12-21 上海西本网络科技有限公司 Distributed cache array and data inquiry method thereof
US20130173634A1 (en) * 2011-12-30 2013-07-04 Microsoft Corporation Identifying files stored on client devices as web-based search results
CN103853727A (en) * 2012-11-29 2014-06-11 深圳中兴力维技术有限公司 Method and system for improving large data volume query performance
CN103942289A (en) * 2014-04-12 2014-07-23 广西师范大学 Memory caching method oriented to range querying on Hadoop

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018059430A1 (en) * 2016-09-27 2018-04-05 新华三技术有限公司 Database searching
CN108090064A (en) * 2016-11-21 2018-05-29 腾讯科技(深圳)有限公司 A kind of data query method, apparatus, data storage server and system
CN108090064B (en) * 2016-11-21 2021-10-08 腾讯科技(深圳)有限公司 Data query method and device, data storage server and system
CN108108310A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 A kind of data processing method, device and server
CN106777378A (en) * 2017-02-13 2017-05-31 北京小米移动软件有限公司 The method and apparatus for accessing user data
WO2018188416A1 (en) * 2017-04-14 2018-10-18 华为技术有限公司 Data search method and apparatus, and related devices
CN107545039A (en) * 2017-07-31 2018-01-05 腾讯科技(深圳)有限公司 The index acquisition methods and device of keyword, computer equipment and storage medium
CN107545039B (en) * 2017-07-31 2021-05-18 腾讯科技(深圳)有限公司 Keyword index acquisition method and device, computer equipment and storage medium
CN111338821A (en) * 2020-02-25 2020-06-26 北京思特奇信息技术股份有限公司 Method, system and electronic equipment for realizing data load balance
CN112597248A (en) * 2020-12-26 2021-04-02 中国农业银行股份有限公司 Big data partition storage method and device
CN112597248B (en) * 2020-12-26 2024-04-12 中国农业银行股份有限公司 Big data partition storage method and device
CN113535716A (en) * 2021-06-23 2021-10-22 浙江浙大中控信息技术有限公司 Efficient data storage and query management method

Also Published As

Publication number Publication date
CN105574054B (en) 2018-12-28
WO2016070751A1 (en) 2016-05-12

Similar Documents

Publication Publication Date Title
CN105574054A (en) Distributed cache range query method, apparatus and system
CN107247808B (en) Distributed NewSQL database system and picture data query method
US7676453B2 (en) Partial query caching
US10083227B2 (en) On-the-fly determination of search areas and queries for database searches
US8924373B2 (en) Query plans with parameter markers in place of object identifiers
CN106407303A (en) Data storage method and apparatus, and data query method and apparatus
US8949222B2 (en) Changing the compression level of query plans
US8914405B2 (en) Methods and systems for latency-free database queries
US20180129708A1 (en) Query processing management in a database management system
CN105610881B9 (en) Distributed cache range query method, device and system
CN105989015B (en) Database capacity expansion method and device and method and device for accessing database
US20160103858A1 (en) Data management system comprising a trie data structure, integrated circuits and methods therefor
US9734178B2 (en) Searching entity-key associations using in-memory objects
CN112015741A (en) Method and device for storing massive data in different databases and tables
CN109597829B (en) Middleware method for realizing searchable encryption relational database cache
US20140019454A1 (en) Systems and Methods for Caching Data Object Identifiers
CN108563697B (en) Data processing method, device and storage medium
CN103559307A (en) Caching method and device for query
JPWO2012164738A1 (en) Database management system, apparatus and method
KR102253841B1 (en) Apparatus for Processing Transaction with Modification of Data in Large-Scale Distributed File System and Computer-Readable Recording Medium with Program
KR101955376B1 (en) Processing method for a relational query in distributed stream processing engine based on shared-nothing architecture, recording medium and device for performing the method
US20180006885A1 (en) Processing command line templates for database queries
US8805820B1 (en) Systems and methods for facilitating searches involving multiple indexes
US10235432B1 (en) Document retrieval using multiple sort orders
CN102004800A (en) Data query method and device of PDM (Product Data Management) 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
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200922

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Innovative advanced technology Co.,Ltd.

Address before: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee before: Advanced innovation technology Co.,Ltd.

Effective date of registration: 20200922

Address after: Cayman Enterprise Centre, 27 Hospital Road, George Town, Grand Cayman Islands

Patentee after: Advanced innovation technology Co.,Ltd.

Address before: Cayman Islands Grand Cayman capital building, a four storey No. 847 mailbox

Patentee before: Alibaba Group Holding Ltd.