CN109274641A - Connection method and device, calculating equipment and storage medium between client and service node - Google Patents

Connection method and device, calculating equipment and storage medium between client and service node Download PDF

Info

Publication number
CN109274641A
CN109274641A CN201810904734.0A CN201810904734A CN109274641A CN 109274641 A CN109274641 A CN 109274641A CN 201810904734 A CN201810904734 A CN 201810904734A CN 109274641 A CN109274641 A CN 109274641A
Authority
CN
China
Prior art keywords
service
connection
node
client
service node
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201810904734.0A
Other languages
Chinese (zh)
Inventor
孙涛
李洋
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba China Co Ltd
Original Assignee
Guangdong Shenma Search Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangdong Shenma Search Technology Co Ltd filed Critical Guangdong Shenma Search Technology Co Ltd
Priority to CN201810904734.0A priority Critical patent/CN109274641A/en
Publication of CN109274641A publication Critical patent/CN109274641A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/56Provisioning of proxy services
    • H04L67/566Grouping or aggregating service requests, e.g. for unified processing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols

Abstract

The invention discloses connection methods and device between a kind of client and service node, calculating equipment and storage medium.It is connected this method comprises: creating the service of the second quantity for client and the first quantity service node, wherein establish at least one service with each service node in the multiple service node and connect;Application program and service node in response to the client establish the service attachment request of service connection, and selection service connection is from second quantity service connection to be used for the application program.Thus, according to service attachment request, selection can be used for the service connection of application program from the service connection pre-established, will establish the connection between client and service node and goes to backstage from the path of processing service request, to reduce the influence to system response time.

Description

