CN112039993A - Long connection address processing method and device - Google Patents

Long connection address processing method and device Download PDF

Info

Publication number
CN112039993A
CN112039993A CN202010910227.5A CN202010910227A CN112039993A CN 112039993 A CN112039993 A CN 112039993A CN 202010910227 A CN202010910227 A CN 202010910227A CN 112039993 A CN112039993 A CN 112039993A
Authority
CN
China
Prior art keywords
identifier
long connection
connection address
server
storage space
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202010910227.5A
Other languages
Chinese (zh)
Other versions
CN112039993B (en
Inventor
杜敏琪
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202010910227.5A priority Critical patent/CN112039993B/en
Publication of CN112039993A publication Critical patent/CN112039993A/en
Application granted granted Critical
Publication of CN112039993B publication Critical patent/CN112039993B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/901Indexing; Data structures therefor; Storage structures
    • G06F16/9014Indexing; Data structures therefor; Storage structures hash tables

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Software Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer And Data Communications (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The application provides a long connection address processing method and a device, wherein the method comprises the following steps: the method comprises the steps that a server acquires a first identifier, wherein the first identifier comprises one or more of a target application identifier and a target user identifier; the server hashes the first identifier to obtain a hash value of the first identifier; the server determines a storage position corresponding to the first identifier according to the hash value of the first identifier and a corresponding relation, wherein the corresponding relation is the corresponding relation between the hash value of the first identifier and the storage position; and the server processes the long connection address corresponding to the first identifier in the storage space corresponding to the storage position. The method and the device provided by the application can give consideration to both concurrency and instantaneity, improve the instantaneity of message pushing and the response speed when the long connection state changes, and shorten the time consumed by inquiring the long connection.

Description

Long connection address processing method and device
Technical Field
The present application relates to the field of long connection address processing, and in particular, to a method and an apparatus for processing a long connection address.
Background
In recent years, with the rapid expansion of internet technology, functions of mobile terminal applications, such as a message push function, have been newly added. The message pushing function is realized based on a message pushing system. In the message pushing system, a client establishes a long connection with a server, and the message is automatically transmitted to the client from the server through the long connection, so that the message is delivered in real time. There are two types of existing message push: private letters and broadcasts. Private trust refers to pushing a message to a certain user of a certain application, and broadcast refers to pushing a message to all users of a certain application, wherein the users (users) and the applications (clients) have unique numbers.
In practical applications, the message push system is implemented based on a set (map) in the Go language, a programming language developed by google. Map is an unordered set of key value pairs, from which values can be quickly found. Establishing a map in the message pushing system, defining key as application # user identification, namely client # userid, such as 123#89avc, and defining value as long connection address, namely the address of the long connection in the memory. When a long connection is established or disconnected, the map needs to be determined (the so-called "determination" may be a mutex, that is, only one thread can read or write the current map at the same time, and only other threads can continue to operate after the determination on the current map is released), and then the corresponding key-value pair can be added or deleted in the map, and finally the determination on the map is released. Based on the method, when the message is pushed, the map is determined, the long connection address value is searched in the map by using the identifier with key being clientid # userid, the determination on the map is released after the long connection address value is searched, and finally the message is pushed by using the long connection address. That is, all operations for long connection such as establishment, disconnection and inquiry are performed in the same map, but in the message push service with high concurrency, frequent determination may slow down the message push time, and the response speed of the system when long connection is established or disconnected is also affected by the determination of the map. Moreover, the map is automatically expanded after reaching a certain capacity, and when the long connection is rapidly increased, the map needs to be frequently expanded, so that the overhead of the time for pushing the message is further increased.
In short, current message pushing systems tend to reduce the real-time performance of message pushing due to high concurrency and affect the response speed at long connection state changes such as establishment or disconnection. That is, the conventional system has a problem that the concurrency amount and the real-time performance cannot be simultaneously considered.
Disclosure of Invention
The embodiment of the application provides a long connection address processing method and device, which can take both concurrency and real-time into consideration, improve the real-time property of message pushing and the response speed when the long connection state changes, and shorten the time consumed for inquiring long connection.
The application provides a long connection address processing method, which comprises the following steps:
the method comprises the steps that a server acquires a first identifier, wherein the first identifier comprises one or more of a target application identifier and a target user identifier;
the server hashes the first identifier to obtain a hash value of the first identifier;
the server determines a storage position corresponding to the first identifier according to the hash value of the first identifier and a corresponding relation, wherein the corresponding relation is the corresponding relation between the hash value of the first identifier and the storage position;
and the server processes the long connection address corresponding to the first identifier in the storage space corresponding to the storage position.
Optionally, the storage space stores a corresponding relationship between the first identifier and the long connection address;
the method further comprises the following steps:
the server processing the long connection address corresponding to the first identifier in the storage space corresponding to the storage location includes:
and the server stores or deletes the corresponding relation between the first identification and the long connection address.
Optionally, the storage space stores a corresponding relationship between the first identifier and the long connection address;
the method further comprises the following steps:
the server processing the long connection address corresponding to the first identifier in the storage space corresponding to the storage location includes:
and the server inquires a long connection address corresponding to the first identifier in the storage space.
Optionally, a first key-value pair is stored in the storage space, a key of the first key-value pair is the first identifier, and a value of the first key-value pair is the long connection address.
Optionally, the obtaining, by the server, the first identifier includes:
and the server receives a long connection request or a long disconnection request from the terminal equipment, wherein the first identifier is carried in the long connection request or the long disconnection request.
The application provides a message sending method, which comprises the following steps:
the server acquires a target application identifier;
the server determines a storage position according to the target application identifier and a corresponding relationship, wherein the corresponding relationship is the corresponding relationship between the target application identifier and the storage position, and at least one long connection address corresponding to the target application identifier is stored in a storage space corresponding to the storage position;
and the server sends a message to the terminal equipment corresponding to the at least one long connection address.
Optionally, the at least one long connection address includes a first long connection address, and the method further includes:
the server acquires the corresponding relation between the target user identification and the first long connection address;
and the server stores the corresponding relation in the storage space.
Optionally, the method further includes:
and the server deletes the corresponding relation in the storage space.
The application provides a long connection address processing apparatus, the apparatus includes:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a first identifier which comprises one or more of a target application identifier and a target user identifier;
the hash unit is used for hashing the first identifier to obtain a hash value of the first identifier;
a determining unit, configured to determine, according to the hash value of the first identifier and a corresponding relationship, a storage location corresponding to the first identifier, where the corresponding relationship is the corresponding relationship between the hash value of the first identifier and the storage location;
and the processing unit is used for processing the long connection address corresponding to the first identifier in the storage space corresponding to the storage position.
The present application provides a message transmission apparatus, the apparatus comprising:
an obtaining unit, configured to obtain a target application identifier;
a determining unit, configured to determine a storage location according to the target application identifier and a corresponding relationship, where the corresponding relationship is the corresponding relationship between the target application identifier and the storage location, and at least one long connection address corresponding to the target application identifier is stored in a storage space corresponding to the storage location;
and the sending unit is used for sending a message to the terminal equipment corresponding to the at least one long connection address.
Compared with the prior art, the method has the advantages that:
the embodiment of the application provides a long connection address processing method and a long connection address processing device, wherein the method comprises the following steps: the method comprises the steps that a server acquires a first identifier, wherein the first identifier comprises one or more of a target application identifier and a target user identifier; the server hashes the first identifier to obtain a hash value of the first identifier; the server determines a storage position corresponding to the first identifier according to the hash value of the first identifier and a corresponding relation, wherein the corresponding relation is the corresponding relation between the hash value of the first identifier and the storage position; and the server processes the long connection address corresponding to the first identifier in the storage space corresponding to the storage position. Therefore, by using the method and the device provided by the embodiment of the invention, the position for storing the long connection can be positioned by using the Hash algorithm, only the key value pair set at the position is determined, and the long connection is efficiently operated at the server side, such as connection establishment, disconnection, connection search, message pushing and the like, so that the time consumed for inquiring the long connection is shortened, the response speed of disconnection and connection establishment is increased when the state of the long connection changes, such as disconnection and connection establishment, the concurrency and real-time performance can be considered, and the message pushing real-time performance is improved.
Drawings
Fig. 1 is a schematic flowchart illustrating a long connection address processing method according to an embodiment of the present disclosure;
fig. 2 is a schematic flowchart of a message sending method according to a second embodiment of the present application;
fig. 3 is a schematic structural diagram of a long connection address processing apparatus according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a message sending apparatus according to a second embodiment of the present application.
Detailed Description
The embodiment of the application provides a long connection address processing method, which can solve the problem that the message pushing instantaneity is reduced and cannot be considered due to high concurrency in the current message pushing system. By efficiently processing long connection at the server side, such as connection establishment, disconnection, connection searching and the like, the real-time performance of message pushing is improved, the time consumed by inquiring the long connection is shortened, and the response speed of disconnection and connection establishment, for example, is improved when the state of the long connection changes.
The following describes a long connection address processing method and apparatus provided in an embodiment of the present application with reference to the accompanying drawings.
Referring to fig. 1, this figure is a schematic flowchart of a long connection address processing method according to an embodiment of the present application.
The long connection address processing method provided by the embodiment of the application can be implemented by the following steps 101-104.
Step 101: the server acquires a first identifier, wherein the first identifier comprises one or more of a target application identifier and a target user identifier.
In the embodiment of the present application, it is considered that, in practical applications, before a message push system performs message push, an object of the message push and a long connection of the message push need to be acquired. The message pushing object is a certain user, and the server pushes the message to the user through the message pushing system.
It should be noted that the message pushing system may be used for a mobile terminal application or a hypertext Markup Language (HTML 5) application.
As an example, a message push system may support multiple users establishing a long connection at the same time.
As another example, a message push system may also support the same user to establish long connections among multiple mobile terminal applications.
It will be appreciated that the same user may utilize the user number (userid) of that user as the unique identifier and the same mobile terminal application may utilize the application number (clientid) of that application as the unique identifier.
As an example, when looking for a certain user, it may be found with application # user identification. And the application # user identification is a clientid # userid identification, such as 112# 39584.
As another example, when a user is sought, the user identification may be directly utilized to seek the user.
As yet another example, when looking for a certain user, the application identification may also be directly utilized to look for a certain user.
It should be noted that, in this embodiment, the first identifier specifically includes one or more of an application identifier and a user identifier, which is not specifically limited, and may include one or more of the application identifier and the user identifier.
Step 102: and the server hashes the first identifier to obtain a hash value of the first identifier.
In this embodiment, in practical application, after the server acquires the first identifier, the server hashes the first identifier by using a hash algorithm to obtain a hash value of the first identifier.
It is understood that, in the present application, instead of only one set (map) for storing long join and key value (value) pairs, an array of length N is created, and each element in the array is a separate map, that is, N maps can store long join and key-value pairs.
As an example, N may be the number of Central Processing Units (CPUs).
It is understood that in the present application, a key-value pair, a key is an identifier, and a value is a long connection address.
It should be noted that, by using a method (hereinafter referred to as a mod function) of bitwise and the hash value (binary) of the first identifier and N-1 (binary), the position of the hash value of the first identifier in the array with the length of N can be uniquely determined according to the input hash value of the first identifier and the number N of CPUs, and when there are multiple identified hash values, the position of each identified hash value can be uniformly distributed in the array.
As an example, in the present application, a first identifier may be input, and the position of the map storing the long connection in the array may be determined according to the first identifier.
Step 103: and the server determines the storage position of the long connection corresponding to the first identifier according to the hash value of the first identifier and the corresponding relation, wherein the corresponding relation is the corresponding relation between the hash value of the first identifier and the storage position.
In the embodiment of the application, in consideration of the fact that in practical application, the first identifier is hashed according to a hash algorithm to obtain a hash value of the first identifier, the hash value of the first identifier can be used to determine the position of the map storing the long connection in the array, and the hash value is used to find the corresponding map.
It is to be understood that, as an example, the correspondence between the hash value of the first identifier and the storage location of the long connection corresponding to the first identifier may be a mod functional relationship. And determining the position of the hash value in the array by using a mod function according to the hash value of the first identifier, wherein the long connection address corresponding to the first identifier is stored in the map corresponding to the position.
Step 104: and the server processes the long connection address corresponding to the first identifier in the storage space corresponding to the storage position.
In the embodiment of the present application, it is considered that in practical application, as an example, the storage space corresponding to the storage location may be one of N maps.
It should be noted that the correspondence between the first identifier and the long connection address is a key-value correspondence. Key is a first identifier, and value is a long connection address corresponding to the first identifier.
After determining the storage location of the long connection address corresponding to the first identifier, determining the storage space corresponding to the storage location, then processing the long connection address corresponding to the first identifier in the storage space corresponding to the storage location, and after the processing is completed, releasing the determination of the storage space.
As an example, after determining a map of the long connection address corresponding to the first identifier, the map is determined, then the long connection address corresponding to the first identifier is processed by the map, and the determination of the map is released after the processing is completed.
It can be understood that, in the present application, N maps with the same number as that of the CPUs are independent of each other, and the processing operation of the long connection of one map, such as query, addition, deletion, does not affect other maps, in other words, the present application can utilize multiple CPUs to process the long connection address in parallel.
As can be seen from the above description, with the long connection address processing method provided in the embodiment of the present application, the problem that the real-time performance of message pushing is often reduced due to high concurrency in the current message pushing system, and the concurrency and the real-time performance cannot be considered at the same time can be solved. By efficiently processing the set where the long connection is located at the server side, such as connection establishment, disconnection, connection searching and the like, the real-time performance of message pushing is improved, the time consumed by inquiring the long connection is shortened, and the response speed of disconnection and connection establishment, for example, is improved when the state of the long connection changes.
It should be noted that, in practical applications, a corresponding relationship between the first identifier and the long connection address is stored in the storage space corresponding to the storage location.
As an example, a map located in a certain position of the array stores a key-value correspondence of a first identifier and a long connection address, wherein the key is the first identifier, and the value is the long connection address.
Based on the above correspondence relationship, the processing, by the server, the long connection address corresponding to the first identifier in the storage space corresponding to the storage location includes:
and the server stores or deletes the corresponding relation between the first identification and the long connection address.
It will be appreciated that long connections may have a change of state in the storage location, for example, to establish a connection. As another example, the connection is broken. Therefore, when the state of the long connection changes, the corresponding relationship between the first identifier and the long connection address needs to be changed accordingly, for example, the corresponding relationship is stored. In another example, the correspondence is deleted.
As an example, a long connection corresponding to the first identifier needs to be established, and a key-value correspondence between the first identifier and a corresponding long connection address may be stored in a certain map of the N maps.
As another example, the long link corresponding to the first identifier needs to be deleted, and the key-value correspondence between the first identifier and the corresponding long link address may be deleted in the map in which the correspondence between the first identifier and the long link address is stored.
It should be noted that, in practical applications, a corresponding relationship between the first identifier and the long connection address is stored in the storage space corresponding to the storage location.
As an example, a map located in a certain position of the array stores a key-value correspondence of a first identifier and a long connection address, wherein the key is the first identifier, and the value is the long connection address.
Based on the above correspondence relationship, the processing, by the server, the long connection address corresponding to the first identifier in the storage space corresponding to the storage location includes:
and the server inquires a long connection address corresponding to the first identifier in the storage space.
It will be appreciated that a message push system requires a long connection to be established with a user to push a message, which long connection address needs to be queried in the server before the message is pushed. Therefore, the server needs to query the correspondence between the first identifier and the long connection address, and determine the long connection address according to the correspondence.
As an example, a long connection address corresponding to the first identifier needs to be queried, and a key-value correspondence between the first identifier and the corresponding long connection address may be queried in a map in which the correspondence between the first identifier and the long connection address is stored.
It should be noted that the method further includes:
and storing a first key-value pair in the storage space, wherein the key of the first key-value pair is the first identifier, and the value of the first key-value pair is the long connection address.
As an example, a first key value (value) pair is stored in one of the N maps, the key of the first key value pair is a first identifier, and the value of the first key value pair is a long connection address corresponding to the first identifier.
The storage space may be the following schematic code:
Figure BDA0002662990010000061
in a possible implementation manner, the "acquiring the first identifier" in step 101 includes, in a specific implementation:
and the server receives a long connection request or a long disconnection request from the terminal equipment, wherein the first identifier is carried in the long connection request or the long disconnection request.
It can be understood that, when the server receives a long connection request or a long disconnection request of the user terminal device, there may be a change in the state of the long connection, and the change in the state of the long connection may affect a change in the correspondence relationship between the long connection address and the first identifier. To implement this change, the first identifier may be carried in a long connect request or a long disconnect request.
As an example, a server receives a long connection request from a terminal device user, where the long connection request carries a first identifier, hashes the first identifier, determines, according to a hash value obtained by hashing the first identifier and a mod function, and using the hash value as an input, a position of the hash value of the first identifier in an array by using the mod function, and stores a correspondence between the first identifier and a long connection address in a map corresponding to the position, where the correspondence is a key value (value) pair.
As another example, the server receives a long disconnection request from the terminal device user, where the long disconnection request carries a first identifier, hashes the first identifier, determines, according to a hash value obtained by hashing the first identifier and a mod function, and using the hash value as an input, a position of the hash value of the first identifier in an array by using the mod function, where a map corresponding to the position stores a correspondence between the first identifier and a long connection address, where the correspondence is a key value (value) pair, and deletes the key value pair.
It should be noted that, in practical applications, a server may send push messages to all users under a certain application, and in order to shorten the time for querying a long connection address and sending a message, an embodiment of the present application further provides a message sending method, which is described in detail below with reference to fig. 2.
Referring to fig. 2, this figure is a schematic flowchart of a message sending method according to a second embodiment of the present application.
The message sending method provided in the second embodiment of the present application may be implemented by the following steps 201 and 203.
Step 201: the server obtains the target application identification.
In the embodiment of the present application, it is considered that in practical applications, the same mobile terminal application may use an application number (clientid) of the application as a unique identifier.
Step 202: and the server determines a storage position according to the target application identifier and a corresponding relationship, wherein the corresponding relationship is the corresponding relationship between the target application identifier and the storage position, and at least one long connection address corresponding to the target application identifier is stored in a storage space corresponding to the storage position.
In the embodiment of the present application, considering that, in an actual application, there is a corresponding relationship between a target application identifier and a storage location, the storage location may be determined by using the target application identifier and the corresponding relationship.
It is understood that in the present application, under one general set (map), at least one map may also be created to store key value pairs.
As an example, maps that are all stored as long connection addresses under the target application may be determined using the target application identification, e.g., clientid and correspondence. The correspondence may be a key-value correspondence, where key is a target application identifier, and value is a map corresponding to the target application identifier.
It should be noted that at least one long connection address corresponding to the target application identifier is stored in the storage space corresponding to the storage location.
As an example, the storage space corresponding to the storage location is a certain map, the map is a map corresponding to the target application identifier, and the long connection addresses of all users of the target application are stored under the map.
It can be understood that, when the total map is processed, for example, when the query and the addition are performed, the processing operation performed on the map corresponding to the target application identifier is not affected, for example, the query, the addition, and the deletion are performed, in other words, the total map and the map corresponding to the target application identifier can be processed in parallel.
The storage space may be the following schematic code:
Figure BDA0002662990010000071
step 203: and the server sends a message to the terminal equipment corresponding to the at least one long connection address.
In the embodiment of the application, it is considered that in practical application, the server obtains the long connection addresses of all users of the target application through the map corresponding to the target application identifier, and according to the long connection addresses, the server sends messages to the user terminal equipment corresponding to the long connection addresses.
As can be seen from the above description, with the message sending method provided in the embodiment of the present application, the problem that the message pushing instantaneity is often reduced due to high concurrency in the current message pushing system, and the concurrency and instantaneity cannot be considered at the same time can be solved. By uniformly processing the long connection of the user under the whole application, the real-time property of message pushing is improved, and the time consumed by inquiring the long connection is shortened.
It should be noted that, on the basis of the foregoing embodiment, the at least one long connection address includes a first long connection address, and the method further includes:
the server acquires the corresponding relation between the target user identification and the first long connection address;
and the server stores the corresponding relation in the storage space.
It should be noted that the target application identifier corresponds to a storage space in the storage location, and stores at least one long connection address, including the first long connection address.
As one example, the map corresponding to the target application identification stores at least one long connection address, including a first long connection address. The map also stores the corresponding relation between the target user identification and the first long connection address. The corresponding relationship may be a key-value corresponding relationship, the key is a target user identifier, and the value is a first long connection address.
As another example, a target user of a target application establishes a long connection, and a correspondence relationship between the target user identifier and the key-value of the first long connection address is stored in a map corresponding to the target application identifier.
As another example, if the target application establishes a long connection, a map corresponding to the target application identifier is established under the total map, and the correspondence relationship is stored in the map.
It should be noted that, on the basis of the above method, the method further includes:
and the server deletes the corresponding relation in the storage space.
As one example, the map corresponding to the target application identification stores at least one long connection address, including a first long connection address. The map also stores the corresponding relation between the target user identification and the first long connection address. And if the target user of the target application cancels the long connection, deleting the corresponding relation between the target user identification and the first long connection address in the map corresponding to the target application identification.
Based on the method for processing the long connection address provided in the foregoing embodiment, an embodiment of the present application further provides a long connection address processing apparatus, which is described below with reference to fig. 3.
Referring to fig. 3, this figure is a schematic structural diagram of a long connection address processing apparatus according to an embodiment of the present application.
The long connection address processing apparatus 300 shown in fig. 3 specifically includes an obtaining unit 310, a hashing unit 320, a determining unit 330, and a processing unit 340.
The obtaining unit 310 is configured to obtain a first identifier, where the first identifier includes one or more of a target application identifier and a target user identifier;
the hash unit 320 is configured to hash the first identifier to obtain a hash value of the first identifier;
the determining unit 330 is configured to determine a storage location corresponding to the first identifier according to the hash value of the first identifier and a corresponding relationship, where the corresponding relationship is the corresponding relationship between the hash value of the first identifier and the storage location;
the processing unit 340 is configured to process the long connection address corresponding to the first identifier in the storage space corresponding to the storage location.
It should be noted that, because the long connection address processing apparatus 300 is an apparatus corresponding to the method provided in the first method embodiment, for specific implementation of each unit of the apparatus 300, reference may be made to the description of relevant content in the method embodiment, and details are not described here again.
As can be seen from the above description, with the long connection address processing apparatus provided in the embodiment of the present application, a problem that the real-time performance of message pushing is often reduced due to high concurrency in the current message pushing system, and the concurrency and the real-time performance cannot be considered at the same time can be solved. By efficiently processing the set where the long connection is located at the server side, such as connection establishment, disconnection, connection searching and the like, the real-time performance of message pushing is improved, the time consumed by inquiring the long connection is shortened, and the response speed of disconnection and connection establishment, for example, is improved when the state of the long connection changes.
Based on the message sending method provided by the above embodiment, an embodiment of the present application further provides a message sending apparatus, which is described below with reference to fig. 4.
Referring to fig. 4, this figure is a schematic structural diagram of a message sending apparatus according to an embodiment of the present application.
The message sending apparatus 400 shown in fig. 4 specifically includes an obtaining unit 410, a determining unit 420, and a sending unit 430.
The obtaining unit 410 is configured to obtain a target application identifier;
the determining unit 420 is configured to determine a storage location according to the target application identifier and a corresponding relationship, where the corresponding relationship is the corresponding relationship between the target application identifier and the storage location, and at least one long connection address corresponding to the target application identifier is stored in a storage space corresponding to the storage location;
the sending unit 430 is configured to send a message to a terminal device corresponding to the at least one long connection address.
It should be noted that, since the message sending apparatus 400 is an apparatus corresponding to the method provided in the second method embodiment, for specific implementation of each unit of the apparatus 400, reference may be made to the description of relevant content in the method embodiment, and details are not described here again.
The long connection address processing method and the long connection address processing device can give consideration to concurrency and real-time performance, improve the real-time performance of message pushing and the response speed when the long connection state changes, and shorten the time consumed by inquiring the long connection.
The terms "first," "second," "third," "fourth," and the like in the description and in the claims of the present application and in the drawings described above, if any, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It will be appreciated that the data so used may be interchanged under appropriate circumstances such that the embodiments described herein may be practiced otherwise than as specifically illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the above-described apparatuses and units may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the division of the unit is only one logical service division, and there may be other division ways in actual implementation, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, each service unit in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a hardware form, and can also be realized in a software service unit form.
The above-described embodiments are intended to explain the objects, aspects and advantages of the present invention in further detail, and it should be understood that the above-described embodiments are merely exemplary embodiments of the present invention.
The above embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same; although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.

Claims (10)

1. A method for processing long connection addresses, the method comprising:
the method comprises the steps that a server acquires a first identifier, wherein the first identifier comprises one or more of a target application identifier and a target user identifier;
the server hashes the first identifier to obtain a hash value of the first identifier;
the server determines a storage position corresponding to the first identifier according to the hash value of the first identifier and a corresponding relation, wherein the corresponding relation is the corresponding relation between the hash value of the first identifier and the storage position;
and the server processes the long connection address corresponding to the first identifier in the storage space corresponding to the storage position.
2. The method according to claim 1, wherein the storage space stores a corresponding relationship between the first identifier and the long connection address;
the method further comprises the following steps:
the server processing the long connection address corresponding to the first identifier in the storage space corresponding to the storage location includes:
and the server stores or deletes the corresponding relation between the first identification and the long connection address.
3. The method according to claim 1, wherein the storage space stores a corresponding relationship between the first identifier and the long connection address;
the method further comprises the following steps:
the server processing the long connection address corresponding to the first identifier in the storage space corresponding to the storage location includes:
and the server inquires a long connection address corresponding to the first identifier in the storage space.
4. A method according to claim 2 or 3, wherein a first key-value pair is stored in the storage space, the key of the first key-value pair being the first identity, the value of the first key-value pair being the long connection address.
5. The method of claim 1, wherein the server obtaining the first identifier comprises:
and the server receives a long connection request or a long disconnection request from the terminal equipment, wherein the first identifier is carried in the long connection request or the long disconnection request.
6. A method for sending a message, the method comprising:
the server acquires a target application identifier;
the server determines a storage position according to the target application identifier and a corresponding relationship, wherein the corresponding relationship is the corresponding relationship between the target application identifier and the storage position, and at least one long connection address corresponding to the target application identifier is stored in a storage space corresponding to the storage position;
and the server sends a message to the terminal equipment corresponding to the at least one long connection address.
7. The method of claim 6, wherein the at least one long connection address comprises a first long connection address, the method further comprising:
the server acquires the corresponding relation between the target user identification and the first long connection address;
and the server stores the corresponding relation in the storage space.
8. The method of claim 7, further comprising:
and the server deletes the corresponding relation in the storage space.
9. A long connection address processing apparatus, the apparatus comprising:
the device comprises an acquisition unit, a processing unit and a processing unit, wherein the acquisition unit is used for acquiring a first identifier which comprises one or more of a target application identifier and a target user identifier;
the hash unit is used for hashing the first identifier to obtain a hash value of the first identifier;
a determining unit, configured to determine, according to the hash value of the first identifier and a corresponding relationship, a storage location corresponding to the first identifier, where the corresponding relationship is the corresponding relationship between the hash value of the first identifier and the storage location;
and the processing unit is used for processing the long connection address corresponding to the first identifier in the storage space corresponding to the storage position.
10. A message transmission apparatus, characterized in that the apparatus comprises:
an obtaining unit, configured to obtain a target application identifier;
a determining unit, configured to determine a storage location according to the target application identifier and a corresponding relationship, where the corresponding relationship is the corresponding relationship between the target application identifier and the storage location, and at least one long connection address corresponding to the target application identifier is stored in a storage space corresponding to the storage location;
and the sending unit is used for sending a message to the terminal equipment corresponding to the at least one long connection address.
CN202010910227.5A 2020-09-02 2020-09-02 Long connection address processing method and device Active CN112039993B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010910227.5A CN112039993B (en) 2020-09-02 2020-09-02 Long connection address processing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010910227.5A CN112039993B (en) 2020-09-02 2020-09-02 Long connection address processing method and device

Publications (2)

Publication Number Publication Date
CN112039993A true CN112039993A (en) 2020-12-04
CN112039993B CN112039993B (en) 2022-10-18

Family

ID=73592262

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010910227.5A Active CN112039993B (en) 2020-09-02 2020-09-02 Long connection address processing method and device

Country Status (1)

Country Link
CN (1) CN112039993B (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559134A (en) * 2020-12-23 2021-03-26 安徽航天信息有限公司 Distributed WebSocket cluster construction method, device, system and storage medium
CN112866391A (en) * 2021-01-21 2021-05-28 北京百度网讯科技有限公司 Message pushing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130007299A1 (en) * 2011-07-01 2013-01-03 Stoneware, Inc. Method and apparatus for a keep-alive push agent
CN103078927A (en) * 2012-12-28 2013-05-01 合一网络技术(北京)有限公司 Key-value data distributed caching system and method thereof
CN108446366A (en) * 2018-03-14 2018-08-24 北京思特奇信息技术股份有限公司 A kind of method and device of classification storage/Rapid matching data
CN110287197A (en) * 2019-06-28 2019-09-27 微梦创科网络科技(中国)有限公司 A kind of date storage method, moving method and device
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130007299A1 (en) * 2011-07-01 2013-01-03 Stoneware, Inc. Method and apparatus for a keep-alive push agent
CN103078927A (en) * 2012-12-28 2013-05-01 合一网络技术(北京)有限公司 Key-value data distributed caching system and method thereof
CN108446366A (en) * 2018-03-14 2018-08-24 北京思特奇信息技术股份有限公司 A kind of method and device of classification storage/Rapid matching data
CN110300050A (en) * 2019-05-23 2019-10-01 中国平安人寿保险股份有限公司 Information push method, device, computer equipment and storage medium
CN110287197A (en) * 2019-06-28 2019-09-27 微梦创科网络科技(中国)有限公司 A kind of date storage method, moving method and device

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112559134A (en) * 2020-12-23 2021-03-26 安徽航天信息有限公司 Distributed WebSocket cluster construction method, device, system and storage medium
CN112866391A (en) * 2021-01-21 2021-05-28 北京百度网讯科技有限公司 Message pushing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN112039993B (en) 2022-10-18

Similar Documents

Publication Publication Date Title
CN105653198A (en) Data processing method and device
CN112039993B (en) Long connection address processing method and device
CN109167840B (en) Task pushing method, node autonomous server and edge cache server
US8478898B2 (en) System and method for routing directory service operations in a directory service network
CN110557464A (en) DNS (Domain name Server) resolution method, authoritative DNS server and DNS resolution system
CN111343286A (en) Network access system and network access method
US8984100B2 (en) Data downloading method, terminal, server, and system
JP2002525749A (en) Internet caching system, method and system configuration
CN107493309B (en) File writing method and device in distributed system
CN113315852B (en) Domain name resolution method, device and system
CN108494870B (en) CDN-based dynamic data loading method and device
CN107613016B (en) File batch downloading method, client, distribution server and system
CN112148745B (en) Multi-HBase cluster access method, device and storage medium
CN115706741A (en) Method and device for returning slice file
US11947553B2 (en) Distributed data processing
CN117176796A (en) Message pushing method, device, computer equipment and storage medium
CN107992489B (en) Data processing method and server
US8392549B2 (en) Apparatus and method for registering node and searching for floating internet protocol address using distributed network
CN110855627B (en) Application deployment method, device, equipment and medium
JP6233846B2 (en) Variable-length nonce generation
CN113612811B (en) Method, system, equipment and medium for client mounting in multiple channels
CN111614750B (en) Data updating method, system, equipment and storage medium
CN113610529A (en) Block storage and acquisition method, device, node and storage medium of alliance chain
CN103685367A (en) Offline download system and offline download method
CN117420956A (en) Information processing method, device, equipment and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant