CN107689977A - Distributed caching and the method for routing and its system of push - Google Patents
Distributed caching and the method for routing and its system of push Download PDFInfo
- Publication number
- CN107689977A CN107689977A CN201610638721.4A CN201610638721A CN107689977A CN 107689977 A CN107689977 A CN 107689977A CN 201610638721 A CN201610638721 A CN 201610638721A CN 107689977 A CN107689977 A CN 107689977A
- Authority
- CN
- China
- Prior art keywords
- subregion
- connection
- incidence relation
- service
- maximum
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/10—File systems; File servers
- G06F16/18—File system types
- G06F16/182—Distributed file systems
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L45/00—Routing or path finding of packets in data switching networks
- H04L45/44—Distributed routing
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/01—Protocols
- H04L67/10—Protocols in which an application is distributed across nodes in the network
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/55—Push-based network services
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (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)
- Data Exchanges In Wide-Area Networks (AREA)
Abstract
The invention discloses the method for routing and its system, method of a kind of distributed caching and push to include:The request and the matching strategy of subregion, the request that default requesting party is sent by class interface include service parameter and partitioned parameters;Receive the request that requesting party sends;According to the partitioned parameters and the matching strategy, subregion route is carried out, obtains the partition set for including at least one subregion;According to the partition set, access strategy is generated;According to the partition set and corresponding access strategy, the connection of each subregion in the corresponding partition set is obtained in distributed caching subregion;According to the connection, subregion corresponding to access, returning result corresponding to acquisition;The returning result is fed back into requesting party.The present invention has the advantages that high-performance, high scalability, high availability, high ease for use.
Description
Technical field
The present invention relates to subregion route technology field, more particularly to the method for routing of a kind of distributed caching and push and its
System.
Background technology
With the arriving in big data epoch, in order to alleviate the I/O pressure of traditional database, distributed caching and push are
As essential a solution of numerous distributed structure/architecture.And how to realize industry in terms of distributed caching and push
Vertical/extending transversely, systematicness the dynamic routing of business, the High Availabitity of caching and push node and its ease for use etc.
And become the focus to receive much concern.
And traditional distributed routed customer end frame for relaxing push has its limitation, the overwhelming majority is all simply realized
Simple subregion route, can meet the function on application to a certain extent, but can not meet business it is vertical/laterally expand
Suresh Kumar route in exhibition, and it is intended in terms of the High Availabitity of each routing node to depend on third party's disaster tolerance instrument, and the
Tripartite's disaster tolerance instrument needs individually to be disposed, and complex steps are complicated, and ease for use is not strong, corresponding higher with the requirement of personnel.
In Publication No. CN105357314A Chinese patent open file, it is proposed that one kind fixed point distributed caching system
System and its caching method, including cached configuration module, cache flush module, business datum respond module, cache memory module and
Multiple storage servers, in the storage server allocating cache strategy of each memory node, when user is to having accessed same domain
Storage server sends request of data, and the node takes out the business datum in background server database, and makees cache synchronization
Renewal.Although the program can realize partitioned storage, it can only accomplish that data are random and be scattered in each storage server, nothing
Method accomplishes that special data divides, and the storage and acquisition of cache information all can only be deposited and taken according to single key assignments.
The content of the invention
The technical problems to be solved by the invention are:It is proposed the method for routing of a kind of distributed caching and push and its be
System, has the advantages that high-performance, high scalability, high availability, high ease for use.
In order to solve the above-mentioned technical problem, the technical solution adopted by the present invention is:A kind of distributed caching and the road of push
By method, including:
The request and the matching strategy of subregion that default requesting party is sent by class interface, the request include service parameter with
Partitioned parameters;
Receive the request that requesting party sends;
According to the partitioned parameters and the matching strategy, subregion route is carried out, obtains point for including at least one subregion
Area collects;
According to the partition set, access strategy is generated;
According to the partition set and corresponding access strategy, the corresponding partition set is obtained in distributed caching subregion
In each subregion connection;
According to the connection, subregion corresponding to access, returning result corresponding to acquisition;
The returning result is fed back into requesting party.
The invention further relates to the invention also provides a kind of distributed caching and push route system, including:
Presetting module, for presetting the matching strategy of request that requesting party sent by class interface and subregion, the request
Including service parameter and partitioned parameters;
Receiving module, for receiving the request of requesting party's transmission;
Subregion routing module, for according to the partitioned parameters and the matching strategy, carrying out subregion route, including
The partition set of at least one subregion;
Generation module, for according to the partition set, generating access strategy;
First acquisition module, for according to the partition set and corresponding access strategy, in distributed caching subregion
Obtain the connection of each subregion in the corresponding partition set;
Second acquisition module, for according to the connection, subregion corresponding to access, returning result corresponding to acquisition;
Feedback module, for the returning result to be fed back into requesting party.
The beneficial effects of the present invention are:By default request and the matching strategy of subregion, not only realize distributed slow
The extension on vertically and horizontally is deposited and pushed, and supports the storage, push, the high performance a variety of dynamics subscribed to of cache information
It route partitioned mode;According to different partition sets, using different access strategies, the efficiency and quality of regional addressing can be improved;
A high-performance, high scalability, high availability, the distributed caching of high ease for use and the routing framework of push can be achieved.
Brief description of the drawings
Fig. 1 is the flow chart of a kind of distributed caching of the present invention and the method for routing of push;
Fig. 2 is the structural representation of the routing framework of the embodiment of the present invention one;
Fig. 3 is the step S4 of the embodiment of the present invention one flow chart;
Fig. 4 is the step S5 of the embodiment of the present invention one flow chart;
Fig. 5 is the step S3 of the embodiment of the present invention two flow chart;
Fig. 6 is the method flow diagram of the embodiment of the present invention three;
Fig. 7 is the structural representation of a kind of distributed caching and the route system of push;
Fig. 8 is the system structure diagram of the embodiment of the present invention five.
Label declaration:
100th, integrated service interface administration module;200th, it route zoning ordinance configuration module;300th, it route subregion parsing mould
Block;400th, regional addressing policy module;500th, piecewise connection pond management module;600th, subregion failure sensing module;700th, it is distributed
Formula cache partitions node;
1st, presetting module;2nd, receiving module;3rd, subregion routing module;4th, generation module;5th, the first acquisition module;6th, second
Acquisition module;7th, feedback module;8th, detection module;9th, the 3rd acquisition module;10th, primary module is selected;
101st, the first associative cell;102nd, the second associative cell;103rd, the 3rd associative cell;
301st, the first judging unit;302nd, the first returning unit;303rd, the second judging unit;304th, the second returning unit;
305th, the 3rd returning unit;306th, first acquisition unit;307th, the 3rd judging unit;308th, the 4th returning unit;309th, calculate
Unit;310th, unit is rounded;311st, the 4th judging unit;312nd, the 5th returning unit;313rd, division unit;314th, first perform
Unit;315th, split cells;316th, the second execution unit;317th, the 3rd execution unit;318th, duplicate removal combining unit;
401st, the 6th returning unit;402nd, the 5th judging unit;403rd, the 7th returning unit;404th, the 8th returning unit;
501st, the first receiving unit;502nd, the 6th judging unit;503rd, the 9th returning unit;504th, the 7th judging unit;
505th, the tenth returning unit;506th, unit is waited;507th, the 11st returning unit;
1001st, second acquisition unit;1002nd, arithmetic element;1003rd, the 4th associative cell;1004th, sequencing unit;1005、
3rd acquiring unit;1006th, the 8th judging unit;1007th, closing unit;1008th, the 4th acquiring unit;1009th, unit is removed;
1010th, the 4th execution unit.
Embodiment
To describe the technology contents of the present invention, the objects and the effects in detail, below in conjunction with embodiment and coordinate attached
Figure is explained in detail.
The design of most critical of the present invention is:By in the NameSpace of subregion and class interface, command argument and request
Route key assignments is associated, and realizes Suresh Kumar route of the business vertically, in horizontal extension.
Referring to Fig. 1, a kind of distributed caching and the method for routing of push, including:
The request and the matching strategy of subregion that default requesting party is sent by class interface, the request include service parameter with
Partitioned parameters;
Receive the request that requesting party sends;
According to the partitioned parameters and the matching strategy, subregion route is carried out, obtains point for including at least one subregion
Area collects;
According to the partition set, access strategy is generated;
According to the partition set and corresponding access strategy, the corresponding partition set is obtained in distributed caching subregion
In each subregion connection;
According to the connection, subregion corresponding to access, returning result corresponding to acquisition;
The returning result is fed back into requesting party.
It was found from foregoing description, the beneficial effects of the present invention are:With high-performance, high scalability, high availability, Gao Yi
With property the advantages that.
Further, described " request and the matching strategy of subregion that default requesting party is sent by class interface " is specially:
The unique mark of subregion and the NameSpace of class interface are associated according to default rule, obtain the first association
Relation;
By the command argument in the unique mark of subregion, the NameSpace of class interface and class interface according to default rule
It is associated, obtains the second incidence relation;
By the route key assignments in the unique mark of subregion, the NameSpace of class interface and partitioned parameters according to default rule
Then it is associated, obtains the 3rd incidence relation.
Further, it is described " according to the partitioned parameters and the matching strategy, carry out subregion route, obtain including to
The partition set of a few subregion " is specially:
Judge whether include route key assignments in the partitioned parameters;
If it is not, according to first incidence relation or the second incidence relation, subregion corresponding to return;
If so, judge the type of the key parameters of the route key assignments;
If the type of the key parameters is null value, default default partition is returned;
If the type of the key parameters is singly-bound value, monodrome matching, return pair are carried out according to the 3rd incidence relation
The subregion answered;
If the type of the key parameters is the continuous key assignments in the range of closure section, by the minimum in the closure section
Value and maximum carry out monodrome matching according to the 3rd incidence relation respectively, obtain subregion and maximum pair corresponding to minimum value
The subregion answered;
Judge whether subregion corresponding to the minimum value and subregion corresponding to maximum are consistent;
If consistent, subregion corresponding to subregion corresponding to minimum value or maximum is returned;
If inconsistent, the average of the minimum value and maximum is calculated;
If the average is not integer, the average is rounded downwards;
Judge whether the average is equal to minimum value;
If so, return to subregion corresponding to subregion corresponding to minimum value and maximum;
If it is not, according to the average, the closure section is divided into two closure sections;
Described two closure sections are returned respectively and perform the minimum value and maximum point by the closure section
Monodrome matching is not carried out according to the 3rd incidence relation, obtains the step of subregion corresponding to subregion corresponding to minimum value and maximum
Suddenly;
If the type of the key parameters is polyhybird key assignments, the polyhybird key assignments is split, obtains singly-bound value
With the continuous key assignments in the range of closure section;
For singly-bound value, if the step of type for performing the key parameters is singly-bound value;
For the continuous key assignments in the range of closure section, if the type for performing the key parameters is closure section model
The step of enclosing interior continuous key assignments;
If returning to multiple subregions, duplicate removal merging is carried out to the multiple subregion, obtains partition set.
Seen from the above description, the extension of distributed caching and push on vertically and horizontally can be achieved, and support to cache
The storage of information, push, the high performance a variety of dynamic routing partitioned modes subscribed to.
Further, described " according to the partition set, generating access strategy " is specially:
If the subregion number in the partition set is one, sequential access strategy is returned;
If the subregion number in the partition set is more than one, judge whether include affairs order mark in the service parameter
Will variable;
If so, return to sequential access strategy;
If it is not, return to concurrent access strategy.
Seen from the above description, by the way that according to different subregions quantity and request, using different access strategies, visit can be improved
Ask efficiency and quality.
Further, described " connection that each subregion in the corresponding partition set is obtained in distributed caching subregion " is specific
For:
Receive the request for obtaining piecewise connection;
Judge in the connection pool of the subregion whether available free connection;
If so, return to idle connection;
If nothing, judge whether the connection number in the connection pool of the subregion exceedes default maximum number of connections;
If being not above, new connection is created in the connection pool of the subregion, returns to the new connection;
If exceeding, the Connection Release being used is waited;
If the stand-by period exceedes default maximum latency, empty connection is returned.
Further, before described " according to the connection, subregion corresponding to access ", further comprise:
According to default listening period, the running status of each main service of subregion in distributed caching subregion is detected;
If detecting, the main service of a subregion is broken down, obtain in the subregion from service;
According to main algorithm is selected, from the selection from service one from service as new main service.
Further, it is described " according to selecting main algorithm, from it is described selected from service one from service as main clothes newly
Business " is specially:
Obtain in a subregion main service and from the ip addresses of service and port numbers;
The Instance Name from service is subjected to Hash operation, obtains corresponding integer value;
It will be associated, associated from the integer value of service from the ip addresses of service and port and correspondence are described respectively
Set of relationship;
According to the integer value, the incidence relation set is ranked up;
Obtain first incidence relation in the incidence relation set;
Judge whether survived from service corresponding to first incidence relation;
If so, according to the ip addresses of the main service and port numbers, the company closed in connection pool corresponding to a subregion
Connect;According to described from the ip addresses of service and port numbers, connection is reacquired, and be stored in the corresponding connection pool;
If it is not, first incidence relation is removed in the incidence relation set;Continue executing with described in the acquisition
The step of first incidence relation in incidence relation set.
Seen from the above description, by carrying out fault detect automatically to each subregion, when node failure recovers without people
Work configures;Can be upgraded in time invalid or aging piecewise connection, and high availability is realized on the basis of based on redundancy scheme, no list
Point failure, the automatic discovery of failure is supported, pellucidly implements failover.
Fig. 7 is refer to, the invention also provides a kind of distributed caching and the route system of push, including:
Presetting module, for presetting the matching strategy of request that requesting party sent by class interface and subregion, the request
Including service parameter and partitioned parameters;
Receiving module, for receiving the request of requesting party's transmission;
Subregion routing module, for according to the partitioned parameters and the matching strategy, carrying out subregion route, including
The partition set of at least one subregion;
Generation module, for according to the partition set, generating access strategy;
First acquisition module, for according to the partition set and corresponding access strategy, in distributed caching subregion
Obtain the connection of each subregion in the corresponding partition set;
Second acquisition module, for according to the connection, subregion corresponding to access, returning result corresponding to acquisition;
Feedback module, for the returning result to be fed back into requesting party.
Further, the presetting module includes:
First associative cell, for the unique mark of subregion and the NameSpace of class interface to be carried out according to default rule
Association, obtains the first incidence relation;
Second associative cell, for by the order in the unique mark of subregion, the NameSpace of class interface and class interface
Variable is associated according to default rule, obtains the second incidence relation;
3rd associative cell, for by the road in the unique mark of subregion, the NameSpace of class interface and partitioned parameters
It is associated by key assignments according to default rule, obtains the 3rd incidence relation.
Further, the subregion routing module includes:
First judging unit, for judging whether include route key assignments in the partitioned parameters;
First returning unit, for if it is not, according to first incidence relation or the second incidence relation, returning to corresponding point
Area;
Second judging unit, for if so, judging the type of the key parameters of the route key assignments;
Second returning unit, if the type for the key parameters is null value, return to default default partition;
3rd returning unit, if the type for the key parameters is singly-bound value, entered according to the 3rd incidence relation
Row monodrome matches, subregion corresponding to return;
First acquisition unit, if the type for the key parameters is the continuous key assignments in the range of closure section, by institute
State the minimum value in closure section and maximum carries out monodrome matching according to the 3rd incidence relation respectively, obtain minimum value pair
Subregion corresponding to the subregion and maximum answered;
3rd judging unit, for judging whether subregion corresponding to the minimum value and subregion corresponding to maximum are consistent;
4th returning unit, if for consistent, subregion corresponding to subregion corresponding to return minimum value or maximum;
Computing unit, if for inconsistent, calculate the average of the minimum value and maximum;
Unit is rounded, if being not integer for the average, the average is rounded downwards;
4th judging unit, for judging whether the average is equal to minimum value;
5th returning unit, for if so, returning to subregion corresponding to subregion corresponding to minimum value and maximum;
Division unit, for if it is not, according to the average, the closure section to be divided into two closure sections;
First execution unit, it is described by the closure section for described two closure sections to be returned with execution respectively
Minimum value and maximum carry out monodrome matching according to the 3rd incidence relation respectively, obtain subregion and maximum corresponding to minimum value
Corresponding to value the step of subregion;
Split cells, if the type for the key parameters is polyhybird key assignments, the polyhybird key assignments is torn open
Point, obtain singly-bound value and close the continuous key assignments in the range of section;
Second execution unit, for for singly-bound value, if the type for performing the key parameters is the step of singly-bound value
Suddenly;
3rd execution unit, for for the continuous key assignments in the range of closure section, if performing the key parameters
Type for closure section in the range of continuous key assignments the step of;
Duplicate removal combining unit, if for returning to multiple subregions, duplicate removal merging is carried out to the multiple subregion, obtains subregion
Collection.
Embodiment one
Embodiments of the invention one are:A kind of distributed caching and the method for routing of push, methods described are based on such as Fig. 2 institutes
The routing framework shown, including integrated service interface administration module 100, route zoning ordinance configuration module 200, route subregion parsing
Module 300, regional addressing policy module 400 and piecewise connection pond management module 500, the integrated service interface administration module
100 are connected with applications layer, the connection route subregion parsing module 300 of route zoning ordinance configuration module 200, the road
Taken respectively with the synthesis by subregion parsing module 300, regional addressing policy module 400 and piecewise connection pond management module 500
Business interface administration module 100 is connected, and piecewise connection pond management module 500 is connected with distributed caching partitioned nodes 700;Also
Including subregion failure sensing module 600, the subregion failure sensing module 600 respectively with piecewise connection pond management module
500 and distributed caching partitioned nodes 700 connect.
Wherein, integrated service interface administration module 100 belongs to the inlet module of the present invention, is responsible for receiving asking for application layer
Ask.Externally, there is provided buffer memory and push, subscribing interface based on a variety of route key-value pairs.The route key assignments branch of its interface
4 types are held, dead key value, singly-bound value, the continuous key assignments in the range of closure section is specifically included and a variety of key assignments is hybrid makes
With.Internally, using the concurrent strategy of thread pool, effective acquisition route subregion and regional addressing strategy, and piecewise connection is obtained
And initiate to access, and the result for supporting internal integration subregion to return, the result set after most integrating at last return to application layer.
The information that route zoning ordinance configuration module 200 can carry out a routing configuration rule when system starts adds
Carry, after configuration rule occurs, route zoning ordinance configuration module 200 can carry out Intellisense, and reload routing configuration
Rule.
Regional addressing policy module 400 is responsible for providing the strategy for accessing subregion, including sequential access strategy and concurrently accesses
Strategy;Sequential access strategy is that same thread accesses each subregion according to sequencing, i.e., in the case of multiple subregions, presses
Accessed one by one according to the default sort of subregion, if the one regional addressing exception in midway, interrupts follow-up access;Concurrently access
Strategy initiates to access to each subregion simultaneously for different threads, i.e., in the case of multiple subregions, then with the side of multi-thread concurrent
Formula is initiated to access to multiple subregions simultaneously.
Piecewise connection pond management module 500 manages the connection of all subregions.Can be that each subregion establishes one in inside modules
Individual connection pool, when accessing subregion every time, connection can be used by being taken out all from connection pool corresponding to subregion.The connection of all subregions
All continue to use unified configuration in pond.Configurable parameter has:Maximum number of connections, maximum free time connect number, maximum waits the Connection Time,
Connect maximum idle time and connecting detection time interval, related definition are as follows:
Maximum number of connections:The maximum number of connections amount that piecewise connection pond accommodates;
Maximum idle connection number:The maximum quantity that the piecewise connection is in idle condition is connected, if in detection time
Point discovery be in idle condition (criterion of idle condition be presently attached to it is idle more than the maximum of connection between in parameter
Without practicality) connection exceed the quantity, then can turn off the unnecessary idle occupancy for connecting, reducing resource;
Maximum waits the Connection Time:The time of connection is obtained from connection pool every time, if it exceeds this time is not obtained also
Connection is got, then as connection failure is obtained, exception will be returned to;
Connect maximum idle time:For judging whether connection is in idle condition, if connection exceedes this parameter temporal
All without practicality, then judge that the connection is in idle condition;
Connecting detection time interval:Idle connection how long is detected once for configuring.
Subregion failure sensing module 600 is responsible for monitoring the availability of each subregion, and the subregion to breaking down holds
Calamity switches, and the connection for notifying piecewise connection pond management module 500 to go in connection pool where updating failure subregion.
The operation principle of whole routing framework is as follows:
Integrated service interface administration module receives the request of application layer, please by described in after carrying out logicality judgement and conversion
Ask and be sent to route subregion parsing module;
It route subregion parsing module and receives the request, according to the configuration rule in route zoning ordinance configuration module, enters
Row subregion parses, and returns to qualified partition set to integrated service interface administration module;
Integrated service interface administration module receives and according to the partition set, accesses and divide to regional addressing policy module consulting
The strategy in area;
Regional addressing policy module returns to optimal access strategy to integrated service interface administration module;
Integrated service interface administration module is received and according to the access strategy, obtained by piecewise connection pond management module
Corresponding piecewise connection, initiate to access to subregion, and obtain final result.
Fig. 1 is refer to, the method for the present embodiment comprises the following steps:
S1:The request and the matching strategy of subregion that default requesting party is sent by class interface, the request include business ginseng
Number and partitioned parameters;The service parameter include need store or push business datum and for identification service data whether
Have according to certain tactic affairs sequence indicia variable;The partitioned parameters include route key assignments, i.e., each correspondence business
The mark of data, for example, the route key assignments of CAR SERVICE is vehicle id.
S2:Receive the request that requesting party sends;When receiving request, the validity judgement of parameter can be carried out to the request.
S3:According to the partitioned parameters and the matching strategy, subregion route is carried out, obtains including at least one subregion
Partition set.
S4:According to the partition set, access strategy is generated.
S5:According to the partition set and corresponding access strategy, corresponding described point is obtained in distributed caching subregion
Concentrate the connection of each subregion in area.
S6:According to the connection, subregion corresponding to access, returning result corresponding to acquisition.
S7:The returning result is fed back into requesting party;Before requesting party is fed back to, returning result can also be carried out whole
Close.
Wherein, as shown in figure 3, step S4 comprises the following steps:
S401:Judge whether the subregion number in the partition set is one, if so, step S403 is performed, if it is not, performing
Step S402.
S402:Judge whether include affairs sequence indicia variable in the service parameter, if so, step S403 is performed, if
It is no, perform step S404.
S403:Return to sequential access strategy.
S404:Return to concurrent access strategy.
As shown in figure 4, step S5 comprises the following steps:
S501:Receive the request for obtaining piecewise connection.
S502:Judge in the connection pool of the subregion whether available free connection, if so, step S503 is performed, if it is not, holding
Row step S504.
S503:Return to idle connection.
S504:Judge whether the connection number in the connection pool of the subregion exceedes default maximum number of connections, if it is not, performing
Step S505, if so, performing step S506.
S505:New connection is created in the connection pool of the subregion, returns to the new connection.
S506:The Connection Release being used is waited, performs step S502;If the stand-by period exceedes default maximum wait
Time, return to empty connection.
The present embodiment can realize a high-performance, high scalability, high availability, the distributed caching of high ease for use and push
Routing framework.
Embodiment two
The present embodiment is the further expansion of step S1 and S3 in embodiment one.
In step S1, matching strategy is configuration rule, including following several partitioned modes:
A, the vertical splitting type subregion based on NameSpace, i.e., press the unique mark of subregion and the NameSpace of class interface
It is associated according to default rule, obtains the first incidence relation.The unique mark of subregion can be subregion id.Based on this square partition
Formula, a class interface can represent a kind of business, can carry out division variety classes to business in specific business scenario, a kind of
The corresponding class interface of applied business, by the relation for configuring class interface and subregion id, you can accomplish the data to different business,
Being divided into some subregion for rule, realizes the vertical cutting in business datum.
For example, the applied business of vehicle is defined into an interface class A1, the name sky being located at by configuring A1 interface classes
Between and subregion R1 carry out correspondingly;The applied business of user is defined into an interface class A2, is located at by configuring A2 interface classes
NameSpace and subregion R2 are carried out correspondingly.When user's calling interface class conducts interviews subregion, the life of interface class can be passed through
The name space carries out subregion matching, so as to realize the data buffer storage information of vehicle application business all in R1 subregions, user's applied business
Cache information all in R2 subregions.
B, the read-write separating subregion based on command argument, i.e., by the NameSpace of the unique mark of subregion, class interface with
And the command argument in class interface is associated according to default rule, the second incidence relation is obtained.This partitioned mode is at a points
Expanded on the basis of area's mode, on the basis of a partitioned modes, the order further configured under interface class NameSpace becomes
The matching relationship of amount and subregion is realized.
By taking the applied business of vehicle as an example, define a vehicle application business interface class, it is different from a partitioned modes
In each method specifically called of vehicle application business interface class corresponding to the manner has a command argument right therewith
Should.This partitioned mode is to realize route subregion by configuration order variable and by stages corresponding relation.For example, in vehicle application
The data cached method of vehicle will be read in business interface class with being linked up with the command argument read under NameSpace, by write buffer
Method with being linked up with the command argument write variables under NameSpace, in configuration file, configuration read command arguments are corresponding
Subregion R1, write command variable correspond to subregion R2, subregion R1 and subregion R2 and to do data syn-chronization (i.e. R1 and R2 are for vehicle
The data cached service of business), when the interface class of certain routine call CAR SERVICE service conducts interviews caching, can first it solve
What analysis was called is which method of interface class, and further command argument corresponding to parsing this method, finally parses the command argument
Corresponding subregion, so as to determine the subregion finally to be accessed.Because the method for each business interface class is identical with interface class
Variable is corresponding under NameSpace, so distinct interface class definable identical command argument, will not produce and collide with each other.
C, the horizontal splitting type subregion based on NameSpace, by the unique mark of subregion, class interface NameSpace and
Route key assignments in partitioned parameters is associated according to default rule, obtains the 3rd incidence relation.This partitioned mode is at a points
Expanded on the basis of area's mode, on the basis of a partitioned modes, further by configuring the route value of key and matching somebody with somebody for subregion
Corresponding relation, to realize the cutting in level.
By taking the applied business of vehicle as an example, on the NameSpace for being configured with vehicle application business interface class and the basis of subregion
On, the further corresponding relation for configuring vehicle id and subregion.Such as a vehicle application business interface class A1 is defined, configure this and connect
Subregion corresponding to mouthful class be R1 (default partition as CAR SERVICE), further configures vehicle id and subregion on this basis
Corresponding relation, as vehicle id in 1-30000 in subregion R1, vehicle id (also can root in R2 subregions in 30001-60000
Vehicle id and subregion id configuration is carried out according to other rules, such as to the value configuration corresponding with subregion after vehicle id progress Hash or certainly
Define matched rule of vehicle id and subregion etc.)., can be first to incoming vehicle when vehicle application business interface class is called
Id carries out matching subregion, if being matched according to vehicle id less than suitable subregion, or car is not passed to when calling interface
Id, then can give tacit consent to the default partition for matching automobile-used business, i.e. R1.
E, various ways combined type subregion:The above a, b, c are combined;Wherein same business datum is held by horizontal cutting branch
Systematicness and irregular hash are distributed, and the rule of hash supports scope, modulus, Hash etc. to carry out hash formula distribution, also support certainly
Definition method is hashed.
Based on above-mentioned matching strategy, Fig. 5 is refer to, step S3 comprises the following steps:
S301:Judge whether include route key assignments in the partitioned parameters, if it is not, step S302 is performed, if so, performing step
Rapid S303.
S302:According to first incidence relation or the second incidence relation, subregion corresponding to return;I.e. directly according to interface
The NameSpace or naming variable of calling carry out subregion route.
S303:Whether the type for judging the key parameters of the route key assignments is null value, if so, step S304 is performed, if
It is no, perform step S305.
S304:Return to default default partition.
S305:Whether the type for judging the key parameters of the route key assignments is singly-bound value, if so, step S306 is performed,
If it is not, perform step S307.
S306:Monodrome matching, subregion corresponding to return are carried out according to the 3rd incidence relation.
S307:Whether the type for judging the key parameters of the route key assignments is to close the continuous key assignments in the range of section,
If so, step S308 is performed, if it is not, performing step S315.
S308:Minimum value in the closure section and maximum are subjected to monodrome according to the 3rd incidence relation respectively
Matching, obtain subregion corresponding to subregion corresponding to minimum value and maximum.
S309:Judge whether subregion corresponding to the minimum value and subregion corresponding to maximum are consistent, if so, performing step
S310, if it is not, performing step S311.
S310:Return to subregion corresponding to subregion corresponding to minimum value or maximum.
S311:Calculate the average of the minimum value and maximum;Further, it is right if the average is not integer
The average is rounded downwards.
S312:Judge whether the average is equal to minimum value, if so, step S313 is performed, if it is not, performing step
S314。
S313:Subregion corresponding to returning to subregion corresponding to minimum value and maximum, that is, return to two subregions.For example, closure
Section is [5,6], minimum value 5, maximum 6, and its average is 5.5, is rounded downwards as 5, then average is equal to minimum value,
Meanwhile it was found from above-mentioned steps, subregion corresponding to subregion corresponding to 5 and 6 is inconsistent, therefore return to subregion and 6 correspondences corresponding to 5
Two subregions of subregion.
S314:According to the average, the closure section is divided into two closure sections.For example, closure section is
[1,10], minimum value 1, maximum 10, average 5.5, round downwards as 5, average is unequal with minimum value, therefore
Closure section [1,10] is divided into [1,5] and [5,10].Now, step is performed respectively to two closure sections after division
The above-mentioned type for key parameters of S308-S314, i.e. recursive call is the algorithm of the continuous key assignments in the range of closure section.
S315:I.e. the type of key parameters is polyhybird key assignments, and the polyhybird key assignments is split, obtains singly-bound value
With the continuous key assignments in the range of closure section.
S316:The singly-bound value that selection obtains after splitting, the algorithm that the above-mentioned type for key parameters is singly-bound value is called,
Perform step S306.
S317:The continuous key assignments in the range of closure section that selection obtains after splitting, call above-mentioned for key parameters
Type is the algorithm of the continuous key assignments in the range of closure section, that is, performs step S308-S314.
S318:Judge whether to return to multiple subregions, if so, step S319 is performed, if it is not, performing step S320.
S319:Duplicate removal merging is carried out to the multiple subregion, obtains partition set.
S320:Obtain including the partition set of a subregion.
Before step S318, if being not matched to suitable subregion, default default partition is returned to.
The present embodiment can realize the extension of distributed caching and push on vertically and horizontally, and support depositing for cache information
Storage, push, the high performance a variety of dynamic routing partitioned modes subscribed to.
Embodiment three
Fig. 6 is refer to, the present embodiment is the further expansion of embodiment one, and something in common is not repeated, and difference is,
Before step S6, also comprise the following steps:
S8:According to default listening period, the running status of each main service of subregion in distributed caching subregion is detected;Can
Every default time period 1 (such as 10 seconds, after this parameter determines that subregion sends failure, the speed of switching) toward each point
Area sends a heartbeat detection, with the existing state with judging each subregion.
S9:Judge whether the main service of a subregion breaks down, if so, performing step S10.
S10:Obtain in a subregion main service and from the ip addresses of service and port numbers.
S11:The Instance Name from service is subjected to Hash operation, obtains corresponding integer value.
S12:It will be associated, obtain from the integer value of service from the ip addresses of service and port and correspondence are described respectively
Incidence relation set.
S13:According to the integer value, the incidence relation set is ranked up;Preferably, ascending sort is carried out.
S14:Obtain first incidence relation in the incidence relation set.
S15:Judge whether survived from service corresponding to first incidence relation, if so, step S16 is performed, if it is not,
Perform step S18.
S16:According to the ip addresses of the main service and port numbers, the company closed in connection pool corresponding to a subregion
Connect.
S17:According to described from the ip addresses of service and port numbers, connection is reacquired, and be stored in the corresponding connection
Chi Zhong.
S18:First incidence relation is removed in the incidence relation set, performs step S14.
Preferably, can be every the corresponding of each subregion of past daily record file printout of default time second round (such as 30 seconds)
Ip addresses and port and each subregion switching record (switching of whether breaking down, the former ip of switching and port, the ip after switching
And port).
The present embodiment carries out choosing master after the main service fault of subregion is detected, to it from service, determine one it is new
Main service, the disaster tolerance of subregion failure can be achieved.By carrying out fault detect automatically to each subregion, when node failure recovers without
Need human configuration;Can be upgraded in time invalid or aging piecewise connection, and high availability is realized on the basis of based on redundancy scheme,
Without single point failure, the automatic discovery of failure is supported, pellucidly implements failover.
Example IV
The present embodiment is a specific implementation of above-described embodiment.The present embodiment caches redis and three classes in a distributed manner
Exemplified by applied business, three class applied business are respectively:User's applied business, vehicle application business and insurance applied business, respectively
Implement the application of three kinds of different subregions modes, wherein, user's applied business uses the vertical splitting type subregion based on NameSpace,
Vehicle application business uses the horizontal splitting type subregion based on NameSpace, and insurance business is using the read-write based on command argument point
From formula subregion.Specific implementation step is as follows:
1st, multiple redis buffer memories nodes, i.e. subregion are disposed.The present embodiment disposes 7 redis memory nodes, respectively
For R1, R21, R22, R31, R32, R41 and R42.Wherein R1 is stored to the data cached of user's applied business;R21, R31 are stored
Host node (main service) of the data of different vehicle as storage, the secondary node (from service, from node) that R22 is R21, two
Node data carries out master-slave synchronisation, and the secondary node (from service, from node) that R32 is R31, it is same that two node datas carry out principals and subordinates
Step, when the data cached node of vehicle storage sends failure, corresponding secondary node will be switched to, secondary node can portion
Affix one's name to multiple.R41, R42 are used for data cached, the two node data automatic synchronizations for storing insurance, but R41 nodes are slow dedicated for writing
The operation deposited, R42 realize the separation of read-write dedicated for the operation of read buffer.
2nd, Operational Visit interface class is defined respectively.Operational Visit interface class need inherit embodiment one routing framework in it is comprehensive
The interface base class baseInter that service interface management module provides is closed, the interface base class realizes conventional buffer memory and obtained
The various operating methods taken, can substantially meet the needs of most of business, and each Operational Visit interface class can directly invoke base class
The various methods that interface provides, it is available if the method that existing interface base class provides can not meet the needs of specific business
The basic skills of interface base class carrys out self-defined combination into the method for meeting specific business.By inheriting each Operational Visit of interface base class
Interface class can obtain the various characteristics that integrated service interface administration module provides in the present invention.Each business interface class is defined as:
User traffic interfaces class UserInter, under NameSpace org.com.dr.UserInter;CAR SERVICE interface class
VehicleInter, under NameSpace org.com.dr.VehicleInter;Insurance business interface class
InsuranceInter, under NameSpace org.com.dr.InsuranceInter, and
Org.com.dr.InsuranceInter NameSpaces are given a definition Write and Read command arguments, and make itself and corresponding method
Association.
3rd, subregion routing rule is configured.Increase road under path specified by route zoning ordinance configuration module in the present invention
By partition profile, the partition profile under this path can be by the route zoning ordinance of the present invention when system starts
Configuration module is loaded.It is as follows to route zone configuration rule configuration:
4th, piecewise connection pond parameter is configured.The piecewise connection pond management module of the present invention is responsible for the company of all subregions
Connect, the connection pool of all subregions all continues to use unified configuration.The parameter for needing to configure has:Maximum number of connections, maximum idle connection
Number, maximum wait Connection Time, connection maximum idle time, connecting detection time interval.
5th, the detection palmic rate and node health state status print frequency of subregion failure sensing module are configured.Detect the heart
Frequency hopping rate default value is 10 seconds, and node health state status print frequency is defaulted as 30 seconds.
6th, application program accesses subregion.After having configured subregion routing rule, during application program launching, route of the invention point
Area's rule configuration module will be in load step 3 configuration file (after configuration rule occurs, route zoning ordinance configuration module
Intellisense can be carried out, and reloads routing configuration information), when application program needs the subregion that conducts interviews, and read-write cache
When data, each business interface class defined in step 2 can be directly invoked, carries out regional addressing.Access request will be reached first
The integrated service interface administration module of the present invention, integrated service interface management can transmit the request to route subregion parsing module,
The configuration information progress subregion route of route zoning ordinance configuration module loading can be combined by routeing zoning ordinance configuration module.
7th, the matched routings of specific subregion are carried out.Routeing subregion parsing module upon receiving a request can be first according to route key
Value carry out subregion location algorithm matching, if request in without band route key parameters, docking port call NameSpace and
Command argument directly carries out subregion route.And the subregion matched is returned to integrated service interface administration module.Such as according to step
The rule of rapid 3 configuration, user's applied business data will all be buffered in R1 subregions;Vehicle application business datum will be according to vehicle id
Divided, vehicle id is more than 0 and the data less than or equal to 30000 will be buffered in R21, and data of the vehicle id more than 30000 will
It is buffered in R31 subregions.If vehicle application business without vehicle id, then accesses default partition when accessed cache data
(i.e. the subregion of defaultShards configurations) R21;The data of insurance applied business will carry out subregion route according to command argument,
Operation to Write command arguments will all be routed to R41 subregions, and the operation to Write command arguments will all be routed to R42 points
Area.
8th, the determination of regional addressing strategy is carried out.Integrated service interface administration module after specific subregion is obtained, start to
Regional addressing policy module consulting accesses the strategy (sequential access strategy or concurrent access strategy) of subregion, regional addressing strategy mould
Block returns to optimal access strategy to integrated service interface administration module, and integrated service interface administration module is receiving optimal visit
After asking strategy, the finally connection in the connection pool according to where access strategy obtains corresponding subregion to piecewise connection pond management module.
9th, piecewise connection is obtained.The parameter in the piecewise connection pond configured in step 4 can be partitioned when system starts
Connection pool management module is loaded, when integrated service interface administration module obtains to piecewise connection pond management module to be connected
Wait, piecewise connection pond management module can first judge whether available free connection, connection can be used if then directly returning, if do not had
Have, then judge whether the connection number in the connection pool of current bay exceedes the maximum number of connections of configuration, if being not above maximum
Number is connected, then creates the new connection of current bay, and is added in the connection pool of current bay, while returns to the connection to connection
Ask object.Maximum number of connections if more than, then wait the Connection Release being used to come out and used to current request, if
There is no connection in the range of the maximum latency of configuration, then return to empty connection.While piecewise connection pond management module is also
The connection of free time can be detected.
10th, access subregion and carry out data cached operation.When integrated service interface administration module manages from piecewise connection pond
After obtaining piecewise connection in module, formally initiate to access to subregion, carry out the operation of partition cache data, and obtain each subregion
The result of return.Integrated service interface administration module can be directed to the result returned, once be integrated, and return to a result set
To application layer.
11st, the failover of subregion.The detection palmic rate and section of the configuration subregion failure sensing module configured in step 5
Point health status situation print frequency information, can be partitioned failure sensing module when system starts and be loaded.According to step
In rapid 1 R21, R31 store different vehicle data as storage host node, R22 be R21 secondary node, two nodes
According to master-slave synchronisation is carried out, R32 is R31 secondary node, and two node datas carry out master-slave synchronisation, when vehicle storage is data cached
Node R 21 when send failure, subregion failure sensing module will perceive, and automatically switch to R22 from node, simultaneously
Notice piecewise connection pond management module is refreshed connection pool corresponding to original R21, turns to connection R22 subregions, Yi Housuo
R22 can be connected automatically using the operation for accessing R21 by, which having, goes to access, and realizes the failover of subregion.
Embodiment five
Fig. 8 is refer to, the present embodiment is a kind of distributed caching of corresponding above-described embodiment and the route system of push, is wrapped
Include:
Presetting module 1, for presetting the matching strategy of request that requesting party sent by class interface and subregion, the request
Including service parameter and partitioned parameters;
Receiving module 2, for receiving the request of requesting party's transmission;
Subregion routing module 3, for according to the partitioned parameters and the matching strategy, carrying out subregion route, being wrapped
Include the partition set of at least one subregion;
Generation module 4, for according to the partition set, generating access strategy;
First acquisition module 5, for according to the partition set and corresponding access strategy, in distributed caching subregion
Obtain the connection of each subregion in the corresponding partition set;
Second acquisition module 6, for according to the connection, subregion corresponding to access, returning result corresponding to acquisition;
Feedback module 7, for the returning result to be fed back into requesting party.
The presetting module 1 includes:
First associative cell 101, for by the NameSpace of the unique mark of subregion and class interface according to default rule
It is associated, obtains the first incidence relation;
Second associative cell 102, for by the life in the unique mark of subregion, the NameSpace of class interface and class interface
Make variable be associated according to default rule, obtain the second incidence relation;
3rd associative cell 103, for by the unique mark of subregion, the NameSpace of class interface and partitioned parameters
Route key assignments is associated according to default rule, obtains the 3rd incidence relation.
The subregion routing module 3 includes:
First judging unit 301, for judging whether include route key assignments in the partitioned parameters;
First returning unit 302, for if it is not, according to first incidence relation or the second incidence relation, returning corresponding
Subregion;
Second judging unit 303, for if so, judging the type of the key parameters of the route key assignments;
Second returning unit 304, if the type for the key parameters is null value, return to default default partition;
3rd returning unit 305, if the type for the key parameters is singly-bound value, according to the 3rd incidence relation
Carry out monodrome matching, subregion corresponding to return;
First acquisition unit 306, will if the type for the key parameters is the continuous key assignments in the range of closure section
Minimum value and maximum in the closure section carry out monodrome matching according to the 3rd incidence relation respectively, obtain minimum value
Subregion corresponding to corresponding subregion and maximum;
3rd judging unit 307, for judge subregion corresponding to subregion corresponding to the minimum value and maximum whether one
Cause;
4th returning unit 308, if for consistent, subregion corresponding to subregion corresponding to return minimum value or maximum;
Computing unit 309, if for inconsistent, calculate the average of the minimum value and maximum;
Unit 310 is rounded, if being not integer for the average, the average is rounded downwards;
4th judging unit 311, for judging whether the average is equal to minimum value;
5th returning unit 312, for if so, returning to subregion corresponding to subregion corresponding to minimum value and maximum;
Division unit 313, for if it is not, according to the average, the closure section to be divided into two closure sections;
First execution unit 314, it is described by the closure section for returning to execution respectively to described two closure sections
Interior minimum value and maximum carry out monodrome matching according to the 3rd incidence relation respectively, obtain subregion corresponding to minimum value and
Corresponding to maximum the step of subregion;
Split cells 315, if the type for the key parameters is polyhybird key assignments, the polyhybird key assignments is carried out
Split, obtain singly-bound value and close the continuous key assignments in the range of section;
Second execution unit 316, for for singly-bound value, if the type for performing the key parameters is singly-bound value
Step;
3rd execution unit 317, for for the continuous key assignments in the range of closure section, joining if performing the key assignments
The step of several types is closes the continuous key assignments in the range of section;
Duplicate removal combining unit 318, if for returning to multiple subregions, duplicate removal merging is carried out to the multiple subregion, obtained
Partition set.
The generation module 4 includes:
6th returning unit 401, if being one for the subregion number in the partition set, return to sequential access strategy;
5th judging unit 402, if being more than one for the subregion number in the partition set, judge the service parameter
In whether include affairs sequence indicia variable;
7th returning unit 403, for if so, returning to sequential access strategy;
8th returning unit 404, for if it is not, returning to concurrent access strategy.
First acquisition module 5 includes:
First receiving unit 501, the request of piecewise connection is obtained for receiving;
6th judging unit 502, in the connection pool for judging the subregion whether available free connection;
9th returning unit 503, for if so, returning to idle connection;
7th judging unit 504, if for nothing, it is default to judge whether the connection number in the connection pool of the subregion exceedes
Maximum number of connections;
Tenth returning unit 505, if for being not above, new connection is created in the connection pool of the subregion, returns to institute
State new connection;
Unit 506 is waited, if for exceeding, waits the Connection Release being used;
11st returning unit 507, if exceeding default maximum latency for the stand-by period, return to empty connection.
Also include:
Detection module 8, for according to default listening period, detecting each main service of subregion in distributed caching subregion
Running status;
3rd acquisition module 9, if for detecting that the main service of a subregion is broken down, obtain in the subregion from
Service;
Select primary module 10, for according to selecting main algorithm, from it is described selected from service one from service as main clothes newly
Business.
It is described to select primary module 10 to include:
Second acquisition unit 1001, for obtaining in a subregion main service and from the ip addresses of service and port numbers;
Arithmetic element 1002, for the Instance Name from service to be carried out into Hash operation, obtain corresponding integer value;
4th associative cell 1003, for respectively will be from the ip addresses of service and port and corresponding described from the whole of service
Numerical value is associated, and obtains incidence relation set;
Sequencing unit 1004, for according to the integer value, being ranked up to the incidence relation set;
3rd acquiring unit 1005, for obtaining first incidence relation in the incidence relation set;
8th judging unit 1006, for judging whether survived from service corresponding to first incidence relation;
Closing unit 1007, for if so, according to the ip addresses of the main service and port numbers, closing a subregion pair
Connection in the connection pool answered;
4th acquiring unit 1008, for, from the ip addresses of service and port numbers, reacquiring connection, and deposit according to described
Enter in the corresponding connection pool;
Unit 1009 is removed, for if it is not, removing first incidence relation in the incidence relation set;
4th execution unit 1010, closed for continuing executing with first association obtained in the incidence relation set
The step of being.
In summary, a kind of distributed caching provided by the invention and the method for routing and its system of push, are not only realized
The extension of distributed caching and push on vertically and horizontally, and support the storage, push, the high-performance subscribed to of cache information
A variety of dynamic routing partitioned modes;Can be upgraded in time invalid or aging piecewise connection, and on the basis of based on redundancy scheme
High availability is realized, no single point failure, the automatic discovery of failure is supported, pellucidly implements failover.Whole routing framework pair
Outer to provide single data and administration view, interface is easy to use, when node failure recovers without human configuration, so as to realize
One high-performance, high scalability, high availability, the distributed caching of high ease for use and the routing framework of push.
Embodiments of the invention are the foregoing is only, are not intended to limit the scope of the invention, it is every to utilize this hair
The equivalents that bright specification and accompanying drawing content are made, or the technical field of correlation is directly or indirectly used in, similarly include
In the scope of patent protection of the present invention.
Claims (10)
1. a kind of distributed caching and the method for routing of push, it is characterised in that including:
The request and the matching strategy of subregion, the request that default requesting party is sent by class interface include service parameter and subregion
Parameter;
Receive the request that requesting party sends;
According to the partitioned parameters and the matching strategy, subregion route is carried out, obtains the partition set for including at least one subregion;
According to the partition set, access strategy is generated;
According to the partition set and corresponding access strategy, obtained in distributed caching subregion each in the corresponding partition set
The connection of subregion;
According to the connection, subregion corresponding to access, returning result corresponding to acquisition;
The returning result is fed back into requesting party.
2. distributed caching according to claim 1 and the method for routing of push, it is characterised in that " the default request
The request and the matching strategy of subregion that side is sent by class interface " is specially:
The unique mark of subregion and the NameSpace of class interface are associated according to default rule, obtain the first association pass
System;
Command argument in the unique mark of subregion, the NameSpace of class interface and class interface is carried out according to default rule
Association, obtains the second incidence relation;
Route key assignments in the unique mark of subregion, the NameSpace of class interface and partitioned parameters is entered according to default rule
Row association, obtains the 3rd incidence relation.
3. distributed caching according to claim 2 and the method for routing of push, it is characterised in that described " according to described
Partitioned parameters and the matching strategy, subregion route is carried out, obtains the partition set for including at least one subregion " be specially:
Judge whether include route key assignments in the partitioned parameters;
If it is not, according to first incidence relation or the second incidence relation, subregion corresponding to return;
If so, judge the type of the key parameters of the route key assignments;
If the type of the key parameters is null value, default default partition is returned;
If the type of the key parameters is singly-bound value, monodrome matching is carried out according to the 3rd incidence relation, corresponding to return
Subregion;
If the type of the key parameters for closure section in the range of continuous key assignments, by it is described closure section in minimum value and
Maximum carries out monodrome matching according to the 3rd incidence relation respectively, obtains corresponding to subregion corresponding to minimum value and maximum
Subregion;
Judge whether subregion corresponding to the minimum value and subregion corresponding to maximum are consistent;
If consistent, subregion corresponding to subregion corresponding to minimum value or maximum is returned;
If inconsistent, the average of the minimum value and maximum is calculated;
If the average is not integer, the average is rounded downwards;
Judge whether the average is equal to minimum value;
If so, return to subregion corresponding to subregion corresponding to minimum value and maximum;
If it is not, according to the average, the closure section is divided into two closure sections;
Described two closure sections are returned respectively and perform the minimum value by the closure section and maximum difference root
Monodrome matching is carried out according to the 3rd incidence relation, corresponding to subregion corresponding to acquisition minimum value and maximum the step of subregion;
If the type of the key parameters is polyhybird key assignments, the polyhybird key assignments is split, singly-bound value is obtained and closes
Close the continuous key assignments in interval range;
For singly-bound value, if the step of type for performing the key parameters is singly-bound value;
For the continuous key assignments in the range of closure section, if the type for performing the key parameters is in the range of closure section
Continuous key assignments the step of;
If returning to multiple subregions, duplicate removal merging is carried out to the multiple subregion, obtains partition set.
4. distributed caching according to claim 1 and the method for routing of push, it is characterised in that described " according to described
Partition set, generate access strategy " be specially:
If the subregion number in the partition set is one, sequential access strategy is returned;
If the subregion number in the partition set is more than one, whether judge includes affairs sequence indicia in the service parameter becomes
Amount;
If so, return to sequential access strategy;
If it is not, return to concurrent access strategy.
5. distributed caching according to claim 1 and the method for routing of push, it is characterised in that described " in distribution
The connection of each subregion in the corresponding partition set is obtained in cache partitions " be specially:
Receive the request for obtaining piecewise connection;
Judge in the connection pool of the subregion whether available free connection;
If so, return to idle connection;
If nothing, judge whether the connection number in the connection pool of the subregion exceedes default maximum number of connections;
If being not above, new connection is created in the connection pool of the subregion, returns to the new connection;
If exceeding, the Connection Release being used is waited;
If the stand-by period exceedes default maximum latency, empty connection is returned.
6. distributed caching according to claim 1 and the method for routing of push, it is characterised in that described " according to described
Before connection, subregion corresponding to access ", further comprise:
According to default listening period, the running status of each main service of subregion in distributed caching subregion is detected;
If detecting, the main service of a subregion is broken down, obtain in the subregion from service;
According to main algorithm is selected, from the selection from service one from service as new main service.
7. distributed caching according to claim 6 and the method for routing of push, it is characterised in that described " to be led according to choosing
Algorithm, from the selection from service one from service as new main service " is specially:
Obtain in a subregion main service and from the ip addresses of service and port numbers;
The Instance Name from service is subjected to Hash operation, obtains corresponding integer value;
It will be associated respectively from the ip addresses of service and port and correspondence are described from the integer value of service, obtain incidence relation
Set;
According to the integer value, the incidence relation set is ranked up;
Obtain first incidence relation in the incidence relation set;
Judge whether survived from service corresponding to first incidence relation;
If so, according to the ip addresses of the main service and port numbers, the connection closed in connection pool corresponding to a subregion;Root
According to described from the ip addresses of service and port numbers, connection is reacquired, and be stored in the corresponding connection pool;
If it is not, first incidence relation is removed in the incidence relation set;Continue executing with the acquisition association
The step of first incidence relation in set of relationship.
8. a kind of distributed caching and the route system of push, it is characterised in that including:
Presetting module, for presetting the matching strategy of request that requesting party sent by class interface and subregion, the request includes
Service parameter and partitioned parameters;
Receiving module, for receiving the request of requesting party's transmission;
Subregion routing module, for according to the partitioned parameters and the matching strategy, carrying out subregion route, obtaining including at least
The partition set of one subregion;
Generation module, for according to the partition set, generating access strategy;
First acquisition module, for according to the partition set and corresponding access strategy, being obtained in distributed caching subregion
The connection of each subregion in the corresponding partition set;
Second acquisition module, for according to the connection, subregion corresponding to access, returning result corresponding to acquisition;
Feedback module, for the returning result to be fed back into requesting party.
9. distributed caching according to claim 8 and the route system of push, it is characterised in that the presetting module bag
Include:
First associative cell, for the unique mark of subregion and the NameSpace of class interface to be closed according to default rule
Connection, obtains the first incidence relation;
Second associative cell, for by the command argument in the unique mark of subregion, the NameSpace of class interface and class interface
It is associated according to default rule, obtains the second incidence relation;
3rd associative cell, for by the route key in the unique mark of subregion, the NameSpace of class interface and partitioned parameters
Value is associated according to default rule, obtains the 3rd incidence relation.
10. distributed caching according to claim 9 and the route system of push, it is characterised in that the subregion route
Module includes:
First judging unit, for judging whether include route key assignments in the partitioned parameters;
First returning unit, for if it is not, according to first incidence relation or the second incidence relation, subregion corresponding to return;
Second judging unit, for if so, judging the type of the key parameters of the route key assignments;
Second returning unit, if the type for the key parameters is null value, return to default default partition;
3rd returning unit, if the type for the key parameters is singly-bound value, carried out according to the 3rd incidence relation single
Value matching, subregion corresponding to return;
First acquisition unit, if the type for the key parameters is the continuous key assignments in the range of closure section, closed described
Close the minimum value in section and maximum carries out monodrome matching according to the 3rd incidence relation respectively, obtain corresponding to minimum value
Subregion corresponding to subregion and maximum;
3rd judging unit, for judging whether subregion corresponding to the minimum value and subregion corresponding to maximum are consistent;
4th returning unit, if for consistent, subregion corresponding to subregion corresponding to return minimum value or maximum;
Computing unit, if for inconsistent, calculate the average of the minimum value and maximum;
Unit is rounded, if being not integer for the average, the average is rounded downwards;
4th judging unit, for judging whether the average is equal to minimum value;
5th returning unit, for if so, returning to subregion corresponding to subregion corresponding to minimum value and maximum;
Division unit, for if it is not, according to the average, the closure section to be divided into two closure sections;
First execution unit, the minimum by the closure section is performed for being returned respectively to described two closure sections
Value and maximum carry out monodrome matching according to the 3rd incidence relation respectively, obtain subregion and maximum pair corresponding to minimum value
The step of subregion answered;
Split cells, if the type for the key parameters is polyhybird key assignments, the polyhybird key assignments is split, obtained
Continuous key assignments in the range of singly-bound value and closure section;
Second execution unit, for for singly-bound value, if the step of type for performing the key parameters is singly-bound value;
3rd execution unit, for for the continuous key assignments in the range of closure section, if performing the class of the key parameters
The step of type is closes the continuous key assignments in the range of section;
Duplicate removal combining unit, if for returning to multiple subregions, duplicate removal merging is carried out to the multiple subregion, obtains partition set.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610638721.4A CN107689977B (en) | 2016-08-05 | 2016-08-05 | Routing method and system for distributed caching and pushing |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610638721.4A CN107689977B (en) | 2016-08-05 | 2016-08-05 | Routing method and system for distributed caching and pushing |
Publications (2)
Publication Number | Publication Date |
---|---|
CN107689977A true CN107689977A (en) | 2018-02-13 |
CN107689977B CN107689977B (en) | 2021-12-07 |
Family
ID=61152034
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610638721.4A Active CN107689977B (en) | 2016-08-05 | 2016-08-05 | Routing method and system for distributed caching and pushing |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN107689977B (en) |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109510777A (en) * | 2018-11-09 | 2019-03-22 | 迈普通信技术股份有限公司 | Flow table method of combination, device and SDN controller |
CN109903034A (en) * | 2019-02-28 | 2019-06-18 | 腾讯科技(深圳)有限公司 | Rule matching method, device, computer readable storage medium and computer equipment |
CN110825794A (en) * | 2018-08-14 | 2020-02-21 | 华为技术有限公司 | Partition merging method and database server |
CN111666278A (en) * | 2019-03-06 | 2020-09-15 | 阿里巴巴集团控股有限公司 | Data storage method, data retrieval method, electronic device and storage medium |
CN111913989A (en) * | 2020-06-15 | 2020-11-10 | 东风日产数据服务有限公司 | Distributed application cache refreshing system and method, electronic equipment and storage medium |
CN113590699A (en) * | 2021-07-14 | 2021-11-02 | 车智互联(北京)科技有限公司 | Interface request processing method and system and computing equipment |
CN115757584A (en) * | 2022-11-29 | 2023-03-07 | 广发银行股份有限公司 | System access method based on query interface |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102244685A (en) * | 2011-08-11 | 2011-11-16 | 中国科学院软件研究所 | Distributed type dynamic cache expanding method and system supporting load balancing |
US20140123186A1 (en) * | 2002-05-10 | 2014-05-01 | Convergent Media Solutions Llc | Method and apparatus for browsing using alternative linkbases |
CN105187503A (en) * | 2015-08-07 | 2015-12-23 | 北京思特奇信息技术股份有限公司 | Data partition supporting service connection method and system |
US20160087880A1 (en) * | 2014-09-19 | 2016-03-24 | Facebook, Inc. | Routing network traffic based on social information |
CN105630419A (en) * | 2015-12-25 | 2016-06-01 | 华为技术有限公司 | Partition view sending method of resource pools and management node |
CN105677761A (en) * | 2015-12-30 | 2016-06-15 | 国网信息通信产业集团有限公司 | Data sharding method and system |
-
2016
- 2016-08-05 CN CN201610638721.4A patent/CN107689977B/en active Active
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20140123186A1 (en) * | 2002-05-10 | 2014-05-01 | Convergent Media Solutions Llc | Method and apparatus for browsing using alternative linkbases |
CN102244685A (en) * | 2011-08-11 | 2011-11-16 | 中国科学院软件研究所 | Distributed type dynamic cache expanding method and system supporting load balancing |
US20160087880A1 (en) * | 2014-09-19 | 2016-03-24 | Facebook, Inc. | Routing network traffic based on social information |
CN105187503A (en) * | 2015-08-07 | 2015-12-23 | 北京思特奇信息技术股份有限公司 | Data partition supporting service connection method and system |
CN105630419A (en) * | 2015-12-25 | 2016-06-01 | 华为技术有限公司 | Partition view sending method of resource pools and management node |
CN105677761A (en) * | 2015-12-30 | 2016-06-15 | 国网信息通信产业集团有限公司 | Data sharding method and system |
Cited By (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110825794A (en) * | 2018-08-14 | 2020-02-21 | 华为技术有限公司 | Partition merging method and database server |
CN110825794B (en) * | 2018-08-14 | 2022-03-29 | 华为云计算技术有限公司 | Partition merging method and database server |
US11762881B2 (en) | 2018-08-14 | 2023-09-19 | Huawei Cloud Computing Technologies Co., Ltd. | Partition merging method and database server |
CN109510777A (en) * | 2018-11-09 | 2019-03-22 | 迈普通信技术股份有限公司 | Flow table method of combination, device and SDN controller |
CN109510777B (en) * | 2018-11-09 | 2022-02-22 | 迈普通信技术股份有限公司 | Flow table arranging method and device and SDN controller |
CN109903034A (en) * | 2019-02-28 | 2019-06-18 | 腾讯科技(深圳)有限公司 | Rule matching method, device, computer readable storage medium and computer equipment |
CN111666278A (en) * | 2019-03-06 | 2020-09-15 | 阿里巴巴集团控股有限公司 | Data storage method, data retrieval method, electronic device and storage medium |
CN111666278B (en) * | 2019-03-06 | 2024-03-26 | 阿里巴巴集团控股有限公司 | Data storage method, data retrieval method, electronic device and storage medium |
CN111913989A (en) * | 2020-06-15 | 2020-11-10 | 东风日产数据服务有限公司 | Distributed application cache refreshing system and method, electronic equipment and storage medium |
CN113590699A (en) * | 2021-07-14 | 2021-11-02 | 车智互联(北京)科技有限公司 | Interface request processing method and system and computing equipment |
CN113590699B (en) * | 2021-07-14 | 2023-12-01 | 车智互联(北京)科技有限公司 | Interface request processing method, system and computing device |
CN115757584A (en) * | 2022-11-29 | 2023-03-07 | 广发银行股份有限公司 | System access method based on query interface |
Also Published As
Publication number | Publication date |
---|---|
CN107689977B (en) | 2021-12-07 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN107689977A (en) | Distributed caching and the method for routing and its system of push | |
US8108623B2 (en) | Poll based cache event notifications in a distributed cache | |
CN104965850B (en) | A kind of database high availability implementation method based on open source technology | |
US8484417B2 (en) | Location updates for a distributed data store | |
EP3443471B1 (en) | Systems and methods for managing databases | |
US5873074A (en) | Applying distinct hash-join distributions of operators to both even and uneven database records | |
JP2019518260A (en) | Method, apparatus, computer program product, data center facility for multi-tenant memory service for memory pool architecture | |
US20040243769A1 (en) | Tree based memory structure | |
US20090254523A1 (en) | Hybrid term and document-based indexing for search query resolution | |
WO2010121218A2 (en) | Policy-based storage structure distribution | |
MXPA06009355A (en) | Ultra-shared-nothing parallel database. | |
CN105874758B (en) | Memory pool access method, interchanger and multicomputer system | |
CN107003948A (en) | Electronic equipment and the method for controlling its sharable cache memory | |
US20020023070A1 (en) | Method and system for sharing catalogs in a multiprocessing system utilizing a shared processor | |
US10915370B2 (en) | Inter-host communication without data copy in disaggregated systems | |
CN108536808A (en) | A kind of data capture method and device based on Spark Computational frames | |
US20160078065A1 (en) | Policy-based Storage Structure Distribution | |
CN104484136B (en) | A kind of method of sustainable high concurrent internal storage data | |
CN109726211A (en) | A kind of distribution time series database | |
CN105354319B (en) | For the database connection pool management method and system of the MPP data-base cluster of SN framework | |
CN105988856A (en) | Interpreter memory access optimizing method and device | |
Plattner et al. | Dbfarm: A scalable cluster for multiple databases | |
CN103500126A (en) | Automated fault-tolerant configuration method for cloud computing platform | |
CN109933562A (en) | Server architecture, resource assemblage method and the method for obtaining server sensing data | |
CN105704217B (en) | It is a kind of transparent based on event driven symbiosis virtual machine Dynamic Discovery method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
GR01 | Patent grant | ||
GR01 | Patent grant |