Connection method and device, calculating equipment and storage between client and service node Medium
Technical field
Connection method the present invention relates to network communication technology field, in particular between a kind of client and service node With device, calculating equipment and storage medium.
Background technique
In information flow recommender system, for the refreshing each time of user, the portrait information in conjunction with user, Yong Huli are needed History behavior, dictionary, algorithm prediction model, article the information such as click to user with accurately personalized recommendation in real time.
Above-mentioned each service needs to establish the connection of client to server-side, and the method based on remote procedure call externally mentions For service.It establishes and is generally 6-10 milliseconds in the preferable situation of time-consuming Network status of the process of connection, if Network status becomes Poor then time-consuming has corresponding growth.For the overtime retry mechanism of such service, need to establish connection again before retrying.By This, repeatedly accesses external service and system response time is brought to increase and service whole unstable.
Therefore, there is still a need for a kind of improved service connection scheme.
Summary of the invention
The present invention provides between a kind of client and service node connection method and device, with reduce to system respond The influence of time promotes the stability of integrity service.
According to an aspect of the invention, there is provided the connection method between a kind of client and service node, comprising: be Client and the first quantity service node create the service of the second quantity and connect, wherein in the multiple service node Each service node establishes at least one service connection;Application program and service node in response to the client, which are established, to be serviced The service attachment request of connection, selection service connection is from second quantity service connection to be used for the application program.
The connection between client and server-side will be established as a result, and backstage is gone to from the path of processing service request, from And reduce the influence to system response time.
The second quantity created service connection is put into the connection pool that the client is locally located, wherein from institute Selection service in the service connection of the second quantity is stated to connect may include: from the connection for the step of application program Selection service connection is in pond to be used for the application program.
The service connection for relying on various external services is managed by introducing connection pool device as a result, connection is established in elimination The time-consuming influence to system response time.
Optionally, selection service is connected can wrap the step of being used for the application program from connection pool connection It includes: determining corresponding with service node corresponding with the service attachment request;And the client described in the connection pool with One service connection of selection is at least one service connection between the corresponding with service node to be used for the application program.
It is connected as a result, by being obtained from connection pool, greatly reduces the time-consuming of remote procedure call access phase.
Optionally, the step of determination corresponding with service attachment request corresponding with service node may include: Determine selection strategy corresponding with the service type of the application program;Based on the selection strategy, the determining and service The corresponding service node of connection request.
Optionally, the selection strategy includes at least one of polling schemas, randomized policy, consistency Hash strategy.
The selection to server-side is supported by multiple choices strategy as a result, it is more friendly for stateful service, together When be able to ascend system performance.
Optionally, this method can also include: the increase and/or reduction in response to service node, adjust the connection pool Second quantity service connection;Or second quantity of the adjustment connection pool services connection, to be heat Service of the door service node distribution more than other service nodes connects, and the hot topic service node is right with it in predetermined amount of time The most one or more service nodes of the service attachment request quantity answered.
Optionally, this method can also include: setting or modification second quantity;It is repaired in response to second quantity Change, adjusts the second quantity service connection of the connection pool.
Adjust service connection in real time according to practical situations as a result, in case the performance to service generates any influence.
Optionally, the setting or the step of modifying second quantity may include: based on client receive come From the connection exception information of service node, second quantity is modified.
Optionally, described to be serviced in response to second quantity by second quantity that modification adjusts the connection pool The step of connection may include: to delete clothes corresponding with the connection exception information based on the connection exception information received Business connection.
Adjust the connection status of connection pool, guarantee of doing one's best in time by the external feedback mechanism of application program as a result, It is supplied to the available connection of application program.
Optionally, described the step of being arranged or modifying second quantity may include: based on the service attachment request In include the connection configuration information to service connection, modify second quantity.
Optionally, this method can also include: to be based on the service in the case where previous service is connected as abnormal connect Type redefines service node corresponding with the service attachment request and service connection.
As a result, in the case where connection failure, it can determine whether that time-out retries for the service type of certain services.? In the case where retrying, then corresponding service node and service connection are redefined, with lifting system performance.
Optionally, this method can also include: the attribute information based on the service connection, determine that the service connection is It is no available;And/or based on the heartbeat feedback information received, determine whether the service connection can be used.
Mechanism living is visited by introducing connection pool as a result, the connection status of service connection is safeguarded, and returns as far as possible Give application program available service connection.
According to another aspect of the present invention, the attachment device between a kind of client and service node is additionally provided, comprising: Creating device is connected, for creating the service of the second quantity for client and the first quantity service node and connecting, wherein with institute It states each service node in multiple service nodes and establishes at least one service connection;Connection selecting device, in response to institute The application program and service node of stating client establish the service attachment request of service connection, service and connect from second quantity Middle selection service connection is connect for the application program.
Optionally, which can also include: configuration device, and the second quantity service connection for will be created is put into The connection pool that the client is locally located, wherein the connection selecting device selected from the connection pool service connection with For the application program.
Optionally, the connection selecting device may include: node determining device, ask for determining with service connection Seek corresponding corresponding with service node;And connection selecting device client described in the connection pool with it is described corresponding One service connection of selection is at least one service connection between service node to be used for the application program.
Optionally, the node determining device may include: policy device, for the determining service with the application program The corresponding selection strategy of type;The connection selecting device is based on selection strategy determination and the service attachment request phase Corresponding service node.
Optionally, which can also include: the first adjustment device, for the increase in response to service node and/or subtract It is few, adjust the second quantity service connection of the connection pool;Or the first adjustment device, adjust the institute of the connection pool The service connection of the second quantity is stated, to be connected for popular service of the service node distribution more than other service nodes, the heat Door service node is the most one or more service nodes of service attachment request quantity corresponding in predetermined amount of time.
According to another aspect of the present invention, a kind of calculating equipment is additionally provided, comprising: processor;And memory, thereon It is stored with executable code, when the executable code is executed by the processor, executes the processor as above any Method described in one.
According to another aspect of the present invention, a kind of non-transitory machinable medium is additionally provided, is stored thereon with Executable code executes the processor as described above when the executable code is executed by the processor of electronic equipment Method.
The service connection between client and service node is pre-established as a result, when there is service attachment request, according to answering With the service attachment request of program, it is application program selection service connection from the service connection pre-established, visitor will be established Connection between family end and server-side goes to backstage from the path of processing service request, to reduce to system response time It influences.Further, the multiple choices strategy of the different service types for different application is also supported, it is specific to meet Service request.And spy mechanism living and state feedback mechanisms are introduced, to realize the management to service connection, safeguard preferably systematicness Energy.
Detailed description of the invention
Disclosure illustrative embodiments are described in more detail in conjunction with the accompanying drawings, the disclosure above-mentioned and its Its purpose, feature and advantage will be apparent, wherein in disclosure illustrative embodiments, identical reference label Typically represent same parts.
Fig. 1 shows the schematic diagram of the distributed system for realizing the embodiment of the present invention.
Fig. 2 shows the schematic flow charts of connection method according to an embodiment of the invention.
Fig. 3 shows the schematic flow chart of connection method in accordance with another embodiment of the present invention.
Fig. 4 shows the schematic block diagram of attachment device according to an embodiment of the invention.
Fig. 5 shows the schematic block diagram of attachment device in accordance with another embodiment of the present invention.
Fig. 6 shows the schematic block diagram according to an embodiment of the invention for calculating equipment.
Specific embodiment
The preferred embodiment of the disclosure is more fully described below with reference to accompanying drawings.Although showing the disclosure in attached drawing Preferred embodiment, however, it is to be appreciated that may be realized in various forms the disclosure without the embodiment party that should be illustrated here Formula is limited.On the contrary, these embodiments are provided so that this disclosure will be more thorough and complete, and can be by the disclosure Range is completely communicated to those skilled in the art.
In information flow recommender system, for the refreshing each time of user, the portrait information in conjunction with user, Yong Huli are needed History behavior, dictionary, algorithm prediction model, article the information such as click to user with accurately personalized recommendation in real time.
Above-mentioned each information is all made of the mode of independent deployment, horizontal extension, the data of each Self management oneself, and passes through long-range The method of the invocation of procedure externally provides service.Recommender system is during processing request every time, or in backstage index upgrade During, it requires to rely on the result that the above service call returns.
Need to establish the connection of client to server-side before remote procedure call, in the relatively good feelings of same network of computer room situation Under condition, the time-consuming of this process is generally 6-10 milliseconds, and time-consuming has corresponding growth if Network status is deteriorated.
User's portrait, dictionary, algorithm prediction model etc. belong to crucial service and rely on, can be to recommendation if shortage of data Effect generates strong influence, seriously affects user experience.Therefore, the calling for such service has overtime retry mechanism, And need to establish the connection of client to server-side before retrying again.
Recommender system belongs to high concurrent, low delay type application, requests every time, the response time of system is on 180 milliseconds of left sides It is right.It can be seen that once retrying if had occurred during some remote procedure call, the time-consuming for establishing connection may 9% or so of overall response time is accounted for, the response time of system is seriously affected.
Since server-side mostly uses horizontal extension mode to dispose, when retrying, need to reselect server-side, and it is different Service has different selection strategies, and it will cause server exceptions for selection mistake, it is also possible to cause server-side snowslide, seriously affect Systematic entirety energy.
In view of this, the invention proposes between a kind of client and service node connection method and device, according to clothes Be engaged in connection request, from pre-establish service connection in selection can be used for application program service connection, will establish client with Connection between server-side goes to backstage from the path of processing service request, to reduce the influence to system response time. And it introduces spy mechanism living and state feedback mechanisms and safeguards better system performance to realize to the management of service connection.
The connection scheme between the accompanying drawings and embodiments client that the present invention will be described in detail and service node will be combined as follows.
Fig. 1 shows the schematic diagram of the distributed system for realizing the embodiment of the present invention.
As shown in Figure 1, distributed system of the invention can be recommender system, which may include 10 kimonos of client Business end 20.
Client 10 can be any suitable electronic equipment for carrying out network access, including but not limited to intelligence electricity Words, notebook computer or desktop computer etc..It is equipped in client 10 and is able to carry out a variety of using journey of network access Sequence (Application), the application program (following referred to as to apply) can include but is not limited to be social category APP, communication class APP, Domestic News class APP, life kind APP, audio-visual class APP etc..
Server-side 20 then includes that can access to provide any server of interactive service information needed by network, be can be The cluster server of distributed system.Server-side 20 is deployed with multiple service nodes 21, and multiple service nodes 21 can be deployed in On the same server, it can also be deployed in respectively in different servers.
Service node 21 can provide resource using the server where it and run task, what multiple service nodes were run Task can belong to multiple and different application groups, and the service node in each application group can be used for application-specific.This In, " applying group " can indicate one group of service node for same application.For example, distributed system can be directed to recommendation business Distributed recommender system different recommendation application groups can be set for different recommended or recommendation, such as can be with Picture is arranged to recommend to recommend to recommend application group etc., the clothes in system using group, advertisement using group, video recommendations application group, novel Although business node can be used in executing recommendation task, but different recommendations can execute corresponding classification using the server node in group Search mission.In addition, it will be appreciated that distributed system of the invention can be used for any number of applications, each application can be with One or more service nodes are eachd relate to, and the service node quantity for different application can be the same or different.
Line in attached drawing indicates presence service connection or information exchange between client and server-side, this is connected as can Carry out any type of connection of information transmission.
In one embodiment, client 10 can be received via the service connection of network implementations and server-side 20 or information Hair.Content needed for server-side 20 can obtain client by access database.It can also be via between multiple client Network communicates with one another.Network can be sensu lato network for information transmitting, may include one or more communication networks, Cordless communication network, internet, private domain net, local area network, Metropolitan Area Network (MAN), wide area network or cellular data network etc..At one In embodiment, network also may include satellite network, thus send the GPS signal of client 10 to server-side 20.
In addition, though it is shown that single client 10 and single server-side 20 in figure, and be directed in the description that follows Single client or server-side are described, but those skilled in the art are it will be appreciated that client of the invention is intended to table Show great amount of terminals equipment present in live network, the individual server shown is intended to indicate that technical solution of the present invention is related to taking The operation of business device.Terminal and individual server and database to particular number are described in detail to illustrate convenience, and Non- hint is to concrete restrictions such as concrete type or positions.
User can issue the service attachment request for establishing service connection to server-side based on the application program of client-side, Server-side is based on service node and service connection and provides service to the application program.
In the technical solution of this paper, although what is be related to is that the service established between " application program " and server-side connects in fact It connects, but since " application program " is mounted in client-side, it then herein can be by foundation " application program " and server-side Service connection, is equal to foundation " client " and connect with the service of server-side.
As follows with reference to the accompanying drawings and the embodiment client that the present invention will be described in detail and connection will be established between service node Scheme.
Fig. 2 shows showing for the connection method according to an embodiment of the invention established between client and service node Meaning property flow chart.
As shown in Fig. 2, being that client and the first quantity service node create the service of the second quantity in step S210 Connection, wherein establish at least one service with each service node in the multiple service node and connect.
Client is above-mentioned referring to single client equipment described in Fig. 1.Service node is the cluster clothes of distributed system The service node being engaged in device, the first quantity can be the quantity of whole serving nodes of distributed system, or can be The client provides the quantity of the special services node of service.
Second quantity is the total quantity of whole service connections between the client established and service node, and the second quantity can To be greater than or equal to the first quantity.In a preferred embodiment, the numerical value of the second quantity is configurable, such as can be by user certainly By configuring, default value (such as 100) or empirical value can also be used, can also be configured based on actual request amount.For example, system Per second to need to handle 20 requests, each request requires 1 available service and connects to access external service, then the second quantity It needs at least to be configured to 20.
The quantity of service connection between client and each service node can be the same or different, and the present invention is to visitor The specific distribution of service connection between family end and each service node is with no restrictions.
In one embodiment, above-mentioned second quantity can be based on, be followed successively by each service node establish with client it Between service connection.
It in one embodiment, can also be that the biggish service node of service request amount is established according to network service requirement Greater number of service connection establishes small number of service connection for the lesser service node of service request amount.
When the application requests of user via the client and thereon service, in step S220, in response to client Application program and service node establish service connection service attachment request, from the second quantity service connection in selection service Connection is to be used for the application program.
Wherein, client can be used remote procedure call (Remote Procedure Call, RPC) and send out to server-side The service attachment request of the service connection between application program and service node is established out, and then is based on the service attachment request, Determine corresponding with service attachment request corresponding with service node, and service from above-mentioned second quantity connect in client with it is right Answering at least one service connection between service node selects one or at least one service connection for the application program.
Corresponding with service node is service node corresponding with the client or application program, each client or is each answered It can have at least one corresponding with service node with program.
In a preferred embodiment, corresponding with service node can be based on application program service type determine.Its In, service type is type of the client to the requested service of server-side.
It specifically, may include the corresponding service class of service of the application program or its request in above-mentioned service attachment request Type can determine selection strategy corresponding with the service type according to the service type, be based on the selection strategy, determines and services The corresponding service node of connection request.
In information flow recommender system, for the refreshing each time of user, the portrait information in conjunction with user, Yong Huli are needed History behavior, dictionary, algorithm prediction model, article the information such as click in real time and provide a user the recommendation for being best suitable for user interest.Needle To above- mentioned information, service type may include the service of user's portrait, dictionary services, algorithm prediction model service etc..For difference Service type, need to select corresponding service node to provide service in server-side.May include in service attachment request to A kind of few service type.
Selection strategy can include but is not limited to be polling schemas, randomized policy, consistency Hash strategy etc..
The realization of polling schemas is fairly simple, different counters is used respectively for every dimension, in counter It needs using atomic operation during the increasing.
Randomized policy is common random selection or is randomly assigned strategy.
Consistency Hash strategy, by the way that all service nodes and its Virtual Service node are created as Hash ring, to user Unique identification carry out Hash operation obtain corresponding user's cryptographic Hash, changed based on user's cryptographic Hash and Hash, clockwise will User distributes to corresponding with service node, so that the request of same user can be fallen on identical service node.It is saved in service In the case that reallocation has occurred in point and Virtual Service node, then Hash ring will do it corresponding reconstruction.
Technical solution of the present invention also supports more services selection strategies to meet different service-specific requirements, for difference Service type, can determine that corresponding with service node services connection using different selection strategies, to avoid delay, be promoted The performance of system.
It being serviced for example, drawing a portrait for user, more service nodes are isomorphism in data, therefore, polling schemas Selection applied to the service.
For example, data acquisition depends on the persistent storage (such as database) and server-side in downstream for dictionary services Local cache.There is the case where shake when concurrency is larger in rear end persistent storage, the delay for reading data reaches as high as 300 More milliseconds, and then cause recommender system overtime when accessing dictionary services.
Dictionary services can write local cache after the data for reading persistence, if the request that retries of user cannot be again It is secondary to fall in identical server-side, it will lead to the above request timed out process of repetition.If the request of a user can always be fallen On identical dictionary services node, then cache hit rate will greatly improve.
Therefore, for dictionary services, relative complex selection strategy, such as consistency Hash strategy can be used, and is drawn Enter Virtual Service node to ensure to give, to ensure that caching is hit in the similar request of same subscriber for the second time, greatly reduces access The overtime rate of external service, while avoiding individually servicing server-side snowslide caused by exception.
The selection to server-side is supported by multiple choices strategy, it is more friendly for stateful service, while can Lifting system performance.
After determining corresponding with the service type of application program corresponding with service node, polling schemas can be used, from above-mentioned One service of selection at least one service connection in the service connection of second quantity between client and corresponding with service node Connection is to be used for the application program.
If the creation process of above-mentioned connection carries out during request is handled, the time-consuming institute of each request is increased Time is at least the time (6-10 milliseconds) that the number * for connecting and establishing connects consuming every time.Currently, recommender system is in request path The external service of upper dependence at least 5, in the worst cases, the total time-consuming of access phase can reach 50 milliseconds.
The present invention is connected by the above-mentioned service pre-established between client and server-side, will establish the mistake of service connection Journey is transferred to backstage from the path of processing request, and selection service connection is time-consuming less than 1 millisecond every time, greatly reduces long-range The time-consuming of invocation of procedure access phase, to reduce the influence to system response time.
In addition, the service of user's portrait, dictionary, algorithm prediction model service etc. belong to key in information flow recommender system Service rely on, if shortage of data can generate very big influence to the effect of recommendation, seriously affect user experience.So needle Overtime retry mechanism is had to the calling of such service, and the service for needing to establish client and server-side before retrying again connects It connects.
Therefore, in a preferred embodiment, in the case where previous service is connected as abnormal connect, it can also check and return Value is returned, and determines whether to retry based on service type.In the case where determining retry, above-mentioned selection service connection can also be repeated Process, redefine service node corresponding with service attachment request and service connection.
In addition, in a preferred embodiment, it can also be above-mentioned to realize by establishing connection pool device in client-side Establish the scheme that client is connect with server-side.
Fig. 3 shows the schematic flow chart of connection method in accordance with another embodiment of the present invention.
As shown in figure 3, being that client and the first quantity service node create the service of the second quantity and connect in step S310 It connects, wherein establish at least one service with each service node in the multiple service node and connect.
In step S320, the second quantity created service connection is put into the connection pool that client is locally located.Its In, the client of any need access server can have the connection pool of oneself.
In step S330, the service that application program and service node in response to client establish service connection, which connects, is asked It asks, selection service connection is from connection pool to be used for the application program.
Wherein, it is based on service attachment request, can first determine corresponding with service corresponding with the service attachment request Node, and selected at least one service connection between the client described in the connection pool and the corresponding with service node One service connection is to be used for the application program.
Specifically, it is based on service attachment request, it is first determined selection strategy corresponding with the service type of application program, Based on the selection strategy, determine service node corresponding with service attachment request, later, from connection pool client with it is right One service of selection at least one service connection between service node is answered to connect for the application program.
In a preferred embodiment, above-mentioned connection pool can be template realization.In connection pool initialization, can be based on The service type of client/application specifies the parameters such as corresponding selection strategy, service connection quantity, access time-out.Into And in system operation, service connection can be selected according to specific selection strategy, and initiate remote procedure call.
All service connections can be connected pond and are managed based on two dimensions.First dimension is service node, Second dimension is the service connection for service node actual creation.In step S330, more options strategy is supported, to the The service node of one dimension is selected, i.e., corresponding with service node corresponding with the service type of application program.
Choosing after determining that corresponding with service node is chosen, to the service connection between client and the corresponding with service node It selects, it can meet demand using polling schemas.
Specific embodiment can be found in the associated description of above-mentioned combination Fig. 2, and details are not described herein.
As a result, by connection pool device come the connection of the various external services relied in managing distributing type system, elimination is built The time-consuming influence to system response time of the service connection of vertical client and server-side.
In addition, connection pool device can also be by realizing the management of itself or the service connection that the connection pool is added Maintenance to the state of service connection.
In connection pool initial phase, can be established for client with each service node identical by the way of balanced The service of quantity is established.
For example, it is assumed that the first quantity is M, that is, certain external service for servicing dependence has M service node, and the second quantity is N, Need to establish N number of service connection in total, then N/M connection can be established for each service node by connecting pool device.N cannot In the case where being divided exactly by M, then N-N%M service connection can be established for each service node, and remaining N%M services Connection can then be followed successively by each service node creation.
Specific creation method is connected, can be realized based on the RPC frame of general RPC frame or particular system.By Belong to a part of system starting in the initialization of connection pool, therefore the time that should be expended in the process on connection is established will not be right The performance of service generates any influence.
After connection pool is set up, if the service node of server-side there is a situation where online or offline, connection pool can be with In response to the increase and/or reduction of service node, the second quantity service connection of connection pool is adjusted.
Specifically, which service node connection pool can calculate to need online, which service node to need offline, and again Calculate the number for the service connection that each service node needs actually to establish.It wherein, will not in creation new demand servicing connection procedure Influence the serviceability of original service connection.
In addition, after connection pool is set up, if during system operation certain services presence such as dilatation capacity reducing, Address of service more demand is replaced, then newest service node list and service connection number amount can be passed into connection pool.
In turn, the second quantity service connection of connection pool is adjusted, to be more than it for popular service node distribution The service of its service node connects.Wherein, popular service node is service attachment request number corresponding in predetermined amount of time The most one or more service nodes of amount.Wherein, it will not influence original service connection in creation new demand servicing connection procedure Serviceability.
As previously mentioned, the second quantity is configurable.Therefore, method of the invention can also include described in setting or modification Second quantity.Here, the second quantity can be configured in connection pool initial phase, it can also be in system operation based on service Demand reconfigures or modifies the second quantity, is also based on the availability of established service connection come described in configuring or modifying Second quantity.Later, it can be modified in response to the second quantity, adjust the second quantity service connection of connection pool.
If apply using service connect during exception has occurred, can by connection pool provide interface into Row state feedback.
In a preferred embodiment, the connection exception information from service node that can be received based on client is repaired Change second quantity, and based on the connection exception information received, deletes service corresponding with the connection exception information Connection.
Application program is after using initiation remote procedure call is connected, if server-side returns the abnormal correlation of connection The information can be fed back to connection pool by information, can in time be connected the service and be removed by connection pool, the service is avoided to connect Connecing may be reused by subsequent service attachment request, and then guarantee the availability of the service connection for application program selection.
The connection status for adjusting connection pool in time by the external feedback mechanism of application as a result, guarantee of doing one's best provide To using available connection.
In a preferred embodiment, can be matched based on the connection to service connection for including in the service attachment request Confidence breath, modifies second quantity.
Here, the connection configuration information for including in service attachment request, for example, can be user request service when again Second quantity of configuration or modification is also possible to during system is run based on certain services there are dilatation capacity reducing, more Change the second quantity that address of service more demand etc. need to be configured or be modified.
Various exceptions can occur due to network etc. after service connection is established, in order to find as early as possible and solve exception Service connection, connection pool device can introduce spy mechanism living.Spy mechanism living can be placed on (client) running background, no The disconnected connection status to service connection is detected and is safeguarded, and guarantee of trying one's best returns to the available service of application program Connection.
Here it is possible to the health examination for carrying out two levels is connected to service, the availability connected with monitoring service.
The health examination of first level can be general inspection, based on the attribute information of service connection, such as service The state etc. for connecting itself, determines whether the service connection can be used.
Attribute information based on service connection carries out the mode of availability judgement, can satisfy under most of scene available Property judgement demand, but newly-established service connect except.Due to needing certain network delay when newly establishing service connection, because This have " in connection " as state, this kind connection can become " in connection " or " disconnected " state after certain time-delay.
Therefore, the health examination that can introduce second level sends heartbeat message, and base from connection pool to service node In the heartbeat feedback information received, determine whether the service connection can be used.Service connection can simply be divided by which There is response and without response two types, having heartbeat feedback information is to have response, can be used it may be considered that the service connects, and nothing Heartbeat feedback information is without response, then it is believed that service connection is unavailable.
Not available service is connected, can be removed it in time, returns to being available for application program to ensure Service connection.
The spy work of above-mentioned connection pool can be independent background thread, and can periodically carry out.Connection pool is visiting work The operation needs of service connection are connected with policy selection in the process and are written and read protection, concurrent bring thread-safe is avoided to ask Topic.
In addition, the service of user's portrait, dictionary, algorithm prediction model service etc. belong to key in information flow recommender system Service rely on, if shortage of data can generate very big influence to the effect of recommendation, seriously affect user experience.So needle Overtime retry mechanism is had to the calling of such service, also has overtime retry mechanism for the calling of certain services, and is retried The preceding service connection for needing to establish client and server-side again.
Therefore, in a preferred embodiment, in the case where previous service is connected as abnormal connect, feedback information is to company Pond is connect, connection pool is allowed to decide whether to retry according to service type.In the case where determining retry, connection pool can also be weighed The process of multiple above-mentioned selection service connection, redefines service node corresponding with service attachment request and service connection.
The present invention supports shifty RPC connection pool by using a kind of as a result, to solve to need in service process repeatedly It accesses the increase of external service bring system response time and service is whole unstable.
So far, it has been combined Fig. 2-3 and the method establishing client and connecting with server-side of the invention is described in detail.
In addition, the scheme connecting between client and service node of establishing of the invention can also be real by a kind of attachment device It is existing.
Fig. 4 shows the structural block diagram of attachment device according to an embodiment of the invention.Wherein, the function of attachment device 400 Energy module can be realized by the combination of the hardware of the realization principle of the invention, software or hardware and software.Those skilled in the art It is understood that Fig. 4 described function module can combine or be divided into submodule, to realize foregoing invention Principle.Therefore, description herein can support to functions described herein module it is any it is possible combination or division, Or further restriction.
Attachment device 400 shown in Fig. 4 can be used to realize Fig. 2 or list generation method shown in Fig. 3, below only even The operation that the functional module and each functional module that connection device 400 can have can execute is described briefly, for wherein relating to And detail section may refer to the description above in association with Fig. 2-3, which is not described herein again.
As shown in figure 4, the attachment device 400 between client and service node of the invention, may include connection creation Device 410 and connection selecting device 420.
Connection creating device 410 can be used for creating the service of the second quantity for client and the first quantity service node Connection, wherein establish at least one service with each service node in the multiple service node and connect.
Connection selecting device 420 can be used for connecting in response to application program and the service node service of establishing of the client The service attachment request connect, selection service connection is from second quantity service connection to be used for the application program.
Fig. 5 shows the structural block diagram of attachment device in accordance with another embodiment of the present invention.
As shown in figure 5, attachment device 400 of the invention can also include configuration device 430.
The second quantity service connection that configuration device 430 can be used for be created is put into the client and is locally located Connection pool, wherein connection selecting device 420 can be selected from the connection pool service connection with for described using journey Sequence.
In a preferred embodiment, connection selecting device 420 may include node selection device (not shown).
Node determining device is determined for corresponding with service node corresponding with the service attachment request.Connection choosing A clothes can be selected at least one service connection between client in connection pool and corresponding with service node by selecting device 420 Business connection is to be used for the application program.
In a preferred embodiment, node determining device can also include policy device (not shown).
Policy device is determined for selection strategy corresponding with the service type of the application program.Connection selection Device 420 can determine service node corresponding with the service attachment request based on the selection strategy.
In a preferred embodiment, which can also include the first adjustment device and second adjustment device.
The first adjustment device can be used for the increase and/or reduction in response to service node, adjust the institute of the connection pool State the service connection of the second quantity.
Second quantity of the adjustable connection pool of second adjustment device services connection, to be hot topic service Service of the node distribution more than other service nodes connects, and the hot topic service node is clothes corresponding in predetermined amount of time The most one or more service nodes of connection request quantity of being engaged in.
It should be understood that the description to " first " and " second " here, it is intended to description object is distinguish, rather than it is right Its sequence and size have any regulation expressed or implied.The first adjustment device and second adjustment device can also be multiplexed.
In a preferred embodiment, which can also include that setting device and third adjust device.
Setting device can be used for being arranged or modifying second quantity.
Third adjustment device can be used for being modified in response to second quantity, adjust described the second of the connection pool Quantity service connection.
In a preferred embodiment, the connection from service node which can be received based on client Exception information modifies second quantity.Third adjust device can based on the connection exception information received, delete with it is described Connect the corresponding service connection of exception information.Wherein, third adjustment device can also adjust device multiplexing with first/second.
In a preferred embodiment, which can connect service based on include in the service attachment request The connection configuration information connect modifies second quantity.Configuration device can recalculate each service node and need practical establish Connection number, and the service connection of newly created predetermined quantity is put into the connection pool that the client is locally located.
In a preferred embodiment, which can also include that connection retries device (not shown).
Connection, which retries device, can be used for being based on the service class in the case where previous service is connected as abnormal connect Type redefines service node corresponding with the service attachment request and service connection.
In a preferred embodiment, which can also include availability judgment means.
Availability judgment means can be used for the attribute information based on the service connection, whether determine the service connection It can use.Alternatively, the availability judgment means can be used for determining that the service connection is based on the heartbeat feedback information received It is no available.
So far, it has been combined attached drawing 4-5 and the service established between client and service node of the invention is described in detail The attachment device of connection.
Fig. 6 shows the structural representation that an embodiment according to the present invention can be used for realizing the calculating equipment of above-mentioned connection method Figure.
Referring to Fig. 6, calculating equipment 600 includes memory 610 and processor 620.
Processor 620 can be the processor of a multicore, also may include multiple processors.In some embodiments, Processor 620 may include a general primary processor and one or more special coprocessors, such as graphics process Device (GPU), digital signal processor (DSP) etc..In some embodiments, the circuit reality of customization can be used in processor 620 It is existing, such as application-specific IC (ASIC, Application Specific Integrated Circuit) or scene Programmable gate array (FPGA, Field Programmable Gate Arrays).
Memory 610 may include various types of storage units, such as Installed System Memory, read-only memory (ROM), and forever Long storage device.Wherein, ROM can store the static data of other modules needs of processor 620 or computer or refer to It enables.Permanent storage can be read-write storage device.Permanent storage can be after computer circuit breaking not The non-volatile memory device of the instruction and data of storage can be lost.In some embodiments, permanent storage device uses Mass storage device (such as magnetically or optically disk, flash memory) is used as permanent storage.In other embodiment, permanently deposit Storage device can be removable storage equipment (such as floppy disk, CD-ROM drive).Installed System Memory can be read-write storage equipment or The read-write storage equipment of volatibility, such as dynamic random access memory.Installed System Memory can store some or all processors The instruction and data needed at runtime.In addition, memory 610 may include the combination of any computer readable storage medium, Including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read only memory), disk and/or CD can also use.In some embodiments, memory 610 may include that removable storage that is readable and/or writing is set It is standby, for example, laser disc (CD), read-only digital versatile disc (such as DVD-ROM, DVD-dual layer-ROM), read-only Blu-ray Disc, Super disc density, flash card (such as SD card, min SD card, Micro-SD card etc.), magnetic floppy disc etc..It is computer-readable to deposit It stores up medium and does not include carrier wave and the momentary electron signal by wirelessly or non-wirelessly transmitting.
It is stored with executable code on memory 610, when executable code is handled by processor 620, can make to handle Device 620 execute address above establish the method connecting between client and service node.
The company according to the present invention established between client and service node above is described in detail by reference to attached drawing The scheme connect.
In addition, being also implemented as a kind of computer program or computer program product, the meter according to the method for the present invention Calculation machine program or computer program product include the calculating for executing the above steps limited in the above method of the invention Machine program code instruction.
Alternatively, the present invention can also be embodied as a kind of (or the computer-readable storage of non-transitory machinable medium Medium or machine readable storage medium), it is stored thereon with executable code (or computer program or computer instruction code), When the executable code (or computer program or computer instruction code) by electronic equipment (or calculate equipment, server Deng) processor execute when, so that the processor is executed each step according to the above method of the present invention.
Those skilled in the art will also understand is that, various illustrative logical blocks, mould in conjunction with described in disclosure herein Block, circuit and algorithm steps may be implemented as the combination of electronic hardware, computer software or both.
The flow chart and block diagram in the drawings show the possibility of the system and method for multiple embodiments according to the present invention realities Existing architecture, function and operation.In this regard, each box in flowchart or block diagram can represent module, a journey A part of sequence section or code, a part of the module, section or code include one or more for realizing defined The executable instruction of logic function.It should also be noted that in some implementations as replacements, the function of being marked in box can also To be occurred with being different from the sequence marked in attached drawing.For example, two continuous boxes can actually be basically executed in parallel, They can also be executed in the opposite order sometimes, and this depends on the function involved.It is also noted that block diagram and/or stream The combination of each box in journey figure and the box in block diagram and or flow chart, can the functions or operations as defined in executing Dedicated hardware based system realize, or can realize using a combination of dedicated hardware and computer instructions.
Various embodiments of the present invention are described above, above description is exemplary, and non-exclusive, and It is not limited to disclosed each embodiment.Without departing from the scope and spirit of illustrated each embodiment, for this skill Many modifications and changes are obvious for the those of ordinary skill in art field.The selection of term used herein, purport In the principle, practical application or improvement to the technology in market for best explaining each embodiment, or make the art Other those of ordinary skill can understand each embodiment disclosed herein.

