WO2019200714A1 - Server connection method, computer readable storage medium, terminal device, and apparatus - Google Patents

Server connection method, computer readable storage medium, terminal device, and apparatus Download PDF

Info

Publication number
WO2019200714A1
WO2019200714A1 PCT/CN2018/093342 CN2018093342W WO2019200714A1 WO 2019200714 A1 WO2019200714 A1 WO 2019200714A1 CN 2018093342 W CN2018093342 W CN 2018093342W WO 2019200714 A1 WO2019200714 A1 WO 2019200714A1
Authority
WO
WIPO (PCT)
Prior art keywords
hash
function
server
hashvt
candidate
Prior art date
Application number
PCT/CN2018/093342
Other languages
French (fr)
Chinese (zh)
Inventor
王丽
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019200714A1 publication Critical patent/WO2019200714A1/en

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/14Session management
    • H04L67/141Setup of application sessions
    • 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/55Push-based network services
    • 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
    • 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
    • H04L67/1001Protocols in which an application is distributed across nodes in the network for accessing one among a plurality of replicated servers
    • H04L67/1004Server selection for load balancing
    • H04L67/1023Server selection for load balancing based on a hash applied to IP addresses or costs

Definitions

  • the present application belongs to the field of computer technologies, and in particular, to a server connection method, a computer readable storage medium, a terminal device, and a device.
  • the basics of message push need to maintain a long connection between the user's terminal device and the server. As the number of user terminals increases, the long connection server also needs to be scaled horizontally at any time. Currently, a long connection is established by the user's terminal device randomly requesting a server to maintain a long connection. In this case, when the message is pushed, the message needs to be distributed to each server, and the server that keeps the long connection is pushed to the user's terminal device, which not only causes waste of server resources, but also increases the probability of message retransmission. .
  • the embodiment of the present application provides a server connection method, a computer readable storage medium, a terminal device, and a device, to solve a waste of server resources caused by a user terminal device randomly requesting a server to maintain a long connection.
  • a first aspect of the embodiment of the present application provides a server connection method, which may include:
  • each reference node on the hash ring where each reference node is a node corresponding to one server on the hash ring;
  • a second aspect of embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the steps of implementing the server connection method when executed by a processor .
  • a third aspect of an embodiment of the present application provides a server connection terminal device including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, the processor executing the The steps of the above server connection method are implemented when the computer readable instructions are described.
  • a fourth aspect of the embodiments of the present application provides a server connection apparatus, which may include a module for implementing the steps of the server connection method described above.
  • FIG. 1 is a flowchart of an embodiment of a server connection method according to an embodiment of the present application
  • FIG. 2 is a schematic diagram of a hash ring
  • FIG. 3 is a schematic diagram of a hash value of a terminal device mapped to a node of a hash ring;
  • FIG. 7 is a schematic block diagram of a server connection terminal device according to an embodiment of the present application.
  • an embodiment of a server connection method in an embodiment of the present application may include:
  • Step S101 Acquire an identity identifier of the terminal device.
  • the identity of the terminal device may refer to the International Mobile Equipment Identity (IMEI) of the terminal, and the international mobile device identity code is an electronic serial number consisting of 15 digits, which corresponds to each terminal device one by one. And the code is the only one in the world.
  • IMEI International Mobile Equipment Identity
  • Each terminal device will be assigned a globally unique number after assembly, and this number will be recorded by the manufacturer of the manufacturing from production to delivery.
  • Step S102 Perform a hash operation on the identity identifier by using a preset first hash function to obtain a hash value of the terminal device.
  • All hash functions have one of the following basic properties: If the two hash values are not identical (based on the same hash function), the original input of the two hash values is also different. This feature gives the hash function a deterministic result. On the other hand, the input and output of the hash function are not unique. If the two hash values are the same, the two input values are likely to be the same, but they may be different. This case is called a "hash collision.” "This is usually two different input values, deliberately calculating the same output value.” However, for the hash function commonly used in the prior art, the probability of collision is extremely low, almost negligible, inputting some data to calculate a hash value, and then partially changing the input value, a hash with strong confusion characteristics. The function produces a completely different hash value.
  • the first hash function in this embodiment may include, but is not limited to, a hash function commonly used in the prior art such as MD4, MD5, and SHA1.
  • the identifiers of the obtained terminal devices are respectively represented as: IMEI 1 , IMEI 2 , IMEI 3 , . . . , IMEI m , . . . , IMEI M , where IMEI m is the identity of the mth terminal device, 1 ⁇ m ⁇ M, M is the total number of terminal devices.
  • HashFunc1 is the first hash function
  • Key m is the hash value of the mth terminal device.
  • Step S103 Map the hash value of the terminal device to the first node of the hash ring.
  • Step S104 Acquire each reference node on the hash ring.
  • Each of the reference nodes is a node corresponding to one server on the hash ring.
  • the setting process of the reference node includes:
  • each of the reference nodes is obtained.
  • the identifier of the server may be an IP address of the server, and the identifiers of the obtained servers are respectively represented as: IP 1 , IP 2 , IP 3 , . . . , IP m′ , . . . , IP M′ , where IP m' is the identity of the mth server, 1 ⁇ m' ⁇ M', and M' is the total number of servers.
  • HashFunc2 is the second hash function
  • Key' m' is the hash value of the mth server. It is particularly noted that the value range of the second hash function and the first hash function are The values are consistent, so that both can be mapped to the same hash ring.
  • Figure 4 shows the case where the hash values of the seven servers are mapped to the nodes of the hash ring, respectively, Key' 1 , Key' 2 , Key' 3 , Key' 4 , Key' 5 , Key' 6 , Key'
  • the node corresponding to 7 is the reference node.
  • Step S105 Find the reference node clockwise or counterclockwise from the first node, and determine the server corresponding to the first reference node that is found as a preferred server.
  • the corresponding IMEI 1 Key for example, from its corresponding node, i.e. the node starts to find the reference node clockwise, to find the first reference node Key '1
  • the server with the address IP 1 is determined as the preferred server of the IMEI 1 .
  • the server whose address is IP 4 is determined to be the preferred server of IMEI 3
  • the server whose address is IP 6 is determined to be the preferred server of IMEI 4 .
  • the server whose address is IP 7 is determined to be the preferred server of IMEI 1
  • the server whose address is IP 2 is determined to be the preferred server of IMEI 2
  • the server whose address is IP 3 is determined as The preferred server of the IMEI 3 and the server of the IP 5 are determined as the preferred servers of the IMEI 4 .
  • Step S106 Establish a communication connection between the terminal device and the preferred server.
  • the number of different mapping locations may be set for different servers according to the processing capability of the server.
  • the server processing power from high to low is: server 1, server 2, server 3. Then, the mapping position of the server 1 is set to three, the mapping position of the server 2 is set to two, and the mapping position of the server 1 is set to one.
  • IP address IP 1 of the server 1 is expanded to three virtual IPs: IP 1_1 , IP 1_2 , IP 1_3
  • IP address IP 2 of the server 2 is expanded to two virtual IPs: IP 2_1 , IP 2_2 , IP 1_3
  • IP address IP 3 of the server 3 is kept unchanged, and the corresponding node of each IP hash value on the hash ring is as shown in FIG. 5 .
  • the reference node in step S104 can also be set by the following process:
  • m is the serial number of the server, 1 ⁇ m ⁇ M, M is the total number of servers, ServerIDm is the identity of the mth server, n is the serial number of the extended identity, and the extended identity can be the aforementioned virtual IP , 1 ⁇ n ⁇ Nm, Nm is the total number of extended identity identifiers of the mth server, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively correlated with the memory capacity of the mth server, that is, the central The higher the main frequency of the processor and the larger the memory capacity, the larger the total number of extended identities. Conversely, the lower the main frequency of the central processing unit and the smaller the memory capacity, the smaller the total number of extended identities. .
  • ExtFunc is a preset function.
  • the servers corresponding to the three virtual IP nodes of the server 1 in FIG. 5 are both the server 1, and the servers corresponding to the two virtual IP nodes of the server 2 are the servers 2.
  • a setting method of the second hash function may include:
  • a hash function is arbitrarily selected from the preset hash function set as a candidate function, and the hash function set includes more than one hash function.
  • the candidate function is used to hash the extended identity of each server to obtain a hash value of each server.
  • HashValueSetT is a collection of hash values from each server.
  • the uniformity of the candidate function is calculated according to the following formula:
  • HashMax is the maximum function value of the candidate function
  • EvenDeg is the uniformity of the candidate function
  • the candidate function is determined as a second hash function.
  • Another setting method of the second hash function may include:
  • a hash function is arbitrarily selected from the preset hash function set as a candidate function, and the hash function set includes more than one hash function.
  • the candidate function is used to hash the extended identity of each server to obtain a hash value of each server.
  • HashArrayT (hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
  • TN is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • the uniformity of the candidate function is calculated according to the following formula:
  • HashMax is the maximum function value of the candidate function
  • is a preset proportional coefficient
  • EvenDeg is the uniformity of the candidate function.
  • the candidate function is determined as a second hash function.
  • the embodiment of the present application sets a hash ring formed by sequentially connecting all the function values of the first hash function in a clockwise or counterclockwise order from small to large, and the server and the terminal device are both Mapping to the hash ring, establishing a spatial correspondence between the server and the terminal device, and determining the preferred server corresponding to the terminal device by clockwise or counterclockwise searching, the probability of collision due to hash operation It is almost negligible, so the preferred server determined in this way can be regarded as unique, which reduces the waste of server resources and greatly reduces the chance of message retransmission.
  • FIG. 6 is a structural diagram of an embodiment of a server connection apparatus according to an embodiment of the present application.
  • a server connection device may include:
  • the terminal identifier obtaining module 601 is configured to acquire an identity identifier of the terminal device.
  • the first hash operation module 602 is configured to perform hash operation on the identity identifier by using a preset first hash function to obtain a hash value of the terminal device.
  • a first mapping module 603 configured to map a hash value of the terminal device to a first node of a hash ring, where the hash ring is a function of all functions of the first hash function from small to large Arranging the formed rings sequentially in a clockwise or counterclockwise manner, each node is a function value constituting the hash ring, and the first node is any one of the nodes on the hash ring;
  • a reference node obtaining module 604 configured to acquire each reference node on the hash ring, where each reference node is a node corresponding to one server on the hash ring;
  • a server determining module 605 configured to search the reference node clockwise or counterclockwise from the first node, and determine a server corresponding to the first reference node that is found as a preferred server;
  • the communication connection establishing module 606 is configured to establish a communication connection between the terminal device and the preferred server.
  • the server connection device may further include:
  • a server identifier obtaining module configured to acquire an identity of each server
  • a second hash operation module configured to hash the identity of each server by using a preset second hash function, to obtain a hash value of each server, and a value field of the second hash function
  • the value range of the first hash function is consistent
  • the server connection device may further include:
  • An identity extension module for calculating an extended identity of each server according to the following formula:
  • n is the serial number of the extended identity
  • 1 ⁇ n ⁇ Nm is the total number of servers
  • ServerIDm is the identity of the mth server
  • n is the serial number of the extended identity
  • 1 ⁇ n ⁇ Nm is the mth server
  • Nm is the mth server
  • the total number of extended identities, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively related to the memory capacity of the mth server
  • ExtFunc is the default function
  • Ext_ServerIDm is the mth server The nth extended identity.
  • the server connection device may further include:
  • a candidate function selection module configured to arbitrarily select one hash function from the preset hash function set as a candidate function, the hash function set includes one or more hash functions;
  • a hash operation module configured to hash the extended identity of each server by using the candidate function, to obtain a hash value of each server
  • the first sequence construction module is configured to construct a sequence of hash values according to the following formula:
  • HashArrayT (hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
  • HashValueSetT is a set consisting of hash values of the respective servers
  • a first uniformity calculation module configured to calculate a uniformity of the candidate function according to the following formula:
  • HashMax is the maximum function value of the candidate function
  • EvenDeg is the uniformity of the candidate function
  • a candidate function deleting module configured to delete the candidate function from the hash function set if a uniformity of the candidate function is greater than a preset uniformity threshold
  • the function determining module is configured to determine the candidate function as the second hash function if the uniformity of the candidate function is less than or equal to a preset uniformity threshold.
  • the server connection device may further include:
  • the second sequence construction module is configured to construct each hash value sequence according to the following formula:
  • HashArrayT (hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
  • TN is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • Hashvt tn is the total number of hash values of each server
  • a second uniformity calculation module configured to calculate a uniformity of the candidate function according to the following formula:
  • HashMax is the maximum function value of the candidate function
  • is a preset proportional coefficient
  • EvenDeg is the uniformity of the candidate function.
  • FIG. 7 is a schematic block diagram of a server connection terminal device provided by an embodiment of the present application. For convenience of description, only parts related to the embodiment of the present application are shown.
  • the server connection terminal device 7 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server.
  • the server connection terminal device 7 may include a processor 70, a memory 71, and computer readable instructions 72 stored in the memory 71 and operable on the processor 70, such as a computer executing the server connection method described above. Read the instruction.
  • the processor 70 executes the computer readable instructions 72, the steps in the above embodiments of the respective server connection methods are implemented.
  • the functional units in the various embodiments of the present application may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, the technical solution of the present application, in essence or the contribution to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of computer readable instructions are included to cause a computer device to perform all or part of the steps of the methods described in various embodiments of the present application.

Abstract

The present application relates to the technical field of computers, and in particular, to a server connection method, a computer readable storage medium, a terminal device, and an apparatus. The method in embodiments of the present application comprises: obtaining an identification of a terminal device; performing hash operation on the identification by using a first preset hash function to obtain a hash value of the terminal device; mapping the hash value of the terminal device onto a first node of a hash ring; obtaining reference nodes on the hash ring; searching for the reference nodes clockwise or counterclockwise from the first node, and determining a server corresponding to the first searched reference node to be a preferred server; and establishing a communication connection between the terminal device and the preferred server. A waste of server resources is reduced and the probability of message retransmission is significantly reduced.

Description

服务器连接方法、计算机可读存储介质、终端设备及装置Server connection method, computer readable storage medium, terminal device and device
本申请要求于2018年4月17日提交中国专利局、申请号为201810341964.0、发明名称为“一种服务器连接方法、计算机可读存储介质及终端设备”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims priority to Chinese Patent Application No. 201810341964.0, entitled "A Server Connection Method, Computer Readable Storage Media, and Terminal Equipment", filed on April 17, 2018, the entire contents of which are incorporated herein by reference. This is incorporated herein by reference.
技术领域Technical field
本申请属于计算机技术领域,尤其涉及一种服务器连接方法、计算机可读存储介质、终端设备及装置。The present application belongs to the field of computer technologies, and in particular, to a server connection method, a computer readable storage medium, a terminal device, and a device.
背景技术Background technique
消息推送的基础需要保持用户的终端设备与服务器建立的长连接。随着用户的终端设备数量不断增加,长连接服务器也需要随时横向扩容。目前建立长连接的方式是由用户的终端设备随机请求某台服务器来保持长连接。这种情况下,推送消息时就需要将消息分发给每一台服务器,由保持长连接的那一台服务器推送至用户的终端设备,不仅造成服务器资源的浪费,也增大消息重发的几率。The basics of message push need to maintain a long connection between the user's terminal device and the server. As the number of user terminals increases, the long connection server also needs to be scaled horizontally at any time. Currently, a long connection is established by the user's terminal device randomly requesting a server to maintain a long connection. In this case, when the message is pushed, the message needs to be distributed to each server, and the server that keeps the long connection is pushed to the user's terminal device, which not only causes waste of server resources, but also increases the probability of message retransmission. .
技术问题technical problem
有鉴于此,本申请实施例提供了一种服务器连接方法、计算机可读存储介质、终端设备及装置,以解决由用户的终端设备随机请求某台服务器来保持长连接所造成的服务器资源浪费以及消息重发几率增大的问题。In view of this, the embodiment of the present application provides a server connection method, a computer readable storage medium, a terminal device, and a device, to solve a waste of server resources caused by a user terminal device randomly requesting a server to maintain a long connection. The problem of increased chances of resending messages.
技术解决方案Technical solution
本申请实施例的第一方面提供了一种服务器连接方法,可以包括:A first aspect of the embodiment of the present application provides a server connection method, which may include:
获取终端设备的身份标识;Obtaining the identity of the terminal device;
使用预设的第一哈希函数对所述身份标识进行哈希运算,得到所述终端设备的哈希值;And performing a hash operation on the identifier by using a preset first hash function to obtain a hash value of the terminal device;
将所述终端设备的哈希值映射至哈希环的第一节点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,每个节点均为构成所述哈希环的一个函数值,所述第一节点为所述哈希环上的任意一个节点;Mapping the hash value of the terminal device to the first node of the hash ring, where the hash ring is connected clockwise or counterclockwise in order from all the functions of the first hash function in ascending order a ring formed by each node is a function value constituting the hash ring, and the first node is any one of the nodes on the hash ring;
获取所述哈希环上的各个基准节点,其中,每个基准节点均为所述哈希环上与一个服务器对应的节点;Obtaining each reference node on the hash ring, where each reference node is a node corresponding to one server on the hash ring;
从所述第一节点开始顺时针或者逆时针查找所述基准节点,并将查找到的第一个基准节点所对应的服务器确定为优选服务器;Searching the reference node clockwise or counterclockwise from the first node, and determining the server corresponding to the first reference node that is found as a preferred server;
建立所述终端设备与所述优选服务器之间的通信连接。Establishing a communication connection between the terminal device and the preferred server.
本申请实施例的第二方面提供了一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令被处理器执行时实现上述服务器连接方法的步骤。A second aspect of embodiments of the present application provides a computer readable storage medium storing computer readable instructions, the steps of implementing the server connection method when executed by a processor .
本申请实施例的第三方面提供了一种服务器连接终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现上述服务器连接方法的步骤。A third aspect of an embodiment of the present application provides a server connection terminal device including a memory, a processor, and computer readable instructions stored in the memory and executable on the processor, the processor executing the The steps of the above server connection method are implemented when the computer readable instructions are described.
本申请实施例的第四方面提供了一种服务器连接装置,可以包括用于实现上述服务器连接方法的步骤的模块。A fourth aspect of the embodiments of the present application provides a server connection apparatus, which may include a module for implementing the steps of the server connection method described above.
有益效果Beneficial effect
本申请实施例与现有技术相比存在的有益效果是:本申请实施例通过设置一个由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的哈希环,将服务器以及终端设备均映射至哈希环上,建立起了服务器与终端设备之间的空间对应关系,通过顺时针或者逆时针查找的方式即可确定出与终端设备对应的优选服务器,由于哈希运算发生碰撞的概率几乎可以忽略不计,因此通过这种方式确定出的优选服务器可视为是唯一的,从而减少了服务器资源的浪费,也大大降低了消息重发的几率。Compared with the prior art, the embodiment of the present application has the beneficial effects that: the embodiment of the present application is configured by sequentially connecting all the function values of the first hash function in a clockwise or counterclockwise sequence from small to large. The hash ring maps the server and the terminal device to the hash ring, establishes the spatial correspondence between the server and the terminal device, and determines the corresponding device corresponding to the terminal device by clockwise or counterclockwise searching. Preferably, the probability that the collision occurs due to the hash operation is almost negligible, so the preferred server determined in this way can be regarded as unique, thereby reducing the waste of server resources and greatly reducing the probability of message retransmission. .
附图说明DRAWINGS
图1为本申请实施例中一种服务器连接方法的一个实施例流程图;FIG. 1 is a flowchart of an embodiment of a server connection method according to an embodiment of the present application;
图2为哈希环的示意图;2 is a schematic diagram of a hash ring;
图3为终端设备的哈希值映射至哈希环的节点上的示意图;3 is a schematic diagram of a hash value of a terminal device mapped to a node of a hash ring;
图4为服务器的哈希值映射至哈希环的节点上的一种示意图;4 is a schematic diagram of a hash value of a server mapped to a node of a hash ring;
图5为服务器的哈希值映射至哈希环的节点上的另一种示意图;5 is another schematic diagram of a node whose hash value is mapped to a hash ring;
图6为本申请实施例中一种服务器连接装置的示意框图。FIG. 6 is a schematic block diagram of a server connection apparatus according to an embodiment of the present application.
图7为本申请实施例中一种服务器连接终端设备的示意框图。FIG. 7 is a schematic block diagram of a server connection terminal device according to an embodiment of the present application.
本发明的实施方式Embodiments of the invention
请参阅图1,本申请实施例中一种服务器连接方法的一个实施例可以包括:Referring to FIG. 1, an embodiment of a server connection method in an embodiment of the present application may include:
步骤S101、获取终端设备的身份标识。Step S101: Acquire an identity identifier of the terminal device.
终端设备的身份标识可以是指终端的国际移动设备身份码(International Mobile Equipment Identity,IMEI),国际移动设备身份码是由15位数字组成的电子串号,它与每个终端设备一一对应,而且该码是全世界唯一的。每一个终端设备在组装完成后都将被赋予一个全球唯一的号码,这个号码从生产到交付使用都将被制造生产的厂商所记录。The identity of the terminal device may refer to the International Mobile Equipment Identity (IMEI) of the terminal, and the international mobile device identity code is an electronic serial number consisting of 15 digits, which corresponds to each terminal device one by one. And the code is the only one in the world. Each terminal device will be assigned a globally unique number after assembly, and this number will be recorded by the manufacturer of the manufacturing from production to delivery.
步骤S102、使用预设的第一哈希函数对所述身份标识进行哈希运算,得到所述终端设备的哈希值。Step S102: Perform a hash operation on the identity identifier by using a preset first hash function to obtain a hash value of the terminal device.
所有的哈希函数都有如下一个基本特性:如果两个哈希值是不相同的(根据同一哈希函数),那么这两个哈希值的原始输入也是不相同的。这个特性使哈希函数具有确定性的结果。但另一方面,哈希函数的输入和输出不是唯一对应关系的,如果两个哈希值相同,两个输入值很可能是相同的,但也可能不同,这种情况称为“哈希碰撞”,这通常是两个不同的输入值,刻意计算出相同的输出值。但对于现有技术中常用的哈希函数而言,其发生碰撞的概率极低,几乎可以忽略不计,输入一些数据计算出哈希值,然后部分改变输入值,一个具有强混淆特性的哈希函数会产生一个完全不同的哈希值。All hash functions have one of the following basic properties: If the two hash values are not identical (based on the same hash function), the original input of the two hash values is also different. This feature gives the hash function a deterministic result. On the other hand, the input and output of the hash function are not unique. If the two hash values are the same, the two input values are likely to be the same, but they may be different. This case is called a "hash collision." "This is usually two different input values, deliberately calculating the same output value." However, for the hash function commonly used in the prior art, the probability of collision is extremely low, almost negligible, inputting some data to calculate a hash value, and then partially changing the input value, a hash with strong confusion characteristics. The function produces a completely different hash value.
本实施例中的第一哈希函数可以包括但不限于MD4、MD5、SHA1等任意一个现有技术中常用的哈希函数。The first hash function in this embodiment may include, but is not limited to, a hash function commonly used in the prior art such as MD4, MD5, and SHA1.
将获取到的终端设备的身份标识分别表示为:IMEI 1、IMEI 2、IMEI 3、……、IMEI m、……、IMEI M,其中,IMEI m为第m个终端设备的身份标识,1≤m≤M,M为终端设备的总个数。 The identifiers of the obtained terminal devices are respectively represented as: IMEI 1 , IMEI 2 , IMEI 3 , . . . , IMEI m , . . . , IMEI M , where IMEI m is the identity of the mth terminal device, 1≤ m ≤ M, M is the total number of terminal devices.
然后,计算各个终端设备的哈希值:Then, calculate the hash value of each terminal device:
Key m=HashFunc1(IMEI m) Key m =HashFunc1(IMEI m )
其中,HashFunc1为第一哈希函数,Key m为第m个终端设备的哈希值。 Among them, HashFunc1 is the first hash function, and Key m is the hash value of the mth terminal device.
步骤S103、将所述终端设备的哈希值映射至哈希环的第一节点。Step S103: Map the hash value of the terminal device to the first node of the hash ring.
所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,每个节点均为构成所述哈希环的一个函数值,若第一哈希函数的值域为[0,N],且以顺时针的顺序排列,则可构成如图2所示的哈希环。The hash ring is a ring formed by sequentially connecting all the function values of the first hash function in a clockwise or counterclockwise order from small to large, and each node is a one constituting the hash ring. The function value, if the value range of the first hash function is [0, N], and is arranged in a clockwise order, may constitute a hash ring as shown in FIG. 2.
所述第一节点为所述哈希环上的任意一个节点,其取值即为所述终端设备的哈希值。图3所示为4个终端设备的哈希值分别映射至哈希环的节点上的情形。The first node is any one of the nodes on the hash ring, and the value is a hash value of the terminal device. FIG. 3 shows a case where the hash values of the four terminal devices are respectively mapped to the nodes of the hash ring.
步骤S104、获取所述哈希环上的各个基准节点。Step S104: Acquire each reference node on the hash ring.
其中,每个基准节点均为所述哈希环上与一个服务器对应的节点。所述基准节点的设置过程包括:Each of the reference nodes is a node corresponding to one server on the hash ring. The setting process of the reference node includes:
获取各个服务器的身份标识,使用预设的第二哈希函数分别对各个服务器的身份标识进行哈希运算,得到各个服务器的哈希值,将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Obtaining the identity of each server, hashing the identity of each server by using a preset second hash function, obtaining a hash value of each server, and mapping the hash value of each server to the hash ring Above, each of the reference nodes is obtained.
其中,服务器的身份标识可以为服务器的IP地址,将获取到的服务器的身份标识分别表示为:IP 1、IP 2、IP 3、……、IP m′、……、IP M′,其中,IP m′为第m′个服务器的 身份标识,1≤m′≤M′,M′为服务器的总个数。 The identifier of the server may be an IP address of the server, and the identifiers of the obtained servers are respectively represented as: IP 1 , IP 2 , IP 3 , . . . , IP m′ , . . . , IP M′ , where IP m' is the identity of the mth server, 1 ≤ m' ≤ M', and M' is the total number of servers.
使用下式计算各个服务器的哈希值:Use the following formula to calculate the hash value for each server:
Key′ m′=HashFunc2(IP m′) Key'm' =HashFunc2(IP m' )
其中,HashFunc2为第二哈希函数,Key′ m′为第m′个服务器的哈希值,特别需要注意的是,所述第二哈希函数的值域与所述第一哈希函数的值域一致,以此保证两者可以映射到同一个哈希环上。 Where HashFunc2 is the second hash function, and Key'm' is the hash value of the mth server. It is particularly noted that the value range of the second hash function and the first hash function are The values are consistent, so that both can be mapped to the same hash ring.
图4所示为7个服务器的哈希值分别映射至哈希环的节点上的情形,Key′ 1、Key′ 2、Key′ 3、Key′ 4、Key′ 5、Key′ 6、Key′ 7所对应的节点即为所述基准节点。 Figure 4 shows the case where the hash values of the seven servers are mapped to the nodes of the hash ring, respectively, Key' 1 , Key' 2 , Key' 3 , Key' 4 , Key' 5 , Key' 6 , Key' The node corresponding to 7 is the reference node.
步骤S105、从所述第一节点开始顺时针或者逆时针查找所述基准节点,并将查找到的第一个基准节点所对应的服务器确定为优选服务器。Step S105: Find the reference node clockwise or counterclockwise from the first node, and determine the server corresponding to the first reference node that is found as a preferred server.
以图4中IMEI 1所对应的Key 1为例,从其所对应的节点,也即所述第一节点开始顺时针查找所述基准节点,查找到的第一个基准节点为Key′ 1,则将地址为IP 1的服务器确定为IMEI 1的优选服务器。使用同样的方法,可以确定地址为IP 3的服务器确定为IMEI 2的优选服务器、地址为IP 4的服务器确定为IMEI 3的优选服务器、地址为IP 6的服务器确定为IMEI 4的优选服务器。 In FIG. 4, the corresponding IMEI 1 Key 1, for example, from its corresponding node, i.e. the node starts to find the reference node clockwise, to find the first reference node Key '1, The server with the address IP 1 is determined as the preferred server of the IMEI 1 . Using the same method, it can be determined that the server whose address is IP 3 is determined to be the preferred server of IMEI 2 , the server whose address is IP 4 is determined to be the preferred server of IMEI 3 , and the server whose address is IP 6 is determined to be the preferred server of IMEI 4 .
类似地,若采用逆时针查找的方法,则可以确定地址为IP 7的服务器确定为IMEI 1的优选服务器、地址为IP 2的服务器确定为IMEI 2的优选服务器、地址为IP 3的服务器确定为IMEI 3的优选服务器、地址为IP 5的服务器确定为IMEI 4的优选服务器。 Similarly, if the counterclockwise search method is adopted, it may be determined that the server whose address is IP 7 is determined to be the preferred server of IMEI 1 , the server whose address is IP 2 is determined to be the preferred server of IMEI 2 , and the server whose address is IP 3 is determined as The preferred server of the IMEI 3 and the server of the IP 5 are determined as the preferred servers of the IMEI 4 .
步骤S106、建立所述终端设备与所述优选服务器之间的通信连接。Step S106: Establish a communication connection between the terminal device and the preferred server.
当建立了两者之间的通信连接之后,推送消息时就无需将消息分发给每一台服务器,而是只将消息发送给目标终端设备的优选服务器,由优选服务器将消息推送至目标终端设备,从而减少了服务器资源的浪费,也大大降低了消息重发的几率。After the communication connection between the two is established, it is not necessary to distribute the message to each server when pushing the message, but only the message is sent to the preferred server of the target terminal device, and the message is pushed by the preferred server to the target terminal device. , thereby reducing the waste of server resources, and greatly reducing the probability of message retransmission.
进一步地,考虑到不同的服务器的处理能力是不同的,可以根据服务器的处理能力为不同的服务器设置不同的映射位置的个数。例如,服务器处理能力由高到低依次为:服务器1、服务器2、服务器3。则将服务器1的映射位置设置为3个,将服务器2的映射位置设置为2个,将服务器1的映射位置设置为1个。具体地,将服务器1的IP地址IP 1扩展为3个虚拟IP:IP 1_1、IP 1_2、IP 1_3,将服务器2的IP地址IP 2扩展为2个虚拟IP:IP 2_1、IP 2_2、IP 1_3,将服务器3的IP地址IP 3保持不变,则各个IP哈希值在哈希环上对应的节点如图5所示。 Further, considering that the processing capabilities of different servers are different, the number of different mapping locations may be set for different servers according to the processing capability of the server. For example, the server processing power from high to low is: server 1, server 2, server 3. Then, the mapping position of the server 1 is set to three, the mapping position of the server 2 is set to two, and the mapping position of the server 1 is set to one. Specifically, the IP address IP 1 of the server 1 is expanded to three virtual IPs: IP 1_1 , IP 1_2 , IP 1_3 , and the IP address IP 2 of the server 2 is expanded to two virtual IPs: IP 2_1 , IP 2_2 , IP 1_3 The IP address IP 3 of the server 3 is kept unchanged, and the corresponding node of each IP hash value on the hash ring is as shown in FIG. 5 .
根据这一思路,步骤S104中的所述基准节点还可以通过以下过程进行设置:According to this idea, the reference node in step S104 can also be set by the following process:
首先,获取各个服务器的身份标识。First, get the identity of each server.
然后,根据下式计算各个服务器的扩展身份标识:Then, calculate the extended identity of each server according to the following formula:
Ext_ServerIDm,n=ExtFunc(ServerIDm,n)Ext_ServerIDm, n=ExtFunc(ServerIDm,n)
其中,m为服务器的序号,1≤m≤M,M为服务器的总数,ServerIDm为第m个服务器的身份标识,n为扩展身份标识的序号,所述扩展身份标识即可为前述的虚拟IP,1≤n≤Nm,Nm为第m个服务器的扩展身份标识的总数,Nm与第m个服务器的中央处理器的主频正相关,且与第m个服务器的内存容量正相关,即中央处理器的主频越高,且内存容量越大,则扩展身份标识的总数也越大,反之,中央处理器的主频越低,且内存容量越小,则扩展身份标识的总数也越小。ExtFunc为预设的函数,在其中的一种实现中,ExtFunc(ServerIDm,n)=ServerIDm∪.n,即在ServerIDm之后再加入一个.n后缀,若ServerIDm=120.132.55.7,则ExtFunc(ServerIDm,1)=120.132.55.7.1,Ext_ServerIDm,n为第m个服务器的第n个扩展身份标识;Where m is the serial number of the server, 1≤m≤M, M is the total number of servers, ServerIDm is the identity of the mth server, n is the serial number of the extended identity, and the extended identity can be the aforementioned virtual IP , 1≤n≤Nm, Nm is the total number of extended identity identifiers of the mth server, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively correlated with the memory capacity of the mth server, that is, the central The higher the main frequency of the processor and the larger the memory capacity, the larger the total number of extended identities. Conversely, the lower the main frequency of the central processing unit and the smaller the memory capacity, the smaller the total number of extended identities. . ExtFunc is a preset function. In one of the implementations, ExtFunc(ServerIDm,n)=ServerIDm∪.n, that is, add a .n suffix after ServerIDm. If ServerIDm=120.132.55.7, then ExtFunc(ServerIDm, 1) = 120.132.55.7.1, Ext_ServerIDm, where n is the nth extended identity of the mth server;
再使用预设的第二哈希函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致。Then, using the preset second hash function, respectively hashing the extended identity of each server to obtain a hash value of each server, and the value range of the second hash function and the first hash function The values are consistent.
最后,将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Finally, the hash values of the respective servers are mapped onto the hash ring to obtain each of the reference nodes.
此时,需要注意,图5中服务器1的3个虚拟IP节点对应的服务器均为服务器1,服务器2的2个虚拟IP节点对应的服务器均为服务器2。At this time, it should be noted that the servers corresponding to the three virtual IP nodes of the server 1 in FIG. 5 are both the server 1, and the servers corresponding to the two virtual IP nodes of the server 2 are the servers 2.
进一步地,所述第二哈希函数的一种设置方法可以包括:Further, a setting method of the second hash function may include:
从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数。A hash function is arbitrarily selected from the preset hash function set as a candidate function, and the hash function set includes more than one hash function.
使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值。The candidate function is used to hash the extended identity of each server to obtain a hash value of each server.
根据下式构造哈希值序列:Construct a sequence of hash values according to the following formula:
HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
Figure PCTCN2018093342-appb-000001
hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合。
Where 1≤tn≤TN, TN is the total number of hash values of each server, and
Figure PCTCN2018093342-appb-000001
Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a collection of hash values from each server.
根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
Figure PCTCN2018093342-appb-000002
Figure PCTCN2018093342-appb-000002
其中,HashMax为所述候选函数的最大函数值,EvenDeg为所述候选函数的均匀度。Where HashMax is the maximum function value of the candidate function, and EvenDeg is the uniformity of the candidate function.
若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希 函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
进一步地,所述第二哈希函数的另一种设置方法可以包括:Further, another setting method of the second hash function may include:
从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数。A hash function is arbitrarily selected from the preset hash function set as a candidate function, and the hash function set includes more than one hash function.
使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值。The candidate function is used to hash the extended identity of each server to obtain a hash value of each server.
根据下式构造各个哈希值序列:Construct a sequence of hash values according to the following formula:
HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
Figure PCTCN2018093342-appb-000003
Figure PCTCN2018093342-appb-000003
其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
Figure PCTCN2018093342-appb-000004
hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合,hashv m,n∈HashValueSet m,且hashv m,n≤hashv m,n+1,HashValueSet m为由第m个服务器的哈希值组成的集合。
Where 1≤tn≤TN, TN is the total number of hash values of each server, and
Figure PCTCN2018093342-appb-000004
Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set of hash values from each server, hashv m,n ∈HashValueSet m , and hashv m,n ≤hashv m,n+1 ,HashValueSet m A collection consisting of the hash values of the mth server.
根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
Figure PCTCN2018093342-appb-000005
Figure PCTCN2018093342-appb-000005
其中,HashMax为所述候选函数的最大函数值,η为预设的比例系数,EvenDeg为所述候选函数的均匀度。Where HashMax is the maximum function value of the candidate function, η is a preset proportional coefficient, and EvenDeg is the uniformity of the candidate function.
若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
综上所述,本申请实施例通过设置一个由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的哈希环,将服务器以及终端设备均映射至哈希环上,建立起了服务器与终端设备之间的空间对应关系,通过顺时针或者 逆时针查找的方式即可确定出与终端设备对应的优选服务器,由于哈希运算发生碰撞的概率几乎可以忽略不计,因此通过这种方式确定出的优选服务器可视为是唯一的,从而减少了服务器资源的浪费,也大大降低了消息重发的几率。In summary, the embodiment of the present application sets a hash ring formed by sequentially connecting all the function values of the first hash function in a clockwise or counterclockwise order from small to large, and the server and the terminal device are both Mapping to the hash ring, establishing a spatial correspondence between the server and the terminal device, and determining the preferred server corresponding to the terminal device by clockwise or counterclockwise searching, the probability of collision due to hash operation It is almost negligible, so the preferred server determined in this way can be regarded as unique, which reduces the waste of server resources and greatly reduces the chance of message retransmission.
对应于上文实施例所述的一种服务器连接方法,图6示出了本申请实施例提供的一种服务器连接装置的一个实施例结构图。Corresponding to a server connection method described in the foregoing embodiment, FIG. 6 is a structural diagram of an embodiment of a server connection apparatus according to an embodiment of the present application.
本实施例中,一种服务器连接装置可以包括:In this embodiment, a server connection device may include:
终端标识获取模块601,用于获取终端设备的身份标识;The terminal identifier obtaining module 601 is configured to acquire an identity identifier of the terminal device.
第一哈希运算模块602,用于使用预设的第一哈希函数对所述身份标识进行哈希运算,得到所述终端设备的哈希值;The first hash operation module 602 is configured to perform hash operation on the identity identifier by using a preset first hash function to obtain a hash value of the terminal device.
第一映射模块603,用于将所述终端设备的哈希值映射至哈希环的第一节点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,每个节点均为构成所述哈希环的一个函数值,所述第一节点为所述哈希环上的任意一个节点;a first mapping module 603, configured to map a hash value of the terminal device to a first node of a hash ring, where the hash ring is a function of all functions of the first hash function from small to large Arranging the formed rings sequentially in a clockwise or counterclockwise manner, each node is a function value constituting the hash ring, and the first node is any one of the nodes on the hash ring;
基准节点获取模块604,用于获取所述哈希环上的各个基准节点,其中,每个基准节点均为所述哈希环上与一个服务器对应的节点;a reference node obtaining module 604, configured to acquire each reference node on the hash ring, where each reference node is a node corresponding to one server on the hash ring;
优选服务器确定模块605,用于从所述第一节点开始顺时针或者逆时针查找所述基准节点,并将查找到的第一个基准节点所对应的服务器确定为优选服务器;a server determining module 605, configured to search the reference node clockwise or counterclockwise from the first node, and determine a server corresponding to the first reference node that is found as a preferred server;
通信连接建立模块606,用于建立所述终端设备与所述优选服务器之间的通信连接。The communication connection establishing module 606 is configured to establish a communication connection between the terminal device and the preferred server.
可选地,所述服务器连接装置还可以包括:Optionally, the server connection device may further include:
服务器标识获取模块,用于获取各个服务器的身份标识;a server identifier obtaining module, configured to acquire an identity of each server;
第二哈希运算模块,用于使用预设的第二哈希函数分别对各个服务器的身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;a second hash operation module, configured to hash the identity of each server by using a preset second hash function, to obtain a hash value of each server, and a value field of the second hash function The value range of the first hash function is consistent;
第二映射模块,用于将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。And a second mapping module, configured to map hash values of the respective servers to the hash ring to obtain each of the reference nodes.
可选地,所述服务器连接装置还可以包括:Optionally, the server connection device may further include:
身份标识扩展模块,用于根据下式计算各个服务器的扩展身份标识:An identity extension module for calculating an extended identity of each server according to the following formula:
Ext_ServerIDm,n=ExtFunc(ServerIDm,n)Ext_ServerIDm, n=ExtFunc(ServerIDm,n)
其中,m为服务器的序号,1≤m≤M,M为服务器的总数,ServerIDm为第m个服务器的身份标识,n为扩展身份标识的序号,1≤n≤Nm,Nm为第m个服务器的扩 展身份标识的总数,Nm与第m个服务器的中央处理器的主频正相关,且与第m个服务器的内存容量正相关,ExtFunc为预设的函数,Ext_ServerIDm,n为第m个服务器的第n个扩展身份标识。Where m is the serial number of the server, 1≤m≤M, M is the total number of servers, ServerIDm is the identity of the mth server, n is the serial number of the extended identity, 1≤n≤Nm, and Nm is the mth server The total number of extended identities, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively related to the memory capacity of the mth server, ExtFunc is the default function, Ext_ServerIDm, n is the mth server The nth extended identity.
可选地,所述服务器连接装置还可以包括:Optionally, the server connection device may further include:
候选函数选取模块,用于从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;a candidate function selection module, configured to arbitrarily select one hash function from the preset hash function set as a candidate function, the hash function set includes one or more hash functions;
哈希运算模块,用于使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;a hash operation module, configured to hash the extended identity of each server by using the candidate function, to obtain a hash value of each server;
第一序列构造模块,用于根据下式构造哈希值序列:The first sequence construction module is configured to construct a sequence of hash values according to the following formula:
HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
Figure PCTCN2018093342-appb-000006
hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合;
Where 1≤tn≤TN, TN is the total number of hash values of each server, and
Figure PCTCN2018093342-appb-000006
Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set consisting of hash values of the respective servers;
第一均匀度计算模块,用于根据下式计算所述候选函数的均匀度:a first uniformity calculation module, configured to calculate a uniformity of the candidate function according to the following formula:
Figure PCTCN2018093342-appb-000007
Figure PCTCN2018093342-appb-000007
其中,HashMax为所述候选函数的最大函数值,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, and EvenDeg is the uniformity of the candidate function;
候选函数删除模块,用于若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除;a candidate function deleting module, configured to delete the candidate function from the hash function set if a uniformity of the candidate function is greater than a preset uniformity threshold;
函数确定模块,用于若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。The function determining module is configured to determine the candidate function as the second hash function if the uniformity of the candidate function is less than or equal to a preset uniformity threshold.
可选地,所述服务器连接装置还可以包括:Optionally, the server connection device may further include:
第二序列构造模块,用于根据下式构造各个哈希值序列:The second sequence construction module is configured to construct each hash value sequence according to the following formula:
HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
Figure PCTCN2018093342-appb-000008
Figure PCTCN2018093342-appb-000008
其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
Figure PCTCN2018093342-appb-000009
hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合,hashv m,n∈HashValueSet m,且hashv m,n≤hashv m,n+1,HashValueSet m为由第m个服务器的哈希值组成的集合;
Where 1≤tn≤TN, TN is the total number of hash values of each server, and
Figure PCTCN2018093342-appb-000009
Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set of hash values from each server, hashv m,n ∈HashValueSet m , and hashv m,n ≤hashv m,n+1 ,HashValueSet m a collection consisting of the hash values of the mth server;
第二均匀度计算模块,用于根据下式计算所述候选函数的均匀度:a second uniformity calculation module, configured to calculate a uniformity of the candidate function according to the following formula:
Figure PCTCN2018093342-appb-000010
Figure PCTCN2018093342-appb-000010
其中,HashMax为所述候选函数的最大函数值,η为预设的比例系数,EvenDeg为所述候选函数的均匀度。Where HashMax is the maximum function value of the candidate function, η is a preset proportional coefficient, and EvenDeg is the uniformity of the candidate function.
图7示出了本申请实施例提供的一种服务器连接终端设备的示意框图,为了便于说明,仅示出了与本申请实施例相关的部分。FIG. 7 is a schematic block diagram of a server connection terminal device provided by an embodiment of the present application. For convenience of description, only parts related to the embodiment of the present application are shown.
在本实施例中,所述服务器连接终端设备7可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。该服务器连接终端设备7可包括:处理器70、存储器71以及存储在所述存储器71中并可在所述处理器70上运行的计算机可读指令72,例如执行上述的服务器连接方法的计算机可读指令。所述处理器70执行所述计算机可读指令72时实现上述各个服务器连接方法实施例中的步骤。In this embodiment, the server connection terminal device 7 may be a computing device such as a desktop computer, a notebook, a palmtop computer, and a cloud server. The server connection terminal device 7 may include a processor 70, a memory 71, and computer readable instructions 72 stored in the memory 71 and operable on the processor 70, such as a computer executing the server connection method described above. Read the instruction. When the processor 70 executes the computer readable instructions 72, the steps in the above embodiments of the respective server connection methods are implemented.
在本申请各个实施例中的各功能单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读存储介质中。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干计算机可读指令用以使得一台计算机设备执行本申请各个实施例所述方法的全部或部分步骤。The functional units in the various embodiments of the present application may be stored in a computer readable storage medium if implemented in the form of a software functional unit and sold or used as a separate product. Based on such understanding, the technical solution of the present application, in essence or the contribution to the prior art, or all or part of the technical solution may be embodied in the form of a software product stored in a storage medium. A number of computer readable instructions are included to cause a computer device to perform all or part of the steps of the methods described in various embodiments of the present application.

Claims (20)

  1. 一种服务器连接方法,其特征在于,包括:A server connection method, comprising:
    获取终端设备的身份标识;Obtaining the identity of the terminal device;
    使用预设的第一哈希函数对所述身份标识进行哈希运算,得到所述终端设备的哈希值;And performing a hash operation on the identifier by using a preset first hash function to obtain a hash value of the terminal device;
    将所述终端设备的哈希值映射至哈希环的第一节点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,每个节点均为构成所述哈希环的一个函数值,所述第一节点为所述哈希环上的任意一个节点;Mapping the hash value of the terminal device to the first node of the hash ring, where the hash ring is connected clockwise or counterclockwise in order from all the functions of the first hash function in ascending order a ring formed by each node is a function value constituting the hash ring, and the first node is any one of the nodes on the hash ring;
    获取所述哈希环上的各个基准节点,其中,每个基准节点均为所述哈希环上与一个服务器对应的节点;Obtaining each reference node on the hash ring, where each reference node is a node corresponding to one server on the hash ring;
    从所述第一节点开始顺时针或者逆时针查找所述基准节点,并将查找到的第一个基准节点所对应的服务器确定为优选服务器;Searching the reference node clockwise or counterclockwise from the first node, and determining the server corresponding to the first reference node that is found as a preferred server;
    建立所述终端设备与所述优选服务器之间的通信连接。Establishing a communication connection between the terminal device and the preferred server.
  2. 根据权利要求1所述的服务器连接方法,其特征在于,所述基准节点的设置过程包括:The server connection method according to claim 1, wherein the setting process of the reference node comprises:
    获取各个服务器的身份标识;Obtain the identity of each server;
    使用预设的第二哈希函数分别对各个服务器的身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;Performing a hash operation on the identifiers of the respective servers by using a preset second hash function to obtain a hash value of each server, a value range of the second hash function and a value range of the first hash function Consistent
    将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Mapping the hash values of the respective servers onto the hash ring to obtain each of the reference nodes.
  3. 根据权利要求1所述的服务器连接方法,其特征在于,所述基准节点的设置过程包括:The server connection method according to claim 1, wherein the setting process of the reference node comprises:
    获取各个服务器的身份标识;Obtain the identity of each server;
    根据下式计算各个服务器的扩展身份标识:Calculate the extended identity of each server according to the following formula:
    Ext_ServerIDm,n=ExtFunc(ServerIDm,n)Ext_ServerIDm, n=ExtFunc(ServerIDm,n)
    其中,m为服务器的序号,1≤m≤M,M为服务器的总数,ServerIDm为第m个服务器的身份标识,n为扩展身份标识的序号,1≤n≤Nm,Nm为第m个服务器的扩展身份标识的总数,Nm与第m个服务器的中央处理器的主频正相关,且与第m个服务器的内存容量正相关,ExtFunc为预设的函数,Ext_ServerIDm,n为第m个服务器的第n个扩展身份标识;Where m is the serial number of the server, 1≤m≤M, M is the total number of servers, ServerIDm is the identity of the mth server, n is the serial number of the extended identity, 1≤n≤Nm, and Nm is the mth server The total number of extended identities, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively related to the memory capacity of the mth server, ExtFunc is the default function, Ext_ServerIDm, n is the mth server The nth extended identity;
    使用预设的第二哈希函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;Performing a hash operation on the extended identity of each server by using a preset second hash function to obtain a hash value of each server, a value range of the second hash function and a value of the first hash function Domain consistent;
    将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Mapping the hash values of the respective servers onto the hash ring to obtain each of the reference nodes.
  4. 根据权利要求3所述的服务器连接方法,其特征在于,所述第二哈希函数的设置过程包括:The server connection method according to claim 3, wherein the setting process of the second hash function comprises:
    从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;Arbitrarily selecting a hash function as a candidate function from a preset set of hash functions, the hash function set including more than one hash function;
    使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;Using the candidate function, respectively hashing the extended identity of each server to obtain a hash value of each server;
    根据下式构造哈希值序列:Construct a sequence of hash values according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100001
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100001
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set consisting of hash values of the respective servers;
    根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
    Figure PCTCN2018093342-appb-100002
    Figure PCTCN2018093342-appb-100002
    其中,HashMax为所述候选函数的最大函数值,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, and EvenDeg is the uniformity of the candidate function;
    若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
    若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
  5. 根据权利要求3所述的服务器连接方法,其特征在于,所述第二哈希函数的设置过程包括:The server connection method according to claim 3, wherein the setting process of the second hash function comprises:
    从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;Arbitrarily selecting a hash function as a candidate function from a preset set of hash functions, the hash function set including more than one hash function;
    使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;Using the candidate function, respectively hashing the extended identity of each server to obtain a hash value of each server;
    根据下式构造各个哈希值序列:Construct a sequence of hash values according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    Figure PCTCN2018093342-appb-100003
    Figure PCTCN2018093342-appb-100003
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100004
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合,hashv m,n∈HashValueSet m,且hashv m,n≤hashv m,n+1,HashValueSet m为由第m个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100004
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set of hash values from each server, hashv m,n ∈HashValueSet m , and hashv m,n ≤hashv m,n+1 ,HashValueSet m a collection consisting of the hash values of the mth server;
    根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
    Figure PCTCN2018093342-appb-100005
    Figure PCTCN2018093342-appb-100005
    其中,HashMax为所述候选函数的最大函数值,η为预设的比例系数,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, η is a preset proportional coefficient, and EvenDeg is the uniformity of the candidate function;
    若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
    若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
  6. 一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现如下步骤:A computer readable storage medium storing computer readable instructions, wherein the computer readable instructions, when executed by a processor, implement the following steps:
    获取终端设备的身份标识;Obtaining the identity of the terminal device;
    使用预设的第一哈希函数对所述身份标识进行哈希运算,得到所述终端设备的哈希值;And performing a hash operation on the identifier by using a preset first hash function to obtain a hash value of the terminal device;
    将所述终端设备的哈希值映射至哈希环的第一节点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,每个节点均为构成所述哈希环的一个函数值,所述第一节点为所述哈希环上的任意一个节点;Mapping the hash value of the terminal device to the first node of the hash ring, where the hash ring is connected clockwise or counterclockwise in order from all the functions of the first hash function in ascending order a ring formed by each node is a function value constituting the hash ring, and the first node is any one of the nodes on the hash ring;
    获取所述哈希环上的各个基准节点,其中,每个基准节点均为所述哈希环上与一个服务器对应的节点;Obtaining each reference node on the hash ring, where each reference node is a node corresponding to one server on the hash ring;
    从所述第一节点开始顺时针或者逆时针查找所述基准节点,并将查找到的第一个基准节点所对应的服务器确定为优选服务器;Searching the reference node clockwise or counterclockwise from the first node, and determining the server corresponding to the first reference node that is found as a preferred server;
    建立所述终端设备与所述优选服务器之间的通信连接。Establishing a communication connection between the terminal device and the preferred server.
  7. 根据权利要求6所述的计算机可读存储介质,其特征在于,所述基准节点的设置过程包括:The computer readable storage medium according to claim 6, wherein the setting process of the reference node comprises:
    获取各个服务器的身份标识;Obtain the identity of each server;
    使用预设的第二哈希函数分别对各个服务器的身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;Performing a hash operation on the identifiers of the respective servers by using a preset second hash function to obtain a hash value of each server, a value range of the second hash function and a value range of the first hash function Consistent
    将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Mapping the hash values of the respective servers onto the hash ring to obtain each of the reference nodes.
  8. 根据权利要求6所述的计算机可读存储介质,其特征在于,所述基准节点的设置过程包括:The computer readable storage medium according to claim 6, wherein the setting process of the reference node comprises:
    获取各个服务器的身份标识;Obtain the identity of each server;
    根据下式计算各个服务器的扩展身份标识:Calculate the extended identity of each server according to the following formula:
    Ext_ServerIDm,n=ExtFunc(ServerIDm,n)Ext_ServerIDm, n=ExtFunc(ServerIDm,n)
    其中,m为服务器的序号,1≤m≤M,M为服务器的总数,ServerIDm为第m个服务器的身份标识,n为扩展身份标识的序号,1≤n≤Nm,Nm为第m个服务器的扩展身份标识的总数,Nm与第m个服务器的中央处理器的主频正相关,且与第m个服务器的内存容量正相关,ExtFunc为预设的函数,Ext_ServerIDm,n为第m个服务器的第n个扩展身份标识;Where m is the serial number of the server, 1≤m≤M, M is the total number of servers, ServerIDm is the identity of the mth server, n is the serial number of the extended identity, 1≤n≤Nm, and Nm is the mth server The total number of extended identities, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively related to the memory capacity of the mth server, ExtFunc is the default function, Ext_ServerIDm, n is the mth server The nth extended identity;
    使用预设的第二哈希函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;Performing a hash operation on the extended identity of each server by using a preset second hash function to obtain a hash value of each server, a value range of the second hash function and a value of the first hash function Domain consistent;
    将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Mapping the hash values of the respective servers onto the hash ring to obtain each of the reference nodes.
  9. 根据权利要求8所述的计算机可读存储介质,其特征在于,所述第二哈希函数的设置过程包括:The computer readable storage medium according to claim 8, wherein the setting process of the second hash function comprises:
    从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;Arbitrarily selecting a hash function as a candidate function from a preset set of hash functions, the hash function set including more than one hash function;
    使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;Using the candidate function, respectively hashing the extended identity of each server to obtain a hash value of each server;
    根据下式构造哈希值序列:Construct a sequence of hash values according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100006
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100006
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set consisting of hash values of the respective servers;
    根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
    Figure PCTCN2018093342-appb-100007
    Figure PCTCN2018093342-appb-100007
    其中,HashMax为所述候选函数的最大函数值,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, and EvenDeg is the uniformity of the candidate function;
    若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
    若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
  10. 根据权利要求8所述的计算机可读存储介质,其特征在于,所述第二哈希函数的设置过程包括:The computer readable storage medium according to claim 8, wherein the setting process of the second hash function comprises:
    从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;Arbitrarily selecting a hash function as a candidate function from a preset set of hash functions, the hash function set including more than one hash function;
    使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;Using the candidate function, respectively hashing the extended identity of each server to obtain a hash value of each server;
    根据下式构造各个哈希值序列:Construct a sequence of hash values according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    Figure PCTCN2018093342-appb-100008
    Figure PCTCN2018093342-appb-100008
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100009
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合,hashv m,n∈HashValueSet m,且hashv m,n≤hashv m,n+1,HashValueSet m为由第m个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100009
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set of hash values from each server, hashv m,n ∈HashValueSet m , and hashv m,n ≤hashv m,n+1 ,HashValueSet m a collection consisting of the hash values of the mth server;
    根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
    Figure PCTCN2018093342-appb-100010
    Figure PCTCN2018093342-appb-100010
    其中,HashMax为所述候选函数的最大函数值,η为预设的比例系数,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, η is a preset proportional coefficient, and EvenDeg is the uniformity of the candidate function;
    若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
    若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
  11. 一种服务器连接终端设备,包括存储器、处理器以及存储在所述存储器中并可在所述处理器上运行的计算机可读指令,其特征在于,所述处理器执行所述计算机可读指令时实现如下步骤:A server connection terminal device comprising a memory, a processor, and computer readable instructions stored in the memory and operable on the processor, wherein when the processor executes the computer readable instructions Implement the following steps:
    获取终端设备的身份标识;Obtaining the identity of the terminal device;
    使用预设的第一哈希函数对所述身份标识进行哈希运算,得到所述终端设备的哈希值;And performing a hash operation on the identifier by using a preset first hash function to obtain a hash value of the terminal device;
    将所述终端设备的哈希值映射至哈希环的第一节点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,每个节点均为构成所述哈希环的一个函数值,所述第一节点为所述哈希环上的任意一个节点;Mapping the hash value of the terminal device to the first node of the hash ring, where the hash ring is connected clockwise or counterclockwise in order from all the functions of the first hash function in ascending order a ring formed by each node is a function value constituting the hash ring, and the first node is any one of the nodes on the hash ring;
    获取所述哈希环上的各个基准节点,其中,每个基准节点均为所述哈希环上与一个服务器对应的节点;Obtaining each reference node on the hash ring, where each reference node is a node corresponding to one server on the hash ring;
    从所述第一节点开始顺时针或者逆时针查找所述基准节点,并将查找到的第一个基准节点所对应的服务器确定为优选服务器;Searching the reference node clockwise or counterclockwise from the first node, and determining the server corresponding to the first reference node that is found as a preferred server;
    建立所述终端设备与所述优选服务器之间的通信连接。Establishing a communication connection between the terminal device and the preferred server.
  12. 根据权利要求11所述的服务器连接终端设备,其特征在于,所述基准节点的设置过程包括:The server connection terminal device according to claim 11, wherein the setting process of the reference node comprises:
    获取各个服务器的身份标识;Obtain the identity of each server;
    使用预设的第二哈希函数分别对各个服务器的身份标识进行哈希运算,得到各个 服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;Performing a hash operation on the identifiers of the respective servers by using a preset second hash function to obtain a hash value of each server, a value range of the second hash function and a value range of the first hash function Consistent
    将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Mapping the hash values of the respective servers onto the hash ring to obtain each of the reference nodes.
  13. 根据权利要求12所述的服务器连接终端设备,其特征在于,所述基准节点的设置过程包括:The server connection terminal device according to claim 12, wherein the setting process of the reference node comprises:
    获取各个服务器的身份标识;Obtain the identity of each server;
    根据下式计算各个服务器的扩展身份标识:Calculate the extended identity of each server according to the following formula:
    Ext_ServerIDm,n=ExtFunc(ServerIDm,n)Ext_ServerIDm, n=ExtFunc(ServerIDm,n)
    其中,m为服务器的序号,1≤m≤M,M为服务器的总数,ServerIDm为第m个服务器的身份标识,n为扩展身份标识的序号,1≤n≤Nm,Nm为第m个服务器的扩展身份标识的总数,Nm与第m个服务器的中央处理器的主频正相关,且与第m个服务器的内存容量正相关,ExtFunc为预设的函数,Ext_ServerIDm,n为第m个服务器的第n个扩展身份标识;Where m is the serial number of the server, 1≤m≤M, M is the total number of servers, ServerIDm is the identity of the mth server, n is the serial number of the extended identity, 1≤n≤Nm, and Nm is the mth server The total number of extended identities, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively related to the memory capacity of the mth server, ExtFunc is the default function, Ext_ServerIDm, n is the mth server The nth extended identity;
    使用预设的第二哈希函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;Performing a hash operation on the extended identity of each server by using a preset second hash function to obtain a hash value of each server, a value range of the second hash function and a value of the first hash function Domain consistent;
    将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。Mapping the hash values of the respective servers onto the hash ring to obtain each of the reference nodes.
  14. 根据权利要求13所述的服务器连接终端设备,其特征在于,所述第二哈希函数的设置过程包括:The server connection terminal device according to claim 13, wherein the setting process of the second hash function comprises:
    从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;Arbitrarily selecting a hash function as a candidate function from a preset set of hash functions, the hash function set including more than one hash function;
    使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;Using the candidate function, respectively hashing the extended identity of each server to obtain a hash value of each server;
    根据下式构造哈希值序列:Construct a sequence of hash values according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100011
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100011
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set consisting of hash values of the respective servers;
    根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
    Figure PCTCN2018093342-appb-100012
    Figure PCTCN2018093342-appb-100012
    其中,HashMax为所述候选函数的最大函数值,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, and EvenDeg is the uniformity of the candidate function;
    若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
    若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
  15. 根据权利要求13所述的服务器连接终端设备,其特征在于,所述第二哈希函数的设置过程包括:The server connection terminal device according to claim 13, wherein the setting process of the second hash function comprises:
    从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;Arbitrarily selecting a hash function as a candidate function from a preset set of hash functions, the hash function set including more than one hash function;
    使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;Using the candidate function, respectively hashing the extended identity of each server to obtain a hash value of each server;
    根据下式构造各个哈希值序列:Construct a sequence of hash values according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    Figure PCTCN2018093342-appb-100013
    Figure PCTCN2018093342-appb-100013
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100014
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合,hashv m,n∈HashValueSet m,且hashv m,n≤hashv m,n+1,HashValueSet m为由第m个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100014
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set of hash values from each server, hashv m,n ∈HashValueSet m , and hashv m,n ≤hashv m,n+1 ,HashValueSet m a collection consisting of the hash values of the mth server;
    根据下式计算所述候选函数的均匀度:The uniformity of the candidate function is calculated according to the following formula:
    Figure PCTCN2018093342-appb-100015
    Figure PCTCN2018093342-appb-100015
    其中,HashMax为所述候选函数的最大函数值,η为预设的比例系数,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, η is a preset proportional coefficient, and EvenDeg is the uniformity of the candidate function;
    若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希 函数集合中删除,然后返回执行所述从预设的哈希函数集合中任意选取一个哈希函数作为候选函数的步骤;If the uniformity of the candidate function is greater than a preset uniformity threshold, deleting the candidate function from the hash function set, and then returning to perform the arbitrarily selecting one of the preset hash function sets. The step of the Greek function as a candidate function;
    若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。If the uniformity of the candidate function is less than or equal to a preset uniformity threshold, the candidate function is determined as a second hash function.
  16. 一种服务器连接装置,其特征在于,包括:A server connection device, comprising:
    终端标识获取模块,用于获取终端设备的身份标识;a terminal identifier obtaining module, configured to acquire an identity identifier of the terminal device;
    第一哈希运算模块,用于使用预设的第一哈希函数对所述身份标识进行哈希运算,得到所述终端设备的哈希值;a first hash operation module, configured to perform a hash operation on the identity identifier by using a preset first hash function, to obtain a hash value of the terminal device;
    第一映射模块,用于将所述终端设备的哈希值映射至哈希环的第一节点,所述哈希环为由所述第一哈希函数的所有函数值按照从小到大的顺序顺时针或者逆时针依次连接所构成的圆环,每个节点均为构成所述哈希环的一个函数值,所述第一节点为所述哈希环上的任意一个节点;a first mapping module, configured to map a hash value of the terminal device to a first node of a hash ring, where the hash ring is in a descending order of all function values of the first hash function Connecting the formed ring in a clockwise or counterclockwise manner, each node is a function value constituting the hash ring, and the first node is any one of the nodes on the hash ring;
    基准节点获取模块,用于获取所述哈希环上的各个基准节点,其中,每个基准节点均为所述哈希环上与一个服务器对应的节点;a reference node obtaining module, configured to acquire each reference node on the hash ring, where each reference node is a node corresponding to one server on the hash ring;
    优选服务器确定模块,用于从所述第一节点开始顺时针或者逆时针查找所述基准节点,并将查找到的第一个基准节点所对应的服务器确定为优选服务器;a server determining module, configured to search the reference node clockwise or counterclockwise from the first node, and determine a server corresponding to the first reference node that is found as a preferred server;
    通信连接建立模块,用于建立所述终端设备与所述优选服务器之间的通信连接。And a communication connection establishing module, configured to establish a communication connection between the terminal device and the preferred server.
  17. 根据权利要求16所述的服务器连接装置,其特征在于,还包括:The server connection device according to claim 16, further comprising:
    服务器标识获取模块,用于获取各个服务器的身份标识;a server identifier obtaining module, configured to acquire an identity of each server;
    第二哈希运算模块,用于使用预设的第二哈希函数分别对各个服务器的身份标识进行哈希运算,得到各个服务器的哈希值,所述第二哈希函数的值域与所述第一哈希函数的值域一致;a second hash operation module, configured to hash the identity of each server by using a preset second hash function, to obtain a hash value of each server, and a value field of the second hash function The value range of the first hash function is consistent;
    第二映射模块,用于将各个服务器的哈希值映射至所述哈希环上,得到各个所述基准节点。And a second mapping module, configured to map hash values of the respective servers to the hash ring to obtain each of the reference nodes.
  18. 根据权利要求16所述的服务器连接装置,其特征在于,还包括:The server connection device according to claim 16, further comprising:
    身份标识扩展模块,用于根据下式计算各个服务器的扩展身份标识:An identity extension module for calculating an extended identity of each server according to the following formula:
    Ext_ServerIDm,n=ExtFunc(ServerIDm,n)Ext_ServerIDm, n=ExtFunc(ServerIDm,n)
    其中,m为服务器的序号,1≤m≤M,M为服务器的总数,ServerIDm为第m个服务器的身份标识,n为扩展身份标识的序号,1≤n≤Nm,Nm为第m个服务器的扩展身份标识的总数,Nm与第m个服务器的中央处理器的主频正相关,且与第m个服务器的内存容量正相关,ExtFunc为预设的函数,Ext_ServerIDm,n为第m个服务器的第n个扩展身份标识。Where m is the serial number of the server, 1≤m≤M, M is the total number of servers, ServerIDm is the identity of the mth server, n is the serial number of the extended identity, 1≤n≤Nm, and Nm is the mth server The total number of extended identities, Nm is positively correlated with the frequency of the central processor of the mth server, and is positively related to the memory capacity of the mth server, ExtFunc is the default function, Ext_ServerIDm, n is the mth server The nth extended identity.
  19. 根据权利要求18所述的服务器连接装置,其特征在于,还包括:The server connection device according to claim 18, further comprising:
    候选函数选取模块,用于从预设的哈希函数集合中任意选取一个哈希函数作为候选函数,所述哈希函数集合包括一个以上的哈希函数;a candidate function selection module, configured to arbitrarily select one hash function from the preset hash function set as a candidate function, the hash function set includes one or more hash functions;
    哈希运算模块,用于使用所述候选函数分别对各个服务器的扩展身份标识进行哈希运算,得到各个服务器的哈希值;a hash operation module, configured to hash the extended identity of each server by using the candidate function, to obtain a hash value of each server;
    第一序列构造模块,用于根据下式构造哈希值序列:The first sequence construction module is configured to construct a sequence of hash values according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100016
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100016
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set consisting of hash values of the respective servers;
    第一均匀度计算模块,用于根据下式计算所述候选函数的均匀度:a first uniformity calculation module, configured to calculate a uniformity of the candidate function according to the following formula:
    Figure PCTCN2018093342-appb-100017
    Figure PCTCN2018093342-appb-100017
    其中,HashMax为所述候选函数的最大函数值,EvenDeg为所述候选函数的均匀度;Where HashMax is the maximum function value of the candidate function, and EvenDeg is the uniformity of the candidate function;
    候选函数删除模块,用于若所述候选函数的均匀度大于预设的均匀度阈值,则将所述候选函数从所述哈希函数集合中删除;a candidate function deleting module, configured to delete the candidate function from the hash function set if a uniformity of the candidate function is greater than a preset uniformity threshold;
    函数确定模块,用于若所述候选函数的均匀度小于或等于预设的均匀度阈值,则将所述候选函数确定为第二哈希函数。The function determining module is configured to determine the candidate function as the second hash function if the uniformity of the candidate function is less than or equal to a preset uniformity threshold.
  20. 根据权利要求18所述的服务器连接装置,其特征在于,还包括:The server connection device according to claim 18, further comprising:
    第二序列构造模块,用于根据下式构造各个哈希值序列:The second sequence construction module is configured to construct each hash value sequence according to the following formula:
    HashArrayT=(hashvt 1,hashvt 2,......,hashvt tn,......,hashvt TN) HashArrayT=(hashvt 1 , hashvt 2 , ..., hashvt tn , ..., hashvt TN )
    Figure PCTCN2018093342-appb-100018
    Figure PCTCN2018093342-appb-100018
    其中,1≤tn≤TN,TN为各个服务器的哈希值的总数,且
    Figure PCTCN2018093342-appb-100019
    hashvt tn∈HashValueSetT,且hashvt tn≤hashvt tn+1,HashValueSetT为由各个服务器的哈希值组成的集合,hashv m,n∈HashValueSet m,且hashv m,n≤hashv m,n+1,HashValueSet m为由第 m个服务器的哈希值组成的集合;
    Where 1≤tn≤TN, TN is the total number of hash values of each server, and
    Figure PCTCN2018093342-appb-100019
    Hashvt tn ∈HashValueSetT, and hashvt tn ≤hashvt tn+1 , HashValueSetT is a set of hash values from each server, hashv m,n ∈HashValueSet m , and hashv m,n ≤hashv m,n+1 ,HashValueSet m a collection consisting of the hash values of the mth server;
    第二均匀度计算模块,用于根据下式计算所述候选函数的均匀度:a second uniformity calculation module, configured to calculate a uniformity of the candidate function according to the following formula:
    Figure PCTCN2018093342-appb-100020
    Figure PCTCN2018093342-appb-100020
    其中,HashMax为所述候选函数的最大函数值,η为预设的比例系数,EvenDeg为所述候选函数的均匀度。Where HashMax is the maximum function value of the candidate function, η is a preset proportional coefficient, and EvenDeg is the uniformity of the candidate function.
PCT/CN2018/093342 2018-04-17 2018-06-28 Server connection method, computer readable storage medium, terminal device, and apparatus WO2019200714A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810341964.0 2018-04-17
CN201810341964.0A CN108769111B (en) 2018-04-17 2018-04-17 Server connection method, computer readable storage medium and terminal device

Publications (1)

Publication Number Publication Date
WO2019200714A1 true WO2019200714A1 (en) 2019-10-24

Family

ID=64010645

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/093342 WO2019200714A1 (en) 2018-04-17 2018-06-28 Server connection method, computer readable storage medium, terminal device, and apparatus

Country Status (2)

Country Link
CN (1) CN108769111B (en)
WO (1) WO2019200714A1 (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339088A (en) * 2020-02-21 2020-06-26 苏宁云计算有限公司 Database division and table division method, device, medium and computer equipment
CN111580965A (en) * 2020-04-30 2020-08-25 深圳壹账通智能科技有限公司 Data request processing method and system
CN111580948A (en) * 2020-04-30 2020-08-25 中国平安财产保险股份有限公司 Task scheduling method and device and computer equipment
CN111614760A (en) * 2020-05-20 2020-09-01 浩云科技股份有限公司 Method and device for balanced distribution access of Internet of things equipment
CN112486672A (en) * 2020-11-17 2021-03-12 中国人寿保险股份有限公司 Service memory cache calling method and device
CN112799978A (en) * 2021-01-20 2021-05-14 网易(杭州)网络有限公司 Cache design management method, device, equipment and computer readable storage medium
CN112948120A (en) * 2021-03-18 2021-06-11 广东好太太智能家居有限公司 Load balancing method, system, device and storage medium
CN113064720A (en) * 2021-03-12 2021-07-02 北京达佳互联信息技术有限公司 Object allocation method, device, server and storage medium
CN113542013A (en) * 2021-06-24 2021-10-22 新华三大数据技术有限公司 Method, device and equipment for distributing virtualized network function management messages
CN114785795A (en) * 2022-04-02 2022-07-22 北京蓝海在线科技有限公司 Distributed storage method, system, device, storage medium and information processing terminal
CN114866799A (en) * 2022-05-11 2022-08-05 北京奇艺世纪科技有限公司 Server scheduling method and device
CN117130793A (en) * 2023-10-27 2023-11-28 乾健科技有限公司 Big data analysis processing method and system

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109739433A (en) * 2018-11-27 2019-05-10 中科恒运股份有限公司 The method and terminal device of data processing
CN110083313B (en) * 2019-05-06 2022-08-02 北京奇艺世纪科技有限公司 Data caching method and device
CN110457128B (en) * 2019-07-11 2023-12-22 创新先进技术有限公司 Task allocation method, device and system
CN111182043B (en) * 2019-12-23 2022-08-12 南京亚信智网科技有限公司 Hash value distribution method and device
CN111314189B (en) * 2020-01-17 2022-02-25 蚂蚁财富(上海)金融信息服务有限公司 Service message sending method and device
CN112650451B (en) * 2020-12-28 2023-06-09 杭州趣链科技有限公司 Optimization method, device, computer equipment and storage medium for searching network server
CN112667620A (en) * 2020-12-31 2021-04-16 广州方硅信息技术有限公司 Data processing method and device, computer equipment and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8996607B1 (en) * 2010-06-04 2015-03-31 Amazon Technologies, Inc. Identity-based casting of network addresses
CN106972977A (en) * 2017-05-24 2017-07-21 北京潘达互娱科技有限公司 The long connection maintaining method of one kind and device
CN107171971A (en) * 2017-05-11 2017-09-15 北京云端智度科技有限公司 Network traffic load method in a balanced way is realized using uniformity Hash strategy
CN107317879A (en) * 2017-08-02 2017-11-03 网宿科技股份有限公司 The distribution method and system of a kind of user's request
CN107395767A (en) * 2017-08-31 2017-11-24 北京奇虎科技有限公司 Message push system and method based on long connection
CN107797865A (en) * 2017-10-20 2018-03-13 华为软件技术有限公司 User task processing method and application server

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR100640057B1 (en) * 2004-11-12 2006-11-01 삼성전자주식회사 Method of managing a key of user for broadcast encryption
US7821925B2 (en) * 2007-01-29 2010-10-26 Fulcrum Microsystems, Inc. Traffic distribution techniques utilizing initial and scrambled hash values
CN101494611B (en) * 2009-02-20 2011-09-14 华为技术有限公司 Method and apparatus for regulating load share
CN103888499B (en) * 2012-12-21 2018-08-14 中国科学院深圳先进技术研究院 A kind of method and system of distributed objects processing
CN104852934A (en) * 2014-02-13 2015-08-19 阿里巴巴集团控股有限公司 Method for realizing flow distribution based on front-end scheduling, device and system thereof
CN106559448A (en) * 2015-09-28 2017-04-05 北京国双科技有限公司 Server load balancing method and apparatus
CN106789175A (en) * 2016-11-30 2017-05-31 武汉长江通信智联技术有限公司 It is a kind of that redis methods extending transversely are carried out based on uniformity hash algorithm
CN106850581B (en) * 2017-01-04 2020-06-23 网宿科技股份有限公司 Distribution backup method, system and server for interactive live broadcast streaming media data
CN107070989A (en) * 2017-03-06 2017-08-18 北京潘达互娱科技有限公司 Communication means and system
CN107749887A (en) * 2017-10-25 2018-03-02 暴风集团股份有限公司 A kind of CDN resource allocations, localization method and device and CDN system

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8996607B1 (en) * 2010-06-04 2015-03-31 Amazon Technologies, Inc. Identity-based casting of network addresses
CN107171971A (en) * 2017-05-11 2017-09-15 北京云端智度科技有限公司 Network traffic load method in a balanced way is realized using uniformity Hash strategy
CN106972977A (en) * 2017-05-24 2017-07-21 北京潘达互娱科技有限公司 The long connection maintaining method of one kind and device
CN107317879A (en) * 2017-08-02 2017-11-03 网宿科技股份有限公司 The distribution method and system of a kind of user's request
CN107395767A (en) * 2017-08-31 2017-11-24 北京奇虎科技有限公司 Message push system and method based on long connection
CN107797865A (en) * 2017-10-20 2018-03-13 华为软件技术有限公司 User task processing method and application server

Cited By (14)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111339088A (en) * 2020-02-21 2020-06-26 苏宁云计算有限公司 Database division and table division method, device, medium and computer equipment
CN111580965A (en) * 2020-04-30 2020-08-25 深圳壹账通智能科技有限公司 Data request processing method and system
CN111580948A (en) * 2020-04-30 2020-08-25 中国平安财产保险股份有限公司 Task scheduling method and device and computer equipment
CN111614760A (en) * 2020-05-20 2020-09-01 浩云科技股份有限公司 Method and device for balanced distribution access of Internet of things equipment
CN112486672A (en) * 2020-11-17 2021-03-12 中国人寿保险股份有限公司 Service memory cache calling method and device
CN112799978A (en) * 2021-01-20 2021-05-14 网易(杭州)网络有限公司 Cache design management method, device, equipment and computer readable storage medium
CN113064720B (en) * 2021-03-12 2024-04-16 北京达佳互联信息技术有限公司 Object allocation method, device, server and storage medium
CN113064720A (en) * 2021-03-12 2021-07-02 北京达佳互联信息技术有限公司 Object allocation method, device, server and storage medium
CN112948120A (en) * 2021-03-18 2021-06-11 广东好太太智能家居有限公司 Load balancing method, system, device and storage medium
CN113542013A (en) * 2021-06-24 2021-10-22 新华三大数据技术有限公司 Method, device and equipment for distributing virtualized network function management messages
CN114785795A (en) * 2022-04-02 2022-07-22 北京蓝海在线科技有限公司 Distributed storage method, system, device, storage medium and information processing terminal
CN114866799A (en) * 2022-05-11 2022-08-05 北京奇艺世纪科技有限公司 Server scheduling method and device
CN114866799B (en) * 2022-05-11 2024-04-05 北京奇艺世纪科技有限公司 Server scheduling method and device
CN117130793A (en) * 2023-10-27 2023-11-28 乾健科技有限公司 Big data analysis processing method and system

Also Published As

Publication number Publication date
CN108769111B (en) 2020-01-24
CN108769111A (en) 2018-11-06

Similar Documents

Publication Publication Date Title
WO2019200714A1 (en) Server connection method, computer readable storage medium, terminal device, and apparatus
US9104676B2 (en) Hash algorithm-based data storage method and system
CN110489059B (en) Data cluster storage method and device and computer equipment
WO2018149292A1 (en) Object clustering method and apparatus
JP2019504412A (en) Short link processing method, device, and server
JP6608972B2 (en) Method, device, server, and storage medium for searching for group based on social network
US20150052072A1 (en) Community notification based on profile update
US20210158353A1 (en) Methods, systems, apparatuses, and devices for processing request in consortium blockchain
US20150052575A1 (en) Steering Traffic Among Multiple Network Services Using a Centralized Dispatcher
US20170155712A1 (en) Method and device for updating cache data
CN113282941A (en) Method and device for acquiring object identification, electronic equipment and storage medium
KR101540868B1 (en) Device discovery in a ubiquitous computing environment
WO2020024446A1 (en) Data storage method and apparatus, storage medium, and computer device
CN108696418B (en) Privacy protection method and device in social network
CN111405007B (en) TCP session management method, device, storage medium and electronic equipment
CN116991800A (en) File acquisition system, method, device, computer equipment and storage medium
WO2018225314A1 (en) Database management system and database management method
CN106790323B (en) Resource discovery method and device
CN112187743B (en) Network policy matching method and system based on IP address longest prefix
CN110555158A (en) mutually exclusive data processing method and system, and computer readable storage medium
CN114756714A (en) Graph data processing method and device and storage medium
CN108768735B (en) Bipartite graph sampling method and device for test bed topological structure
US9536199B1 (en) Recommendations based on device usage
CN112817980A (en) Data index processing method, device, equipment and storage medium
CN114827159B (en) Network request path optimization method, device, equipment and storage medium

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18915542

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 22.01.2021)

122 Ep: pct application non-entry in european phase

Ref document number: 18915542

Country of ref document: EP

Kind code of ref document: A1