CN110740155B - Request processing method and device in distributed system - Google Patents

Request processing method and device in distributed system Download PDF

Info

Publication number
CN110740155B
CN110740155B CN201810807141.2A CN201810807141A CN110740155B CN 110740155 B CN110740155 B CN 110740155B CN 201810807141 A CN201810807141 A CN 201810807141A CN 110740155 B CN110740155 B CN 110740155B
Authority
CN
China
Prior art keywords
target
server
routing information
request
information
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.)
Active
Application number
CN201810807141.2A
Other languages
Chinese (zh)
Other versions
CN110740155A (en
Inventor
赵立芳
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Alibaba Group Holding Ltd
Original Assignee
Alibaba Group Holding Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Alibaba Group Holding Ltd filed Critical Alibaba Group Holding Ltd
Priority to CN201810807141.2A priority Critical patent/CN110740155B/en
Publication of CN110740155A publication Critical patent/CN110740155A/en
Application granted granted Critical
Publication of CN110740155B publication Critical patent/CN110740155B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

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/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources
    • H04L67/63Routing a service request depending on the request content or context
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/02Topology update or discovery
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L45/00Routing or path finding of packets in data switching networks
    • H04L45/74Address processing for routing
    • H04L45/742Route cache; Operation thereof
    • 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
    • H04L67/10Protocols in which an application is distributed across nodes in the network

Abstract

The invention discloses a request processing method and device in a distributed system. The distributed system comprises a plurality of servers, and the plurality of servers respectively correspond to a plurality of subareas, wherein the method comprises the following steps: acquiring an operation request for a target area; searching a target server corresponding to the target fragment in a routing table, wherein the routing table stores the corresponding relation between a plurality of fragments and a plurality of servers; and sending an operation request to the target server so that the target server performs corresponding operation according to the operation request. The invention solves the technical problems that the client triggers a large number of requests sent to the central node when the server is found to be abnormal in the related technology, so that the request pressure of the central node is caused, and errors are easy to occur when the client updates the cache simultaneously.

Description

Request processing method and device in distributed system
Technical Field
The present invention relates to the field of distributed computing technologies, and in particular, to a request processing method and apparatus in a distributed system.
Background
The distributed system of the prior non-relational database comprises three modules, namely a central node, a server and a client. The central node stores various label information and schedules a plurality of areas on different servers; the server provides services for different areas according to tasks issued by the central node; the client accesses the central node to obtain the position information of the corresponding area, and then requests the corresponding server to complete reading and writing.
In general, servers corresponding to each partition are relatively fixed, but partition migration occurs in a distributed system for dynamic load balancing, abnormal server discovery, and the like, that is, the servers corresponding to the partitions are changed. Based on the situation of server change corresponding to a parcel, it is a common practice to request a central node to obtain a server corresponding to the latest parcel, which may cause the following problems:
1. multiple requests of multiple clients all request a central node, which results in a sudden increase of requests of the central node, and the size of the requests can reach millions or even tens of millions of query requests, thereby causing a performance bottleneck of the central node.
2. Multiple requests of each client request the central node, and simultaneously, the concurrence problem of updating the server corresponding to the fragment area is caused.
In view of the above problems, no effective solution has been proposed.
Disclosure of Invention
The embodiment of the invention provides a request processing method and a request processing device in a distributed system, which are used for at least solving the technical problems that when a server is found to be abnormal, a client triggers a large number of requests sent to a central node, so that the request pressure of the central node is caused, and errors are easily caused when the client updates a cache concurrently.
According to an aspect of an embodiment of the present invention, there is provided a request processing method in a distributed system, where the distributed system includes a plurality of servers, and the plurality of servers respectively correspond to a plurality of tiles, the method including: acquiring an operation request for a target area; searching a target server corresponding to the target fragment area in a routing table, wherein the routing table stores the corresponding relation between the plurality of fragment areas and the plurality of servers; and sending the operation request to the target server so that the target server can carry out corresponding operation according to the operation request.
According to another aspect of the embodiments of the present invention, there is also provided a request processing apparatus in a distributed system, where the distributed system includes a plurality of servers, and the plurality of servers respectively correspond to a plurality of tiles, the apparatus includes: an acquisition unit, configured to acquire an operation request for a target parcel; a searching unit, configured to search a routing table for a target server corresponding to the target fragment, where the routing table stores correspondence between the plurality of fragments and the plurality of servers; and the sending unit is used for sending the operation request to the target server so that the target server can carry out corresponding operation according to the operation request.
According to another aspect of the embodiments of the present invention, there is also provided a distributed system including a plurality of servers, the system including: a client configured to execute the request processing method in the distributed system; the system comprises a plurality of servers, a central node and a target client, wherein the servers correspond to a plurality of districts respectively, and the central node is used for responding to the request of the client to obtain the request of the target server corresponding to the target district and returning the target server to the target client.
In the embodiment of the present invention, the operation request for the target partition may be obtained first, the target server corresponding to the target partition is found in the routing table, the corresponding relationship between the plurality of partitions and each server is stored in the routing table, and finally, the operation request may be sent to the found target server, so that the target server performs corresponding operation. The target server is rapidly acquired through the cache routing table, and the request pressure of the central node is reduced.
Meanwhile, the invention can also update the routing information by requesting the central node to acquire a new server corresponding to the target fragment area under the condition that the routing information cannot be searched and/or the routing information is unavailable, thereby solving the technical problems that the client triggers a large number of requests sent to the central node to cause the request pressure of the central node and the client is easy to make mistakes when updating the cache simultaneously. The identification value of the routing information is updated through the feedback of the server, and whether the routing information is available is judged based on the identification value before the request is sent, so that the availability of the routing information is judged in advance, and the condition that the request fails due to the unavailability of the routing information of a client is avoided.
Furthermore, in the invention, the routing information can be subscribed to the central node, and the regular updating is not needed, so that the occupation of background threads is reduced. The routing information can be updated by periodically testing whether a server of the routing information is accessible to the network, so that the request pressure of the central node is further reduced, namely the routing information can be updated according to the information returned by the server when the network is accessible, if the server is switched with data such as addresses and the like, the client can acquire the latest routing information according to the information returned by the server without passing through the central node, and if the network is not accessible, the client can acquire a new server corresponding to the fragment area through the request of the central node to update the routing information.
In addition, the method and the device can also request the central node to acquire a new server corresponding to the fragment to update the cached routing information under the condition that the routing information cannot be found or unavailable.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention and do not constitute a limitation of the invention. In the drawings:
FIG. 1 is a network environment diagram of a computer terminal for implementing a request processing method in a distributed system;
fig. 2 is a flowchart of a request processing method in a distributed system according to a first embodiment of the present invention;
FIG. 3 is a flowchart of an alternative method for finding a target server according to an embodiment of the present invention;
FIG. 4 is a flowchart of another method for obtaining a target server according to a first embodiment of the invention;
fig. 5 is a flowchart of a method for adjusting an identification value of routing information according to a first embodiment of the present invention;
fig. 6 is a schematic diagram of another method for adjusting the identification value of the target routing information according to the first embodiment of the present invention;
fig. 7(a) is a flowchart of an alternative method for updating routing information in a routing table according to an embodiment of the present invention;
FIG. 7(b) is a schematic diagram of an alternative sniffing operation according to the first embodiment of the present invention;
fig. 8 is a schematic diagram of another request processing method in a distributed system according to the second embodiment of the present invention;
fig. 9 is a schematic diagram of a request processing apparatus in an alternative distributed system according to a third embodiment of the present invention;
fig. 10 is a block diagram of a computer terminal according to a fourth embodiment of the present invention;
fig. 11 is a schematic diagram of another alternative distributed system according to a fourth embodiment of the invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
First, some terms or terms appearing in the description of the embodiments of the present application are applicable to the following explanations:
master, central node of management server in distributed system.
The Server, involve a plurality of distributed servers in the distributed system, in order to provide the data service.
The Client, the Client and the port for initiating the request operation in the distributed system.
The router: one of the indispensable network devices in the internet, a router, is a network device that connects multiple networks or network segments, and can "translate" data information between different networks or network segments so that they can "read" each other to understand the data of each other, thereby forming a larger network. There are generally two typical functions, namely a data channel function and a control function.
Example one
There is also provided, in accordance with an embodiment of the present invention, a method embodiment for request processing in a distributed system, it should be noted that the steps illustrated in the flowchart of the accompanying drawings may be carried out in a computer system such as a set of computer-executable instructions, and that, although a logical order is illustrated in the flowchart, in some cases, the steps illustrated or described may be carried out in an order different than here.
The method provided by the first embodiment of the present application may be executed in a mobile terminal, a computer terminal, or a similar computing device. Fig. 1 shows a schematic diagram of a network environment of a computer terminal (or a mobile device) for implementing a request processing method in a distributed system, as shown in fig. 1, the network environment includes a client device 11, a central node 12 and a distributed backend server 13, specifically, the client device in fig. 1 is a device for initiating a request, which can be provided for a user to use to display a browser window, the client device in this embodiment of the present application can be an initiator of an operation request in the distributed system, and the central node 12 can be a node serving as a management and scheduling server, which can configure a plurality of tiles and servers corresponding to the tiles, so that before initiating an operation request, the client obtains location information of the tiles from the central node, the location information indicates the servers corresponding to the tiles, and then sends the operation request to a target server corresponding to the tiles, thereby the target server processes the operation request sent by the client.
In the embodiment of the application, in order to reduce the data processing pressure of the central node, and in particular, in order to alleviate the technical problem that the central node needs to process a large number of requests for acquiring the server corresponding to the fragment due to the migration of the fragment, a routing table is set at the client, and the routing table includes a plurality of pieces of routing information recorded with the fragment and the server corresponding to the fragment. The client can directly obtain the server corresponding to the fragment area from the routing table and then send an operation request to the server. After the client sends the request, if the client does not receive the feedback of the server within the preset time period, the client can judge that the routing information is unavailable, if the routing information is unavailable, the client can determine that the server corresponding to the partition recorded by the routing information cannot provide service for the partition, and at this time, the client can apply to a central node (master) to obtain a new server corresponding to the partition again, and process the operation request sent by the client. Of course, in the present invention, after the operation request fails, the unavailability of the routing information may be gradually determined by reducing the identification value corresponding to the routing information.
In general, each parcel may be served by a server farm that enumerates a target server to serve the parcel, with other servers serving as backups for the target server. In the existing implementation process, when the server cluster determines that the target server is abnormal, a new target server is reselected to provide service for the parcel. If the change of the target server is not timely transmitted to the central node, the client side can continuously send an operation request to the original target server, and sends the operation request to each server in the server group after the request fails, and the client side can continuously request the central node to acquire a new target server until the request succeeds or the request fails, so that great pressure is brought to the central node. In the embodiment of the invention, the client can regularly test the server recorded by the routing information to test whether the server is accessible or not, so that the routing information is updated according to the information returned by the server when the network is accessible, the problem caused by switching the target server can be avoided, and the burden of the central node is further lightened.
Optionally, the client device may be installed with a window or page software (such as a WEB page terminal) that initiates the data operation request, for example, the page terminal is a B/S (i.e., browser/server mode), and establishes information interaction with the server through the browser. Optionally, the client device may have a front-end display, through which window or page software may be displayed, so that a user may perform a relevant request operation, and the display of the client device may be a touch display (such as a touch screen), a key display, or the like. The user can realize interaction with the central node or the background server through key input, touch screen input and other operations, and the interaction may include: data reading and writing, displaying content of a backend server, drawing, word processing, games, etc., executable instructions for performing the above-described interactive functions are configured/stored in one or more processor-executable computer program products or readable storage media.
The client device may be connected to one or more backend servers 13 through a data network connection, which may be a local area network connection, a wide area network connection, an internet connection, or other type of data network connection, or electronically. The client device 11 may be connected to a network service executed by one backend server (e.g., a secure server) or a group of backend servers. The backend server is a network-based user server, such as a social network, cloud resources, email, online payment, or other online application.
Under the operating environment, the application provides a request processing method in a distributed system as shown in fig. 2. In the embodiment of the present invention, the distributed system includes at least one client, a central node, and a plurality of background servers, where the client may be a terminal used by a user or an enterprise, and may be a client used by an individual user, or a client used by a plurality of employees in an enterprise, and the specific type and model of the client are not specifically limited in the present invention. The central node may refer to a core node for managing and scheduling a server in a distributed system, and may be a central server or a data processor, although the specific type of the central node is not specifically limited in the embodiment of the present invention. For the background servers, the number of the background servers connected with the central node in the embodiment of the invention can be multiple, and the client has data requirements in the data file or other operation requirements. When the system works, a plurality of areas are configured in advance by a central node, a server is allocated to each area, position information of the areas is acquired from the central node before an operation request is sent by a client, so that the server of the areas is determined, the operation request is sent to the server, and the server can perform corresponding operation according to the operation request. In the embodiment of the invention, a plurality of servers correspond to a plurality of areas, and when the client terminal works, the central node distributes the servers for the areas, and stores the corresponding information of the areas and the servers through the routing table, so that the client terminal can find the servers through the routing table only when in subsequent use, the server does not need to be requested from the central node in real time, and the working pressure of the central node is reduced.
Fig. 2 is a flowchart of a request processing method in a distributed system according to a first embodiment of the present invention, where the distributed system includes a plurality of servers, and the plurality of servers respectively correspond to a plurality of tiles, as shown in fig. 2, the method may include:
and step 21, acquiring an operation request for the target area.
And step 22, searching a target server corresponding to the target fragment in a routing table, wherein the routing table stores the corresponding relation between the plurality of fragments and the plurality of servers. The routing table may be a routing table cached by the client in advance, and a plurality of pieces of routing information are stored in the routing table.
And step 23, sending an operation request to the target server so that the target server performs corresponding operation according to the operation request.
The steps of the present invention will be described in detail below, where the operation request may refer to a service request for data stored in the server to obtain the data stored in the server, or write related data into the server to store the data in the server. The routing table comprises a plurality of pieces of routing information, and each piece of routing information at least comprises: the corresponding relation between the corresponding fragment area and the corresponding server and the identification information of the routing information. Alternatively, the identification information may be an identification value, which may indicate whether the routing information is available, wherein the identification value may be a value, which may be a predetermined identification or number (e.g., 3), and the routing information may indicate a plurality of tiles and servers corresponding to the tiles. And after finding the target server corresponding to the target fragment according to the routing information, the client sends an operation request to the target server so as to enable the target server to process the operation request. For the client sending the operation request, before sending the operation request, the client can obtain the target parcel, and then the target parcel is used for finding the target server in the routing table.
In the embodiment of the present invention, the central node may allocate the partitions and the servers corresponding to each partition, where each partition has a corresponding server, that is, the server processes tasks (including operation request tasks) of the partition associated therewith. In the prior art, the position information of a plurality of areas is scheduled on different servers through a central node; the server provides services for different areas according to tasks issued by the central node; the client accesses the central node to obtain the position information of the corresponding fragment, and then requests the corresponding server to complete read-write operation, so that the burden of the central node for scheduling the fragment is increased, each client needs to request the central node to determine the fragment corresponding to the operation request, and in addition, the problem that the central node needs to process a large number of requests for obtaining the server corresponding to the fragment due to fragment migration exists in the related art. The difference between the present application and the prior art is that the client caches the routing table, the routing table includes multiple pieces of routing information, the routing information includes a parcel and a server corresponding to the parcel, before obtaining the operation request, the target parcel corresponding to the operation request is obtained, and the server corresponding to the target parcel is found through the routing table, that is, after caching the routing table, the client does not need to request the server corresponding to the central node each time, and directly searches in the cached routing table, and a specific manner is described in the following embodiment.
It should be noted that, in the distributed system in the embodiment of the present invention, for the consideration of server abnormality or load balancing, the central node may change the servers corresponding to the segments, reduce the number of operation requests processed by the same server, and ensure that each server operates normally, if the server is abnormal or load unbalanced, the central node needs to reallocate the servers to the segments associated with the server, and the client needs to update the routing information cached in the routing table.
In an alternative embodiment, the specific type of distribution system is not limited, such as the distribution system in Nosql.
It should be noted here that, in the embodiment of the present invention, the client is not required to query the central node and update the routing information at regular time, that is, the client is not required to send a request for updating the routing information to the central node according to a preset time period. In the embodiment of the invention, the inquiry frequency of sending the routing information to the central node by the client is reduced, the number of occupied background threads is reduced, the background threads are used for other tasks, and the thread pressure of the central node can be reduced. And records the routing information through the request feedback mechanism and the routing table described below to strengthen the connection between the client and the server.
As to the step S22, fig. 3 is a flowchart of an optional method for finding a target server according to a first embodiment of the present invention, and as shown in fig. 3, the method may include the following steps:
step S301, obtaining the target routing information corresponding to the target parcel in the routing table.
Step S303, determining whether to update the target routing information in the routing table according to the identification information of the target routing information.
Step S305, if the target routing information is not updated, the target server corresponding to the target parcel is obtained in the target routing information.
The target routing information can be directly obtained through the routing table, and whether the target routing information in the routing table needs to be updated is judged according to the identification information in the target routing information, that is, whether the target routing information is available can be indicated through the identification information, and if the target routing information is unavailable, the routing information in the routing table needs to be updated.
For the above step S303, if the identification information is an identification number, fig. 4 is a flowchart of another method for acquiring a target server according to the first embodiment of the present invention, as shown in fig. 4, the method includes the following steps:
step S3031, determining whether the identification value of the target routing information is greater than a first preset value.
Step S3033, if the identification value of the target routing information is greater than the first preset value, obtaining the target server corresponding to the target parcel in the target routing information.
Step S3035, if the identification value of the target routing information is not greater than the first preset value, updating the target routing information. That is, the target server corresponding to the target partition can be obtained in the routing information, and when the identification value is greater than the first preset value, the server corresponding to the target area can be directly obtained from the target routing information, if the server is not larger than the target area, the target routing information can be directly updated, in this process, whether the routing information is available or not can be determined by the identification value, and in the above step, the value or character of the preset bit of the identification value can be read, thereby determining whether routing information is available, such as by reading the first few digits of the identification value, or the last few digits of the identification value, determines the availability status of the routing information, as is conventionally the case when each routing information has an identification value of 5, and after each operation request fails, reducing a value, and if the identification value reaches 0, judging that the routing information is unavailable.
The first preset value may be a value set by itself in practical applications, and the embodiment of the present invention is not limited in particular, for example, the first preset value is set to 0.
With reference to the above step S23, fig. 5 is a flowchart of a method for adjusting an identification value of routing information according to a first embodiment of the present invention, and as shown in fig. 5, after sending an operation request to a target server, the method includes the following steps:
step S502, receiving the data information returned after the target server performs corresponding operation according to the operation request.
Step S504, if the data information indicates that the operation is successful, increasing the identification value of the target routing information by a second preset value.
For the embodiment of the present invention, the routing table includes a plurality of pieces of routing information, where the target routing information at least includes: the corresponding relation between the target area and the target server and the identification value of the target routing information. Alternatively, when determining whether the data information indicates that the operation is successful, it may be to check whether the target server timely feeds back the relevant request data corresponding to the operation request, and if the target server timely gives a feedback according to the operation request, it may confirm that the operation request is successful, and accordingly, enhance the availability of the routing information (e.g., add 1 to the identification value).
In step S506, if the data information indicates that the operation is failed, the identifier value of the target routing information is decreased by a third preset value.
It should be noted that, in the present invention, the identification information of the routing information may be established first, and the identification information may be an identification value. Wherein a higher identification number indicates a higher availability of the piece of routing information. In the embodiment of the invention, if the server cannot respond to the operation request sent by the client in time, the server subtracts the corresponding numerical value, so that the availability of the routing information is indicated by the identification numerical value, and if the identification numerical value of the routing information corresponding to the server is 0, the unavailability of the routing information corresponding to the server is indicated, and at the moment, the server corresponding to the fragment area in the routing information can be requested to obtain from the central node.
That is to say, the identification value in the routing information may be determined according to the returned data information, after the operation is successful, a corresponding second preset value may be added to the identification, and after the operation is failed, a corresponding third preset value may be reduced to the identification value, where the second preset value and the third preset value may be preset values, and the second preset value and the third preset value may be the same or different, for example, the second preset value and the third preset value are set to be 1.
Optionally, when the distributed system includes a central node, if the target server corresponding to the target segment cannot be found in the pre-cached routing table, or if the data information indicates that the operation fails, the target routing information is updated.
It should be noted that, after it is determined that the operation has failed, the value of the identification value may be reduced, and if the identification value is less than or equal to a first preset value, or the data information indicates that the operation has failed, or a server corresponding to the segment cannot be searched according to the routing table, it indicates that the routing information is unavailable, and the server corresponding to the routing information cannot provide a service in time, and at this time, the client needs to request the central node to obtain a new target server corresponding to the segment.
In another alternative embodiment, if the central node is included in the distributed system, the method for updating the target routing information may include the following steps as shown in fig. 6:
step S601, requesting the central node to acquire a target server corresponding to the target parcel.
Step S603, updating the target routing information in the routing table according to the obtained target server, and adjusting the identifier value of the target routing information to a fourth preset value.
It should be noted that, the first preset value and the fourth preset value are set by themselves according to the actual application state, for example, the first preset value is set to 0, and the fourth preset value is set to 3 or 5. For example, if the fourth predetermined value is 3, the value may be increased by 1 if the operation is successful, and the value may be decreased by 1 if the operation is failed.
For the above steps S601 to S603, after acquiring a new target server, an identifier value of the routing information may be set, so as to prepare for subsequently determining whether the routing information is available.
In addition, after the central node requests to acquire the target server corresponding to the target parcel, the central node may further continue to send the operation request to the acquired target server.
For the embodiment of the present invention, the routing information in the routing table may be updated, and fig. 7(a) is a flowchart of an optional method for updating the routing information in the routing table according to an embodiment of the present invention, as shown in fig. 7(a), the method includes the following steps:
step S72, sending a subscription request for the routing information to the central node, so that the central node returns the routing information updated each time.
Step S74, updating the corresponding routing information in the routing table according to the routing information returned by the central node.
In the embodiments of the present invention, the subscription request can reduce a large amount of time occupied by the background thread of the client due to the original timing update, and the central node can respond to the subscription request of the client, and notify the client of new routing information after changing the server corresponding to the segment in the routing information, so as to facilitate the client to update the routing information in time.
In an optional implementation manner, in the embodiment of the present invention, timing may also be started when an operation request for a target parcel is obtained; and when the central node requests to acquire the target server, judging whether the timing time exceeds a preset time length. And if the timing time does not exceed the preset time length, continuing to send an operation request to the target server so that the target server performs corresponding operation according to the operation request.
And judging whether the timing time exceeds the preset time length or not when receiving data information which indicates operation failure and is returned by the target server. And if the timing time does not exceed the preset time length, continuously requesting the central node to acquire a target server corresponding to the target parcel.
In addition, in the embodiment of the present invention, a sniffing operation may also be implemented, and fig. 7(b) is a schematic diagram of an alternative sniffing operation according to the first embodiment of the present invention, as shown in fig. 7(b), the sniffing operation includes the following steps:
step S702, sending a test request to the server included in each piece of routing information in the routing table to test whether the server is reachable through the network.
It should be noted that, in the present invention, a central node may pre-divide a segment and determine a server corresponding to each segment, before a client sends an operation request, the client may obtain the segment corresponding to the client, for the client, a routing table is pre-cached, multiple pieces of routing information are cached in the routing table, each piece of routing information corresponds to a segment and a server, if there is an operation request, a target segment is allocated, so as to find a target server corresponding to the target segment by using the routing information, and if a server corresponding to a segment in the routing information is replaced, the routing information may also be adjusted by using the subscription request or by using a manner that whether the test server is reachable through the network. In the invention, whether the server corresponding to the fragment area of the routing information cached in the client is abnormal or not can be determined through the test request.
Optionally, the routing table of the cache of the client does not limit the specific content of the cache, and may include, but is not limited to, the routing information, and may further cache an identifier value or a correspondence between a fragment and a server.
Step S704, if the server network is reachable, receiving the server information returned by the server, and updating the corresponding routing information in the routing table accordingly.
The service state of each server can be tested through the test request, so that each routing information in the routing table is updated according to whether the test server is accessible or not, if the server information returned by the server is not received, the server is abnormal or the information is not sent to the corresponding server, the routing information can be determined to be unavailable at the moment, and the central node can be found to request to acquire a new server corresponding to the fragment area to update the routing information.
It should be noted here that a close connection may be established between the target segment corresponding to the client and the target server in advance, and if the server is abnormal, the server is requested to be updated from the central node in time. Meanwhile, the embodiment of the invention also discloses another method for establishing the association between the client and the server by adding a request feedback mechanism and feeding back the state of the server by the identification value of the routing information. Through the two modes, the client updates the cached routing information in time so as to confirm the state of the server and the fragment area corresponding to each piece of routing information and ensure that the service state of the server in each piece of routing information is normal.
Optionally, the target server performs corresponding operations according to the operation request, which may include but is not limited to: the storage operation of data, or the read operation of data, each operation is directed to an access task, and the specific data type and data read-write mode are not specifically limited in the present invention.
In the embodiment of the present invention, an operation request for a target parcel may be obtained first, a target server corresponding to the target parcel may be found in a pre-cached routing table, a corresponding relationship between a plurality of parcels and each server is stored in the routing table, and finally, the operation request may be sent to the found target server, so that the target server performs a corresponding operation. The target server is rapidly acquired through the cache routing table, and the request pressure of the central node is reduced.
Meanwhile, the invention can also update the routing information by requesting the central node to acquire a new server corresponding to the target fragment area under the condition that the routing information cannot be searched and/or the routing information is unavailable, thereby solving the technical problems that the client triggers a large number of requests sent to the central node to cause the request pressure of the central node and the client is easy to make mistakes when updating the cache simultaneously. The identification value of the routing information is updated through the feedback of the server, and whether the routing information is available is judged based on the identification value before the request is sent, so that the availability of the routing information is judged in advance, and the condition that the request fails due to the unavailability of the routing information of a client is avoided.
Furthermore, in the embodiment of the invention, the routing information can be subscribed to the central node, and the occupation of background threads is reduced without the need of timing update. The routing information can be updated by periodically testing whether a server of the routing information is accessible to the network, so that the request pressure of the central node is further reduced, namely the routing information can be updated according to the information returned by the server when the network is accessible, if the server is switched with data such as addresses and the like, the client can acquire the latest routing information according to the information returned by the server without passing through the central node, and if the network is not accessible, the client can acquire a new server corresponding to the fragment area through the request of the central node to update the routing information.
In addition, the method and the device can also request the central node to acquire a new server corresponding to the fragment to update the cached routing information under the condition that the routing information cannot be found or is unavailable.
The number of servers scheduled by the central node is not particularly limited, and may be determined according to the number of servers connected to the central node in the distributed system, such as 20, 100, and the like.
For the embodiment of the present invention, the steps in the request processing method in the distributed system may be asynchronous, and the specific implementation method is as follows:
triggering a wake-up instruction, wherein the wake-up instruction is used for waking up an operation request; and performing related operation on the target server according to the awakened operation request.
Optionally, when the wake-up instruction is triggered, the wake-up instruction may be triggered by a mechanism such as subscription update or callback, and the wake-up instruction indicates to wake up the operation request, and only after the wake-up, relevant operations (e.g., data read/write operations) need to be performed on the server, and if the wake-up instruction is not triggered, the data read/write operations do not need to be performed. By the awakening mode, the condition that the operation requests are sent out randomly is reduced, the operation requests are dispatched asynchronously, each operation request is required to be finally operated, if the operation requests are not awakened, the working thread can process other requests, each thread is guaranteed not to be blocked and occupied randomly, and the capability of receiving and processing the requests by the client side is improved to the maximum extent.
It should be noted that, for simplicity of description, the above-mentioned method embodiments are described as a series of acts or combination of acts, but those skilled in the art will recognize that the present invention is not limited by the order of acts, as some steps may occur in other orders or concurrently in accordance with the invention. Further, those skilled in the art should also appreciate that the embodiments described in the specification are preferred embodiments and that the acts and modules referred to are not necessarily required by the invention.
Through the above description of the embodiments, those skilled in the art can clearly understand that the request processing method in the distributed system according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
Example two
In the following embodiments, a client may first send a subscription request to subscribe to the central node for updating of route (route) information, to obtain an updated route table (route table), where the route table may include a plurality of pieces of route information, and each piece of route information includes: a parcel and a server corresponding to the parcel. Optionally, the client may obtain the target segment before sending the operation request, and after sending the operation request, the client may look up the routing table (obtain the server corresponding to the segment through the routing information of the routing table) to obtain the server (server) corresponding to the target segment. If the searching is successful, initiating an operation request to the target server by using the target server determined by the current routing information; if the search fails, a route acquisition task (GetRouteTask) needs to be constructed to acquire the route information corresponding to the operation request. After receiving the route acquisition task, the central node recalls the fragment area and the server from the operation request again, determines new route information according to a callback result, and then the client can search the new server according to the new route information and sends the operation request to the new server to perform corresponding read-write actions. After the client sends the operation request to the server, whether the routing information in the routing table is updated or not can be determined according to the request result, if the read-write action is successful and corresponding server information is returned, the routing information is determined to be available, and if the read-write action is failed and corresponding server information is not returned, the routing information is determined to be unavailable.
Fig. 8 is a schematic diagram of another request processing method in a distributed system according to a second embodiment of the present invention, and as shown in fig. 8, the method may include:
step S801, subscribe to routing information.
In step S801, the client may send a subscription request to the central node to obtain currently updated routing information in the central node, so as to update the routing information cached in the routing table of the client. Each routing information corresponds to a fragment and a server.
Step S802, determining whether the routing information corresponding to the operation request can be obtained.
That is, it can be determined whether there is a server to process the operation request, where the server is obtained by querying the routing information, and the server is found through the pre-allocated partition, and if there is no routing information, it indicates that there is no server to process the operation request. If so, go to step S803, otherwise go to step S804.
In step S803, a wake-up command is issued to wake up the processing thread. Subsequent read and write operations are performed by the processing thread.
Step S804, a new server is acquired.
In step S804, a request may be made to the central node master to obtain a new server.
In step S805, a new server is probed through a sniff operation.
In this step, the client may send a sniff request to the new server to see whether a response can be obtained in time, so as to determine whether the new server and the target parcel can be connected, so that the client can directly send an operation request to the new server after finding the new server through the parcel. The sniff request may help the client determine the service status of the new server.
Step S806, after the sniffing is successful, the server in the routing information is updated. And then to step S803.
That is, the server information in the routing table may be updated after it is determined that a new server is available through the sniff operation.
In step S807, the server performs data read/write operations according to the operation request.
Step S808, determining whether the data read-write operation is successful.
If yes, go to step S809, otherwise go to step S810.
Step S809, confirming that the data read-write operation is successful, and adding a preset value to the identification value ttl of the routing information corresponding to the operation request. Wherein, the predetermined value may be 1.
Step S810, confirming that the data read-write operation fails, and subtracting a preset value from the identification value ttl of the routing information corresponding to the operation request.
In the above steps, a client (client) timing update mechanism can be cancelled, and background thread occupation is reduced, that is, the client does not need to request the server (server) to acquire the routing information at regular time. And a request feedback mechanism can be added, each operation request has corresponding routing information (the routing table comprises a plurality of routing information), before the client sends the operation request, a fragment is obtained, and the server is found in the routing table according to the fragment. Optionally, each piece of routing information has its own ttl value (corresponding to the identifier value in the first embodiment), each operation request searches for the routing information first to obtain the target server, if the search is successful, the operation request may be sent to the target server, and the server may feed back a message that the operation request is successful to the client, where ttl may be restored to the initial value to strengthen ttl (e.g., adding 1 to the ttl value). If the target server fails to feed back the server information corresponding to the operation request in time, it is determined that the operation request fails, and the identification value ttl can be reduced by a corresponding value, for example, ttl is reduced by 1, so that the server provided by the identification routing information cannot process the operation request. If the value of ttl is lower than a preset threshold (e.g., 0), it is determined that the server provided by the routing information cannot provide the service, and the central node may allocate a new server to the tile corresponding to the server as soon as possible.
Optionally, in the above embodiment, a new sniffing mechanism (corresponding to the sniffing operation of the first embodiment) may be added. The client side initiates a test request to the server which stores all the routing information in the routing table and caches the routing information, the server synchronizes the latest information to the client side after receiving the test request, and the client side can update all the routing information in the routing table according to the latest information. If the server corresponding to the fragment of which piece of routing information in the routing table is switched, the client can directly acquire the switching information of the server, and test whether the switched new server can normally provide service through the test request.
In addition, in the invention, all actions can be asynchronous, the maximum utilization of each thread can be ensured by awakening through methods such as subscription updating, callback and the like, and the thread processes corresponding requests only when being awakened. Thereby maximizing the ability of the client and the server to process the operation request.
EXAMPLE III
The present invention is described below with reference to another apparatus for implementing the request processing method in the distributed system, and fig. 9 is a schematic diagram of an alternative request processing apparatus in the distributed system according to a third embodiment of the present invention, and as shown in fig. 9, the apparatus may include: an obtaining unit 91, a searching unit 93, a sending unit 95, wherein,
an obtaining unit 91, configured to obtain an operation request for the target parcel.
The searching unit 93 is configured to search a target server corresponding to the target fragment in a pre-cached routing table, where the routing table stores a correspondence between multiple fragments and multiple servers.
The sending unit 95 is configured to send an operation request to the target server, so that the target server performs a corresponding operation according to the operation request.
In the processing device, the operation request for the target partition may be first obtained by the obtaining unit, the target server corresponding to the target partition may be searched in a pre-cached routing table by the searching unit, the routing table stores correspondence between a plurality of partitions and each server, and finally, the operation request may be sent to the searched target server by the sending unit, so that the target server performs corresponding operation. The invention can also update the routing information by requesting the central node to acquire a new server corresponding to the target fragment area under the condition that the routing information cannot be searched and/or the routing information is unavailable, thereby solving the technical problems that the client triggers a large number of requests sent to the central node to cause the request pressure of the central node and the client is easy to make mistakes when the client updates the cache simultaneously.
It should be noted here that the obtaining unit 91, the searching unit 93, and the sending unit 95 correspond to steps S21 to S23 in the first embodiment, and the three modules are the same as the corresponding steps in the implementation example and the application scenario, but are not limited to the disclosure in the first embodiment. It should be noted that the modules described above as part of the apparatus may operate in the network scenario provided in the first embodiment.
Optionally, the routing table includes a plurality of pieces of routing information, and each piece of routing information at least includes: the corresponding relationship between the corresponding fragment and the corresponding server, and the identifier value of the routing information, the searching unit may include: the first acquisition module is used for acquiring target routing information corresponding to the target area in the routing table; the first judgment module is used for judging whether the identification numerical value of the target routing information is larger than a first preset numerical value or not; a second obtaining module, configured to obtain, in the target routing information, a target server corresponding to the target segment if the identification value of the target routing information is greater than the first preset value
Optionally, the request processing in the distributed system further includes: the receiving unit is used for receiving data information returned after the target server performs corresponding operation according to the operation request after the operation request is sent to the target server; the increasing unit is used for increasing the identification value of the target routing information by a second preset value when the data information indicates that the operation is successful; and the reduction unit is used for reducing the identification value of the target routing information by a third preset value when the data information indicates that the operation fails.
Optionally, the distributed system further includes a central node, and the request processing apparatus in the distributed system further includes: a third obtaining module, configured to request the central node to obtain a target server corresponding to the target segment when the target server corresponding to the target segment cannot be found in the pre-cached routing table, or when the identification value of the target routing information is less than or equal to the first preset value, or when the data information indicates that the operation is failed; and the adjusting module is used for generating or updating the target routing information in the routing table according to the acquired target server and adjusting the identification value of the target routing information to a fourth preset value.
Optionally, the request processing apparatus in the distributed system further includes: a first sending module, configured to send an operation request to an acquired target server after requesting the central node to acquire the target server corresponding to the target parcel
The request processing apparatus in the distributed system further includes: a returning unit, configured to send a subscription request for the routing information to the central node, so that the central node returns the routing information updated each time; and the updating unit is used for updating the corresponding routing information in the routing table according to the routing information returned by the central node.
The request processing apparatus in the distributed system further includes: the timing unit is used for starting timing when an operation request for the target area is acquired; and the judging module is used for judging whether the timing time exceeds the preset time length or not when the central node requests to acquire the target server or receives data information which indicates operation failure and is returned by the target server.
The request processing apparatus in the distributed system further includes: the first sending module is used for sending a test request to a server contained in each piece of routing information in the routing table so as to test whether the server is network reachable; and the first receiving module is used for receiving the server information returned by the server when the server network is reachable, and updating the corresponding routing information in the routing table according to the server information.
All steps corresponding to the request processing device in the distributed system are executed asynchronously.
Example four
The embodiment of the invention can provide a computer terminal which can be any computer terminal device in a computer terminal group. Optionally, in this embodiment, the computer terminal may also be replaced with a terminal device such as a mobile terminal.
Optionally, in this embodiment, the computer terminal may be located in at least one network device of a plurality of network devices of a computer network.
In this embodiment, the computer terminal may execute program codes for the following steps in the request processing in the distributed system: acquiring an operation request for a target area; searching a target server corresponding to a target fragment in a pre-cached routing table, wherein the routing table stores the corresponding relation between a plurality of fragments and a plurality of servers; and sending an operation request to the target server so that the target server performs corresponding operation according to the operation request.
Optionally, fig. 10 is a block diagram of a computer terminal according to a fourth embodiment of the present invention. As shown in fig. 10, the computer terminal a may include: one or more processors (only one of which is shown), memory, and transmission means. The computer terminal a may correspond to the client described above, and the server 1307 may correspond to a server.
The memory may be configured to store software programs and modules, such as program instructions/modules corresponding to the request processing method and apparatus for the distributed system in the embodiment of the present invention, and the processor executes various functional applications and data processing by executing the software programs and modules stored in the memory, that is, implements the request processing method for the distributed system. The memory may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory may further include memory located remotely from the processor, which may be connected to the computer terminal a via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The processor can call the information and application program stored in the memory through the transmission device to execute the following steps: acquiring an operation request for a target area; searching a target server corresponding to a target fragment in a pre-cached routing table, wherein the routing table stores the corresponding relation between a plurality of fragments and a plurality of servers; and sending an operation request to the target server so that the target server performs corresponding operation according to the operation request.
Optionally, the processor may further execute the program code of the following steps: the routing table comprises a plurality of pieces of routing information, and each piece of routing information at least comprises: the step of searching the target server corresponding to the target parcel in the routing table according to the corresponding relation between the corresponding parcel and the corresponding server and the identification value of the routing information comprises the following steps: acquiring target routing information corresponding to the target area in a routing table; judging whether the identification value of the target routing information is larger than a first preset value or not; and if the identification value of the target routing information is larger than a first preset value, acquiring a target server corresponding to the target area from the target routing information.
Optionally, the processor may further execute the program code of the following steps: after sending an operation request to a target server, receiving data information returned after the target server performs corresponding operation according to the operation request; if the data information indicates that the operation is successful, increasing the identification value of the target routing information by a second preset value; and if the data information indicates that the operation fails, reducing the identification value of the target routing information by a third preset value.
Optionally, the processor may further execute the program code of the following steps: the distributed system also comprises a central node, and if the target server corresponding to the target fragment cannot be searched in the pre-cached routing table, or if the identification numerical value of the target routing information is less than or equal to a first preset numerical value, or if the data information indicates that the operation is failed, the central node is requested to acquire the target server corresponding to the target fragment; and generating or updating target routing information in the routing table according to the acquired target server, and adjusting the identification value of the target routing information to a fourth preset value.
Optionally, the processor may further execute the program code of the following steps: and after the central node requests to acquire the target server corresponding to the target parcel, sending an operation request to the acquired target server.
Optionally, the processor may further execute the program code of the following steps: sending a subscription request for the routing information to the central node so that the central node returns the routing information updated each time; and updating the corresponding routing information in the routing table according to the routing information returned by the central node.
Optionally, the processor may further execute the program code of the following steps: when an operation request for a target area is acquired, timing is started; when a request is made to the central node to acquire the target server, or when data information which indicates operation failure and is returned by the target server is received, whether the timing time exceeds a preset time length is judged.
Optionally, the processor may further execute the program code of the following steps: sending a test request to a server contained in each piece of routing information in the routing table so as to test whether the server is network reachable; and if the server network is accessible, receiving server information returned by the server, and updating the corresponding routing information in the routing table according to the server information.
Optionally, the processor may further execute the program code of the following steps: the steps in the request processing method in the distributed system are all executed asynchronously.
According to the scheme, the target server corresponding to the target fragment is found in the routing table cached in advance, the corresponding relation between the plurality of fragments and each server is stored in the routing table, finally, the operation request can be sent to the found target server, so that the corresponding operation is carried out through the target server, the routing information is updated through the routing table, the state of the server is updated, the client does not need to request the central node for updating the state of the server regularly, the working pressure of the central node is reduced, and the technical problems that the client triggers a large number of requests sent to the central node when the server is found to be abnormal in the related art, the request pressure of the central node is caused, and errors are easily caused when the client updates the cache concurrently are solved.
It can be understood by those skilled in the art that the structure shown in fig. 10 is only an illustration, and the computer terminal may also be a terminal device such as a smart phone (e.g., an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a Mobile Internet Device (MID), a PAD, and the like. Fig. 10 does not limit the structure of the electronic device.
Those skilled in the art will appreciate that all or part of the steps in the methods of the above embodiments may be implemented by a program instructing hardware associated with the terminal device, where the program may be stored in a computer-readable storage medium, and the storage medium may include: flash disks, Read-Only memories (ROMs), Random Access Memories (RAMs), magnetic or optical disks, and the like.
Fig. 11 is a schematic diagram of another alternative distributed system according to the fourth embodiment of the present invention, where the distributed system includes a plurality of servers, and as shown in fig. 11, the system 1101 includes: a client 1102 configured to execute the request processing method in the distributed system; the system comprises a plurality of servers 1103, wherein the plurality of servers respectively correspond to a plurality of districts, and a central node, which is used for responding to a client request to obtain a request of a target server corresponding to a target district, and returning the target server to the target client.
Optionally, in this embodiment, the client and the servers are located in a distributed system, and optionally, the servers may include a central node server and a server in distributed storage, and after the client sends the operation request, the client may search for a target segment in the routing information and a server corresponding to the target segment, thereby completing the related operation.
EXAMPLE five
The embodiment of the invention also provides a storage medium. Optionally, in this embodiment, the storage medium may be configured to store a program code executed by the request processing method in the distributed system provided in the first embodiment.
Optionally, in this embodiment, the storage medium may be located in any one of computer terminals in a computer terminal group in a computer network, or in any one of mobile terminals in a mobile terminal group.
An embodiment of the present invention further provides a processor, where the processor is configured to execute a program, where the program executes a request processing method in a distributed system according to any one of the foregoing descriptions.
Optionally, in this embodiment, the storage medium is configured to store program code for performing the following steps: acquiring an operation request for a target area; searching a target server corresponding to a target fragment in a pre-cached routing table, wherein the routing table stores the corresponding relation between a plurality of fragments and a plurality of servers; and sending an operation request to the target server so that the target server performs corresponding operation according to the operation request.
Optionally, the storage medium is further arranged to store program code for performing the steps of: the routing table comprises a plurality of pieces of routing information, and each piece of routing information at least comprises: the step of searching the target server corresponding to the target parcel in the routing table according to the corresponding relation between the corresponding parcel and the corresponding server and the identification value of the routing information comprises the following steps: acquiring target routing information corresponding to the target area in a routing table; judging whether the identification value of the target routing information is larger than a first preset value or not; and if the identification value of the target routing information is larger than a first preset value, acquiring a target server corresponding to the target area from the target routing information.
Optionally, the storage medium is further arranged to store program code for performing the steps of: after sending an operation request to a target server, receiving data information returned after the target server performs corresponding operation according to the operation request; if the data information indicates that the operation is successful, increasing the identification value of the target routing information by a second preset value; and if the data information indicates that the operation fails, reducing the identification value of the target routing information by a third preset value.
Optionally, the storage medium is further arranged to store program code for performing the steps of: the distributed system also comprises a central node, and if the target server corresponding to the target fragment cannot be searched in a pre-cached routing table, or if the identification numerical value of the target routing information is less than or equal to a first preset numerical value, or if the data information indicates that the operation is failed, the central node is requested to acquire the target server corresponding to the target fragment; and generating or updating target routing information in the routing table according to the acquired target server, and adjusting the identification value of the target routing information to a fourth preset value.
Optionally, the storage medium is further arranged to store program code for performing the steps of: and after the central node requests to acquire the target server corresponding to the target parcel, sending an operation request to the acquired target server.
Optionally, the storage medium is further arranged to store program code for performing the steps of: sending a subscription request for the routing information to the central node so that the central node returns the routing information updated each time; and updating the corresponding routing information in the routing table according to the routing information returned by the central node.
Optionally, the storage medium is further arranged to store program code for performing the steps of: when an operation request for a target area is acquired, timing is started; when a request is made to the central node to acquire the target server, or when data information which indicates operation failure and is returned by the target server is received, whether the timing time exceeds a preset time length is judged.
Optionally, the storage medium is further arranged to store program code for performing the steps of: sending a test request to a server contained in each piece of routing information in the routing table so as to test whether the server is network reachable; and if the server network is accessible, receiving server information returned by the server, and updating the corresponding routing information in the routing table according to the server information.
Optionally, the storage medium is further arranged to store program code for performing the steps of: the steps in the request processing method in the distributed system are all executed asynchronously.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present invention, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one type of division of logical functions, and there may be other divisions when actually implemented, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present invention may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk, and various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (14)

1. A method for processing a request in a distributed system, the distributed system including a plurality of servers, the plurality of servers corresponding to a plurality of tiles, respectively, the method comprising:
acquiring an operation request for a target area;
searching a target server corresponding to the target fragment area in a routing table, wherein the routing table stores the corresponding relation between the plurality of fragment areas and the plurality of servers;
sending the operation request to the target server so that the target server can carry out corresponding operation according to the operation request;
wherein, the routing table includes a plurality of pieces of routing information, and each piece of routing information at least includes: the step of searching the target server corresponding to the target parcel in the routing table according to the corresponding relationship between the corresponding parcel and the corresponding server and the identification information of the routing information comprises the following steps:
acquiring target routing information corresponding to the target area in the routing table;
judging whether to update the target routing information in the routing table according to the identification information of the target routing information;
and if the target routing information is not updated, acquiring a target server corresponding to the target fragment area in the target routing information.
2. The method of claim 1, wherein the identification information is an identification value, and the step of determining whether to update the target routing information in the routing table according to the identification information of the target routing information comprises:
judging whether the identification value of the target routing information is larger than a first preset value or not;
if the identification value of the target routing information is larger than the first preset value, the target routing information is not updated;
otherwise, updating the target routing information.
3. The method of claim 1, wherein after sending the operation request to the target server, the method further comprises:
receiving data information returned after the target server performs corresponding operation according to the operation request;
if the data information indicates that the operation is successful, increasing the identification value of the target routing information by a second preset value;
and if the data information indicates that the operation is failed, reducing the identification numerical value of the target routing information by a third preset numerical value.
4. The method of claim 1, wherein the distributed system further comprises a central node, the method further comprising:
if the target server corresponding to the target parcel is not found in the routing table, or,
and if the data information indicates that the operation fails, updating the target routing information.
5. The method of claim 2 or 4, wherein the distributed system further comprises a central node, the step of updating target routing information comprising:
requesting the central node to acquire a target server corresponding to the target fragment area;
and updating the target routing information in the routing table according to the acquired target server, and adjusting the identification value of the target routing information to a fourth preset value.
6. The method of claim 5, wherein after requesting the central node to acquire the target server corresponding to the target parcel, the method further comprises:
and sending the operation request to the acquired target server.
7. The method of claim 5, wherein the method further comprises:
sending a subscription request for routing information to the central node so that the central node returns the routing information updated each time;
and updating the corresponding routing information in the routing table according to the routing information returned by the central node.
8. The method of claim 5, wherein the method further comprises:
when an operation request for a target area is acquired, timing is started;
and when the target server is requested to be acquired from a central node or data information which indicates operation failure and is returned by the target server is received, judging whether the timing time exceeds a preset time length.
9. The method of claim 1, wherein the method further comprises:
sending a test request to a server contained in each piece of routing information in the routing table so as to test whether the server is network-reachable;
and if the server network is reachable, receiving server information returned by the server, and updating the corresponding routing information in the routing table according to the server information.
10. The method of claim 1, wherein the steps of the request processing method in the distributed system are all executed asynchronously.
11. A request processing apparatus in a distributed system, the distributed system including a plurality of servers, the plurality of servers corresponding to a plurality of tiles, respectively, the apparatus comprising:
an acquisition unit, configured to acquire an operation request for a target parcel;
a searching unit, configured to search a routing table for a target server corresponding to the target fragment, where the routing table stores correspondence between the plurality of fragments and the plurality of servers;
a sending unit, configured to send the operation request to the target server, so that the target server performs a corresponding operation according to the operation request;
wherein, the routing table includes a plurality of routing information, each routing information at least includes: the corresponding relation between the corresponding fragment and the corresponding server and the identification value of the routing information, wherein the search unit comprises: the first acquisition module is used for acquiring target routing information corresponding to the target area in the routing table; the first judgment module is used for judging whether the identification numerical value of the target routing information is larger than a first preset numerical value or not; and the second acquisition module is used for acquiring the target server corresponding to the target fragment in the target routing information if the identification numerical value of the target routing information is greater than the first preset numerical value.
12. A distributed system comprising a plurality of servers, the system comprising:
a client for executing the request processing method in the distributed system according to any one of claims 1 to 10;
a plurality of servers, wherein the plurality of servers respectively correspond to a plurality of zones,
and the central node is used for responding to the request of the client to acquire the request of the target server corresponding to the target parcel and returning the target server to the target client.
13. A storage medium comprising a stored program, wherein a device on which the storage medium is located is controlled to execute a request processing method in a distributed system according to any one of claims 1 to 10 when the program is executed.
14. A processor for running a program, wherein the program when running performs the method of request processing in the distributed system of any one of claims 1 to 10.
CN201810807141.2A 2018-07-18 2018-07-18 Request processing method and device in distributed system Active CN110740155B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810807141.2A CN110740155B (en) 2018-07-18 2018-07-18 Request processing method and device in distributed system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810807141.2A CN110740155B (en) 2018-07-18 2018-07-18 Request processing method and device in distributed system

Publications (2)

Publication Number Publication Date
CN110740155A CN110740155A (en) 2020-01-31
CN110740155B true CN110740155B (en) 2022-05-27

Family

ID=69235331

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810807141.2A Active CN110740155B (en) 2018-07-18 2018-07-18 Request processing method and device in distributed system

Country Status (1)

Country Link
CN (1) CN110740155B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111770022B (en) * 2020-06-28 2023-04-25 中国平安财产保险股份有限公司 Capacity expansion method, system, equipment and computer storage medium based on link monitoring
CN111600794B (en) * 2020-07-24 2020-12-18 腾讯科技(深圳)有限公司 Server switching method, terminal, server and storage medium
CN113315802A (en) * 2020-07-27 2021-08-27 阿里巴巴集团控股有限公司 Method, device and equipment for processing network link abnormity
CN112947333B (en) * 2021-02-05 2022-08-02 天津市普迅电力信息技术有限公司 Socket long connection-based balanced load fragmentation method

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006008494A2 (en) * 2004-07-20 2006-01-26 British Telecommunications Public Limited Company Method of operating a network with test packets
KR100778340B1 (en) * 2006-12-07 2007-11-22 한국전자통신연구원 Management of forwarding information table by software upgrading operation in a router system
CN101515297A (en) * 2009-04-16 2009-08-26 浙江浙大中控信息技术有限公司 History data inquiry method, route server and inquiry terminal and system
CN104050249A (en) * 2011-12-31 2014-09-17 北京奇虎科技有限公司 Distributed query engine system and method and metadata server
CN104754065A (en) * 2015-04-28 2015-07-01 湖南科技大学 Dynamic distribution Web resource management method and system based on content center network
CN105610881A (en) * 2014-11-06 2016-05-25 阿里巴巴集团控股有限公司 Distributed cache range query method, device and system
CN106375425A (en) * 2016-08-30 2017-02-01 中国民生银行股份有限公司 Processing method and device for distributed caching

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102316018B (en) * 2010-07-09 2014-12-31 中国移动通信集团公司 Method for updating routing table in network node equipment and network node equipment
US10050865B2 (en) * 2014-02-28 2018-08-14 Tyco Fire & Security Gmbh Maintaining routing information

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2006008494A2 (en) * 2004-07-20 2006-01-26 British Telecommunications Public Limited Company Method of operating a network with test packets
KR100778340B1 (en) * 2006-12-07 2007-11-22 한국전자통신연구원 Management of forwarding information table by software upgrading operation in a router system
CN101515297A (en) * 2009-04-16 2009-08-26 浙江浙大中控信息技术有限公司 History data inquiry method, route server and inquiry terminal and system
CN104050249A (en) * 2011-12-31 2014-09-17 北京奇虎科技有限公司 Distributed query engine system and method and metadata server
CN105610881A (en) * 2014-11-06 2016-05-25 阿里巴巴集团控股有限公司 Distributed cache range query method, device and system
CN104754065A (en) * 2015-04-28 2015-07-01 湖南科技大学 Dynamic distribution Web resource management method and system based on content center network
CN106375425A (en) * 2016-08-30 2017-02-01 中国民生银行股份有限公司 Processing method and device for distributed caching

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
NoSQL数据库分布式缓存系统设计与实现;臧传江;《中国优秀硕士学位论文全文数据 信息科技辑》;20150615;全文 *

Also Published As

Publication number Publication date
CN110740155A (en) 2020-01-31

Similar Documents

Publication Publication Date Title
CN110740155B (en) Request processing method and device in distributed system
JP6882511B2 (en) Methods, devices and systems for blockchain consensus
US10785322B2 (en) Server side data cache system
CN107391629B (en) Method, system, server and computer storage medium for data migration between clusters
US9659038B2 (en) Efficient snapshot read of a database in a distributed storage system
US10394611B2 (en) Scaling computing clusters in a distributed computing system
US9069835B2 (en) Organizing data in a distributed storage system
JP6607783B2 (en) Distributed cache cluster management
US10462250B2 (en) Distributed caching cluster client configuration
CN104954468A (en) Resource allocation method and resource allocation device
CN102449628A (en) Architectural pattern for persistent web application design
CN102449602A (en) System and method for reducing startup cost of a software application
CN104735098A (en) Session information control method and system
CN103312624A (en) Message queue service system and method
US9529772B1 (en) Distributed caching cluster configuration
WO2016139938A1 (en) Thin client system, connection management device, virtual machine operating device, method, and storage medium
CN110334072A (en) A kind of distributed file system, file updating method and device
CN104750757A (en) Data storage method and equipment based on HBase
CN112084173A (en) Data migration method and device and storage medium
CN110784498B (en) Personalized data disaster tolerance method and device
CN111427689B (en) Cluster keep-alive method and device and storage medium
CN110704422B (en) Data query method, device, system, computer equipment and storage medium
US20150088826A1 (en) Enhanced Performance for Data Duplication
CN105718291B (en) Multilevel cache acceleration method for mixed desktop application
CN114945026A (en) Data processing method, device and system

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