Claims (19)

1. the connection method between a kind of client and service node, comprising:
It creates the service of the second quantity for client and the first quantity service node to connect, wherein save with the multiple service Each service node in point establishes at least one service connection;
Application program and service node in response to the client establish the service attachment request of service connection, from described second Selection service connection is in quantity service connection to be used for the application program.
2. according to the method described in claim 1, further include:
The second quantity created service connection is put into the connection pool that the client is locally located,
Wherein, selection service is connected to include: the step of being used for the application program from second quantity service connection
Selection service connection is from the connection pool to be used for the application program.
3. according to the method described in claim 2, wherein, selection service connection for described from connection pool connection to answer Include: with the step of program
Determine corresponding with service node corresponding with the service attachment request;And
One is selected at least one service connection between the client described in the connection pool and the corresponding with service node A service connection is to be used for the application program.
4. according to the method described in claim 3, wherein, determination corresponding with service corresponding with the service attachment request The step of node includes:
Determine selection strategy corresponding with the service type of the application program;
Based on the selection strategy, service node corresponding with the service attachment request is determined.
5. according to the method described in claim 4, wherein, the selection strategy includes polling schemas, randomized policy, consistency Kazakhstan At least one of uncommon strategy.
6. according to the method described in claim 2, further include:
In response to the increase and/or reduction of service node, the second quantity service connection of the connection pool is adjusted;Or
The second quantity service connection of the connection pool is adjusted, to be more than other services for popular service node distribution The service of node connects, and the hot topic service node is that service attachment request quantity corresponding in predetermined amount of time is most One or more service nodes.
7. according to the method described in claim 2, further include:
It is arranged or modifies second quantity;
It is modified in response to second quantity, adjusts the second quantity service connection of the connection pool.
8. according to the method described in claim 7, wherein, the setting or the step of modifying second quantity, include:
Based on the connection exception information from service node that client receives, second quantity is modified.
9. according to the method described in claim 8, wherein, described modified in response to second quantity adjusts the connection pool Second quantity service connection the step of include:
Based on the connection exception information received, service connection corresponding with the connection exception information is deleted.
10. according to the method described in claim 7, wherein, the setting or the step of modifying second quantity, include:
Based on the connection configuration information to service connection for including in the service attachment request, second quantity is modified.
11. according to the method described in claim 10, further include:
In the case where previous service is connected as abnormal connect, it is based on the service type, redefines and is connected with the service Request corresponding service node and service connection.
12. method described in any one of -11 according to claim 1, further includes:
Based on the attribute information of the service connection, determine whether the service connection can be used;And/or
Based on the heartbeat feedback information received, determine whether the service connection can be used.
13. the attachment device between a kind of client and service node, comprising:
Creating device is connected, for creating the service of the second quantity for client and the first quantity service node and connecting, wherein At least one service is established with each service node in the multiple service node to connect;
Connection selecting device, the service for application program and service node foundation service connection in response to the client connect Request is connect, selection service connection is from second quantity service connection to be used for the application program.
14. device according to claim 13, further includes:
Configuration device, the second quantity service connection for will be created are put into the connection pool that the client is locally located,
Wherein, the connection selecting device selects service connection for the application program from the connection pool.
15. device according to claim 14, wherein the connection selecting device includes:
Node determining device, for determining corresponding with service node corresponding with the service attachment request;And
At least one between connection selecting device client described in the connection pool and the corresponding with service node One service connection of selection is in service connection to be used for the application program.
16. device according to claim 15, wherein the node determining device includes:
Policy device, for determining selection strategy corresponding with the service type of the application program;
The connection selecting device determines service node corresponding with the service attachment request based on the selection strategy.
17. device according to claim 14, further includes:
The first adjustment device adjusts second number of the connection pool for the increase and/or reduction in response to service node Amount service connection;Or
The first adjustment device adjusts the second quantity service connection of the connection pool, to be popular service node point It is connected with the service more than other service nodes, the hot topic service node is service connection corresponding in predetermined amount of time The most one or more service nodes of number of requests.
18. a kind of calculating equipment, comprising:
Processor;And
Memory is stored thereon with executable code, when the executable code is executed by the processor, makes the processing Device executes the method as described in any one of claim 1-12.
19. a kind of non-transitory machinable medium, is stored thereon with executable code, when the executable code is electric When the processor of sub- equipment executes, the processor is made to execute the method as described in any one of claims 1 to 12.
CN201810904734.0A 2018-08-09 2018-08-09 Connection method and device, calculating equipment and storage medium between client and service node Pending CN109274641A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810904734.0A CN109274641A (en) 2018-08-09 2018-08-09 Connection method and device, calculating equipment and storage medium between client and service node

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810904734.0A CN109274641A (en) 2018-08-09 2018-08-09 Connection method and device, calculating equipment and storage medium between client and service node

Publications (1)

Publication Number Publication Date
CN109274641A true CN109274641A (en) 2019-01-25

Family

ID=65153224

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810904734.0A Pending CN109274641A (en) 2018-08-09 2018-08-09 Connection method and device, calculating equipment and storage medium between client and service node

Country Status (1)

Country Link
CN (1) CN109274641A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111371865A (en) * 2020-02-26 2020-07-03 上海达梦数据库有限公司 Client connection relation adjusting method, system and node
CN112506955A (en) * 2020-12-10 2021-03-16 星环信息科技(上海)股份有限公司 Query processing method, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110055368A1 (en) * 2003-08-14 2011-03-03 Oracle International Corporation Connection Pool Use of Runtime Load Balancing Service Performance Advisories
CN102708165A (en) * 2012-04-26 2012-10-03 华为软件技术有限公司 Method and device for processing files in distributed file system
CN102708175A (en) * 2012-05-07 2012-10-03 北京航空航天大学 Automatic reconnection method and automatic reconnection device for contingency interrupt of database connection
CN104767679A (en) * 2014-01-08 2015-07-08 腾讯科技(深圳)有限公司 Data transmission method and device in network system
CN106209943A (en) * 2015-05-07 2016-12-07 中兴通讯股份有限公司 The system of selection of communication node and device
CN106506490A (en) * 2016-11-03 2017-03-15 深圳智高点知识产权运营有限公司 A kind of Distributed Calculation control method and distributed computing system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110055368A1 (en) * 2003-08-14 2011-03-03 Oracle International Corporation Connection Pool Use of Runtime Load Balancing Service Performance Advisories
CN102708165A (en) * 2012-04-26 2012-10-03 华为软件技术有限公司 Method and device for processing files in distributed file system
CN102708175A (en) * 2012-05-07 2012-10-03 北京航空航天大学 Automatic reconnection method and automatic reconnection device for contingency interrupt of database connection
CN104767679A (en) * 2014-01-08 2015-07-08 腾讯科技(深圳)有限公司 Data transmission method and device in network system
CN106209943A (en) * 2015-05-07 2016-12-07 中兴通讯股份有限公司 The system of selection of communication node and device
CN106506490A (en) * 2016-11-03 2017-03-15 深圳智高点知识产权运营有限公司 A kind of Distributed Calculation control method and distributed computing system

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111371865A (en) * 2020-02-26 2020-07-03 上海达梦数据库有限公司 Client connection relation adjusting method, system and node
CN112506955A (en) * 2020-12-10 2021-03-16 星环信息科技(上海)股份有限公司 Query processing method, computer equipment and storage medium
CN112506955B (en) * 2020-12-10 2021-09-21 星环信息科技(上海)股份有限公司 Query processing method, computer equipment and storage medium

Similar Documents

Publication Publication Date Title
Terry et al. Consistency-based service level agreements for cloud storage
CN105205014B (en) A kind of date storage method and device
CN110149364A (en) Method, apparatus, the storage medium of micro services are provided based on data service platform
CN105094997B (en) Physical memory sharing method and system between a kind of cloud computing host node
CN105808736B (en) A kind of list data-updating method, apparatus and system
CN107360010A (en) A kind of website gray scale dissemination method and device
CN112131504B (en) Webpage editing and displaying method, device, equipment and storage medium
CN110442610A (en) The method, apparatus of load balancing calculates equipment and medium
CN108924244A (en) Distributed system and flow allocation method and device for the system
CN108134766A (en) A kind of method, apparatus, system, server and client for servicing publication
CN106209943A (en) The system of selection of communication node and device
CN110968603B (en) Data access method and device
CN112651826B (en) Credit line management and control system, method and readable storage medium
CN112866421B (en) Intelligent contract operation method and device based on distributed cache and NSQ
CN108694218A (en) A kind of method and apparatus data write-in and read
CN109933285A (en) The data balancing method and device of distributed storage
CN110740155B (en) Request processing method and device in distributed system
CN109951543A (en) A kind of data search method of CDN node, device and the network equipment
CN106952085B (en) Method and device for data storage and service processing
CN110099084A (en) A kind of method, system and computer-readable medium guaranteeing storage service availability
CN109274641A (en) Connection method and device, calculating equipment and storage medium between client and service node
CN110784498B (en) Personalized data disaster tolerance method and device
CN114490826A (en) Request response method, data storage method, device, server and storage medium
CN105871994A (en) Static file service method and unit
CN109684084A (en) A kind of distribution method of bus resource, system and associated component

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
TA01 Transfer of patent application right
TA01 Transfer of patent application right

Effective date of registration: 20200810

Address after: 310052 room 508, floor 5, building 4, No. 699, Wangshang Road, Changhe street, Binjiang District, Hangzhou City, Zhejiang Province

Applicant after: Alibaba (China) Co.,Ltd.

Address before: 510627 Guangdong city of Guangzhou province Whampoa Tianhe District Road No. 163 Xiping Yun Lu Yun Ping square B radio tower 13 layer self unit 01

Applicant before: Guangdong Shenma Search Technology Co.,Ltd.

RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20190125