WO2023217187A1 - 服务响应方法、装置、设备及存储介质 - Google Patents

服务响应方法、装置、设备及存储介质 Download PDF

Info

Publication number
WO2023217187A1
WO2023217187A1 PCT/CN2023/093269 CN2023093269W WO2023217187A1 WO 2023217187 A1 WO2023217187 A1 WO 2023217187A1 CN 2023093269 W CN2023093269 W CN 2023093269W WO 2023217187 A1 WO2023217187 A1 WO 2023217187A1
Authority
WO
WIPO (PCT)
Prior art keywords
service
socket
target
client
request message
Prior art date
Application number
PCT/CN2023/093269
Other languages
English (en)
French (fr)
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 WO2023217187A1 publication Critical patent/WO2023217187A1/zh

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • 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
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L69/00Network arrangements, protocols or services independent of the application payload and not provided for in the other groups of this subclass
    • H04L69/16Implementation or adaptation of Internet protocol [IP], of transmission control protocol [TCP] or of user datagram protocol [UDP]
    • H04L69/161Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields
    • H04L69/162Implementation details of TCP/IP or UDP/IP stack architecture; Specification of modified or new header fields involving adaptations of sockets based mechanisms

Definitions

  • the embodiments of the present disclosure relate to communication technology, for example, to a service response method, device, equipment and storage medium.
  • different servers may detect different ports.
  • the client requests services from the server, it will first negotiate the port with the server, and then actually establish a connection based on the negotiated port, that is, the client establishes a connection with the negotiated port.
  • the above method of requesting services may cause the server negotiated by the client to be different from the server actually established.
  • the client negotiates a port with server A
  • the negotiated port is Port a
  • load balancing scheduling allows the client to actually establish a connection with server B.
  • the ports detected by each server may be inconsistent.
  • server B does not detect port a, causing the client to fail to establish a connection.
  • the related technology has the following technical problems: In the scenario of a server cluster scheduled by load balancing, the ports detected by each server may be different. If the server actually established with the client does not detect the port of the server negotiated with the client, This causes the client service request to fail.
  • the present disclosure provides a service response method, device, equipment and storage medium to solve the problem that in the scenario of a load balancing scheduled server cluster, the server actually connected to the client does not detect the port of the server negotiated with the client. Technical issues causing client service requests to fail.
  • embodiments of the present disclosure provide a service response method, including:
  • the service request message is sent to the target service response process through the target socket.
  • embodiments of the present disclosure also provide a service response device, including:
  • the client request module is configured to determine, based on the service request message, the target client corresponding to the requesting client in response to detecting through the socket detection mechanism a service request message initiated by the requesting client through the preset service port. terminal identification information;
  • a socket determination module configured to determine the target socket corresponding to the service request message according to the target client identification information and a pre-established service data file, wherein the service data file is used to store the connected Correspondence between the client identification information of the connected client of the service response process and the socket of the service response process to which the connected client is connected;
  • the request response module is configured to send the service request message to the target service response process through the target socket.
  • embodiments of the present disclosure also provide an electronic device, where the electronic device includes:
  • a storage device arranged to store at least one program
  • the at least one processor When the at least one program is executed by the at least one processor, the at least one processor is caused to implement the service response method as described in any embodiment of the present disclosure.
  • embodiments of the present disclosure also provide a storage medium containing computer-executable instructions, which when executed by a computer processor are used to perform a service response as described in any embodiment of the present disclosure. method.
  • Figure 1 is a schematic flow chart of a service response method provided by an embodiment of the present disclosure
  • Figure 2 is a schematic flow chart of another service response method provided by an embodiment of the present disclosure.
  • Figure 3A is a schematic flow chart of another service response method provided by an embodiment of the present disclosure.
  • Figure 3B is a working schematic diagram of an application layer NSS architecture provided by an embodiment of the present disclosure.
  • Figure 4A is a schematic flowchart of another service response method provided by an embodiment of the present disclosure.
  • Figure 4B is a schematic process diagram of a service response method provided by an embodiment of the present disclosure.
  • Figure 5 is a schematic structural diagram of a service response device provided by an embodiment of the present disclosure.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • the term “include” and its variations are open-ended, ie, “including but not limited to.”
  • the term “based on” means “based at least in part on.”
  • the term “one embodiment” means “at least one embodiment”; the term “another embodiment” means “at least one additional embodiment”; and the term “some embodiments” means “at least some embodiments”. Relevant definitions of other terms will be given in the description below.
  • a prompt message is sent to the user to clearly remind the user that the operation requested will require the acquisition and use of the user's personal information. Therefore, users can autonomously choose whether to provide personal information to software or hardware such as electronic devices, applications, servers or storage media that perform the operations of the technical solution of the present disclosure based on the prompt information.
  • the method of sending prompt information to the user may be, for example, a pop-up window, and the prompt information may be presented in the form of text in the pop-up window.
  • the pop-up window can also contain a selection control for the user to choose "agree” or "disagree” to provide personal information to the electronic device.
  • Figure 1 is a schematic flow chart of a service response method provided by an embodiment of the present disclosure.
  • the embodiment of the present disclosure is suitable for detecting a preset service port through a socket detection mechanism and obtaining services initiated by each client through the preset service port. request message, determine the target service response process corresponding to the service request message, and respond to the service request message through the target service response process.
  • the method can be executed by a service response device, and the device can be implemented through software and/or Or implemented in the form of hardware.
  • it can be implemented through electronic equipment.
  • the electronic equipment can be a mobile terminal, a personal computer (Personal Computer, PC) or a server.
  • PC Personal Computer
  • the method includes:
  • the target client identification information corresponding to the requesting client is determined based on the service request message.
  • the socket detection mechanism may be a mechanism in which at least one socket in the server corresponding to the preset service port detects the preset service port to detect service request messages sent by each requesting client through the preset service port. .
  • the preset service port may be a port for the requesting client to allow the requesting client to request business services from the server.
  • the requesting client may send a service request message to the preset service port to request the preset service port.
  • the preset service ports corresponding to different business services may be different.
  • the default service port corresponding to requesting live broadcast data is port_a
  • the default service port corresponding to requesting web page update data is port_b.
  • the identification information corresponding to the requesting client can be determined based on the service request message. That is, the target client identification information.
  • the service request message can be parsed, and identification information that uniquely describes the requesting client can be parsed from the service request message and used as the target client identification information. For example, if the service request message is an HTTP/3 (HyperText Transfer Protocol/3) message, you can directly extract from the HTTP3 protocol message that can be used to describe the identity information of the requesting client. Target client identification information.
  • HTTP/3 HyperText Transfer Protocol/3
  • the target client identification information used to describe the identity information of the requesting client can also be calculated based on the information in the service request message.
  • the service request message carries the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address and transport layer protocol of the service response process; based on the service request message
  • the document determines the target client identification information corresponding to the requesting client, including: based on the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address and transport of the service response process layer protocol to generate target client identification information corresponding to the requesting client.
  • the protocol port of the requesting client can be the source port of the service request message; the Internet Protocol address of the requesting client can be the source IP (Internet Protocol, Internet Protocol) address of the service request message; the protocol of the service response process The port may be the destination port of the service request message; the Internet Protocol address of the service response process may be the destination IP address of the service request message.
  • the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address of the service response process and the transport layer protocol can be used as the service request report.
  • the five-tuple information of the document is generated, and the target client identification information corresponding to the requesting client is generated based on the five-tuple information.
  • the target client identification information can be generated based on the five-tuple information in the message. In this way, unique identification information describing the business service requested by the target client can be obtained, thereby facilitating the determination of a process that responds to the client's service request based on the unique identification information.
  • a target client corresponding to the requesting client is generated based on the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address of the service response process, and the transport layer protocol.
  • the identification information may be: calculating the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address of the service response process and the transport layer protocol according to a preset hash algorithm , using the calculated hash value as the target client identification information corresponding to the requesting client.
  • the preset hash algorithm may be a hash algorithm such as MD5 (MD5 Message-Digest Algorithm, MD5 message digest algorithm), SHA (Secure Hash Algorithm, secure hash algorithm), etc.
  • the preset hash algorithm can be used to calculate a hash value that meets the preset length based on the given five-tuple information, that is, the hash value.
  • the hash value calculated by the preset hash algorithm is unique, and different five-tuple information corresponds to different hash values. Therefore, a preset hash algorithm can be used to calculate the five-tuple information to obtain target client identification information that conforms to the preset length.
  • the preset length may be 32 bits, which is not limited in this embodiment of the disclosure. Calculating the target client identification information through a hash algorithm can ensure that the target client identification information is unique, and can obtain fixed-length target client identification information, reducing the storage overhead required for the target client identification information.
  • the service data file records the client identification information of the connected client that has connected to the service response process, and the socket of the service response process to which the connected client is connected.
  • the service response process may be a process in the server used to respond to the client's business service, that is, a process that processes the client's service request message. For each service response process, a corresponding socket can be set.
  • the target client identification information For example, after obtaining the target client identification information, you can query whether the target client identification information exists in the service data file. If it exists, it means that the requesting client is a connected client that has connected to the service response process. end, you can use the socket corresponding to the target client identification information in the service data file as the target socket corresponding to the service request message to request the service through the service response process that was last connected to the requesting client. The message is processed.
  • the target client identification information does not exist in the service data file, it can mean that the requesting client is an unconnected client that has not connected to the service response process.
  • the target socket that conforms to the protocol corresponding to the service request message may be determined from at least one socket monitoring the preset service port according to the protocol corresponding to the service request message.
  • the target client identification information does not exist in the service data file, you can also determine the estimated processing overhead corresponding to the service request message, and monitor the destination of the preset service port based on the estimated processing overhead.
  • the service corresponding to one less socket responds to the load information of the process and determines the target socket in at least one socket. For example, according to the load balancing scheduling principle of each service response process in the server, through the load information of the service response process corresponding to at least one socket, and the expected processing overhead of processing the service request message, in each service response process Determine the target service response process, and use the socket corresponding to the target service response process as the target socket.
  • the target service response process can also be determined in the service response process based on the priority of the service response process corresponding to the socket and the load information of the service response process. , use the socket corresponding to the target service response process as the target socket.
  • the service request message can be sent to the target service response process corresponding to the target socket through the target socket, so that the The target service response process processes the service request message, that is, responds to the client's service request.
  • the technical solution of the embodiment of the present disclosure detects the service request message initiated by the requesting client through the preset service port through the socket detection mechanism, determines the target client identification information corresponding to the requesting client according to the service request message, and then determines the target client identification information corresponding to the requesting client according to the service request message.
  • the target client identification information is determined to correspond to the service request message in the pre-established service data file that stores the client identification information of the connected client and the socket of the service response process connected by the connected client.
  • the target socket the service request message is sent to the target service response process according to the target socket, so that after obtaining the service request by detecting the preset service port, the corresponding socket is selected through the target client identification information.
  • the process that processes the service request message is selected through the socket, and the process that responds to the service request is accurately determined, and the response to the client's service request based on the detection of the preset service port is realized, solving the problem of load balancing scheduling.
  • the technical problem of client service request failure caused by the server actually established with the client not detecting the port of the server negotiated with the client can be guaranteed in the scenario of server cluster with load balancing scheduling. Respond effectively to client service requests.
  • this method does not rely on server clusters for load balancing scheduling, and can also be applied to various servers, with scalability and Strong portability.
  • FIG. 2 is a schematic flow chart of another service response method provided by an embodiment of the present disclosure.
  • the target socket corresponding to the service request message is determined according to the target client identification information and the pre-established service data file. Including: if the target client identification information is not found based on the pre-established service data file or the socket of the service response process corresponding to the target client identification information is not found, then at least one socket of the preset service port is detected based on The default socket option of the word determines the target socket corresponding to the service request message.
  • the method includes:
  • socket detection mechanism detects the service request message initiated by the requesting client through the preset service port, determine the target client identification information corresponding to the requesting client based on the service request message.
  • the target client identification information is not found based on the pre-established service data file or the socket of the service response process corresponding to the target client identification information is not found, detect at least one socket of the preset service port.
  • the default socket option of the word determines the target socket corresponding to the service request message.
  • the preset socket options may include at least one of the socket's service protocol, process category, process priority, load and other attribute information.
  • each socket has its corresponding default socket option.
  • at least one socket of the preset service port can be detected. Select the target socket from the word's default socket options.
  • the target client identification information is not found in the service data file, or the socket of the service response process corresponding to the target client identification information is not found, it can be determined that the requesting client is establishing a connection for the first time.
  • client For a client that establishes a connection for the first time, for example, the target socket corresponding to the service request message is determined according to the preset socket option of at least one socket of the preset service port, which may be: based on the detection
  • the load information and process priority in the default socket option of at least one socket of the default service port are determined in detecting at least one socket of the default service port. Target socket.
  • the preset socket option includes a process flag bit.
  • the process flag bit is used to reflect the correspondence between the socket and the service response process; at least one socket of the preset service port is detected.
  • the preset socket option of the socket determines the target socket corresponding to the service request message, including: based on detecting the process flag bit of the at least one socket of the preset service port, determining the target socket corresponding to the service request message. The corresponding target socket.
  • the process flag bit can be used to determine the process type of the service response process corresponding to the socket.
  • the service response process can include the old service response process used to connect to the service resources before the service version update and the old service response process used to connect to the service The new service response process of the service resource after version update. That is, the process flag bit can be used to distinguish whether the service response process corresponding to the socket is an old service response process or a new service response process.
  • smooth upgrade refers to the hot update of the server version without stopping the service.
  • the existing connection is continuous and can serve the outside world normally.
  • the client's service request can be processed through the old service response process and the new service response process respectively.
  • At least one socket of the preset service port can be detected based on the detection.
  • the process flag bit of the socket determine the socket corresponding to the new service response process in the at least one socket, and use the socket corresponding to the new service response process as the target socket to pass the target socket Send the service request message to the new service response process for processing.
  • the process that responds to the service request message is determined based on the process flag bit of the socket, thereby achieving accurate determination of the process that responds to the service request message and ensuring response to the client's service request.
  • determining the target socket corresponding to the service request message based on detecting the process flag bit of at least one socket of the preset service port may be: based on detecting the process flag of at least one socket of the preset service port.
  • the process flag bit of one missing socket is determined to determine the socket corresponding to the new service response process as the candidate socket; the target socket corresponding to the service request message is determined based on the candidate socket.
  • process flag bit when the process flag bit is 1, it means that the service response process corresponding to the socket with the process flag bit is the old service response process; when the process flag bit is 0, it means that the service response process corresponding to the socket with the process flag bit is the new service response process. Service response process.
  • the socket corresponding to the new service response process can be determined as a candidate socket among all the sockets that detect the preset service port. Determine the target socket among the candidate sockets based on the load, priority, or service agreement of the candidate socket. In this way, the old service response process or the new service response process that responds to the client's service request message is determined.
  • the client can be updated by the connection service version when first requesting the server. The process of the service resource is processed, and when the server is not requested for the first time, the process of connecting the service resource before the service version is updated is processed, ensuring an effective response to the client's service request under the smooth upgrade of the server RTS.
  • the target service response process after sending the service request message to the target service response process through the target socket, it also includes: storing the target client identification information corresponding to the requesting client and the target socket in the service data file. .
  • the requesting client after processing the service request message of the requesting client, the requesting client can be regarded as a connected client of the connected service response process. Therefore, the target client identification information and the target socket association corresponding to the requesting client can be stored in the service data file, so that when the service request message of the requesting client is subsequently obtained, the information stored in the service data file can be The target client identification information corresponding to the requesting client determines the target socket.
  • the situation is described if the target client identification information is not found in the service data file or the socket of the service response process corresponding to the target client identification information is not found.
  • it also includes: if the socket of the service response process corresponding to the target client identification information is found based on the pre-established service data file, then the found socket corresponding to the target client identification information is The socket of the service response process is used as the target socket corresponding to the service request message.
  • the socket of the service response process corresponding to the target client identification information is found in the service data file, it is determined that the requesting client is not the client connecting for the first time. Based on this, the found one can be compared with the target client
  • the socket of the service response process corresponding to the identification information is used as the target socket to continue processing the service request message of the requesting client through the service response process corresponding to the target socket. In this way, it is possible to continue to respond to a client that has responded to a service request through the process of historically responding to the client's service request.
  • the technical solution of the embodiment of the present disclosure is that when the target client identification information or the socket of the service response process corresponding to the target client identification information is not found in the pre-established service file data, at least one of the preset service ports is detected based on the detection.
  • the default socket option of a socket determines the target socket corresponding to the service request message to accurately determine the process that first responds to the client's service request and ensure that the client's service request can be effectively responded to. .
  • Figure 3A is a schematic flowchart of another service response method provided by an embodiment of the present disclosure.
  • it also includes: when receiving an update instruction for updating the service version of the service resource, using the service of the currently connected service resource.
  • the response process is used as the parent process, and a child process is created to connect to the updated service resource.
  • the parent process is used as the old service response process, and the child process is used as the new service response process.
  • the method includes:
  • the update instruction may be sent by the cloud or the management server. For example, when the cloud or the management server detects the existence of a new version, it generates an update instruction and sends it to the server. Alternatively, update instructions can be automatically generated when the user triggers the version update control.
  • the server receives the update instruction, it indicates that the server needs to update the service version to update the client-oriented service resources; at this time, the service response of the currently connected service resource can be processed.
  • Process as the parent process that is, the old service response process, and create a child process for connecting to the updated service resources, that is, the new service response process.
  • the child process can inherit the data segment, user stack, address space, shared memory and other information of the parent process.
  • the server creates a new service response process
  • the new service response process can be created and at the same time, the socket corresponding to each service response process can be added. Default socket options.
  • it also includes: adding a preset socket option to at least one socket corresponding to the old service response process for detecting the preset service port, so as to distinguish between the old service response process and the new service response process. Correspondence between the at least one socket and/or correspondence between the at least one socket and the message type of the service request message.
  • preset socket options may be added for the sockets corresponding to the old service response process and the sockets corresponding to the new service response process. If the default socket option includes a process flag bit, the service response process corresponding to each socket can be distinguished as an old service response process or a new service response process. If the default socket option includes a protocol flag bit, the service protocol corresponding to each socket can be distinguished, that is, the message types of the service request messages that the socket can handle can be distinguished.
  • the connection between the old service response process and the new service response process and the at least one socket can be achieved. Differentiation of the correspondence relationship, and the distinction between the correspondence relationship between the socket and the message type of the service request message can also be realized, so that when the service request message is obtained, the determination can be made based on the preset socket options. Out the corresponding target socket.
  • an application layer NSS (Next generation Streaming Server) architecture can be deployed in the server, and a corresponding default socket can be set for at least one socket that detects the default service port through the application layer NSS architecture.
  • interface options Exemplarily, as shown in Figure 3B, a working schematic diagram of an application layer NSS architecture is shown. Among them, first, the application layer NSS architecture is started, and the server performs NSS smooth upgrade; the NSS architecture is initialized, traverses the addresses being detected, determines at least one socket that detects the preset service port, and checks the socket corresponding to the parent process.
  • the process flag bit in the option is assigned a preset mark, or the protocol flag bit in the preset socket option of the at least one socket is assigned a value according to the service protocol of the at least one socket to set the Default socket options for at least one socket.
  • the socket detection mechanism detects the service request message initiated by the requesting client through the preset service port, determine the target client identification information corresponding to the requesting client based on the service request message.
  • the target client identification information is not found based on the pre-established service data file or the socket of the service response process corresponding to the target client identification information is not found, detect at least one socket of the preset service port.
  • the process flag bit of the word is used to determine the socket corresponding to the new service response process as the candidate socket, and the target socket corresponding to the service request message is determined based on the candidate socket.
  • any candidate socket can be used as the target socket.
  • the target socket corresponding to the service request message can also be determined among each candidate socket according to a preset polling mechanism.
  • the preset polling mechanism may be to sequentially determine the target socket corresponding to the current service request message according to the order in the preset sequence list of sockets corresponding to each new service response process. .
  • the process of processing the service request message sent by the current requesting client can be determined through the above method.
  • Smooth upgrade refers to the hot update of the server version without stopping the service.
  • the existing connection is continuous and can serve the outside world normally.
  • Smooth upgrade is generally a method in which the server starts a child process in the parent process and shuts down the parent process after a period of time.
  • the child process represents the new version.
  • the smooth upgrade of the RTS protocol currently adopts dual-port mode, that is, the child process and the parent process detect different ports respectively.
  • the client will first negotiate the port with the server.
  • the negotiation result will be the sub-process port, and the client will establish a connection with the sub-process port.
  • the server negotiated by the client may be different from the server actually established, and the ports detected by each server may also be different. It may cause the client to fail to establish a connection, causing the client's RTS protocol service request to fail. Therefore, in order to solve this problem, the service response method provided by each embodiment of the present disclosure can be used to detect the preset service port and obtain the service request message of the RTS protocol sent by the client. Each server obtains the service request message by detecting the preset service port. After sending the service request message to the client, the target client identification information is determined.
  • the process identification bit of at least one socket can be used to determine the target client identification information.
  • the socket corresponding to the new service response process is used to hand over the service request message to the new service response process for processing, thereby realizing the determination of the process for processing the service request message, thereby realizing the response to the client's service request, and solving the problem in
  • Each server in the server cluster detects different ports, causing the client's RTS protocol smooth upgrade service request to fail.
  • the technical solution of the embodiment of the present disclosure is that when receiving an update instruction for updating the service version of the service resource, the service response process currently connected to the service resource is used as the parent process, that is, the old service response process, and creates a service response process for updating the service version of the service resource.
  • the sub-process connected to the updated service resource that is, the new service response process, realizes the determination of the new service response process and the old service response process.
  • the new service response process and the old service response process can be realized. , respectively respond to clients that request services for the first time and clients that do not request services for the first time.
  • Figure 4A is a schematic flowchart of another service response method provided by an embodiment of the present disclosure.
  • the default socket option also includes a protocol flag bit, and the protocol flag bit is used to reflect the socket and service Correspondence between the message types of the request message; determine the target socket corresponding to the service request message according to the detection of the default socket option of at least one socket of the preset service port, including: according to the detection Preset the protocol flag bit of the at least one socket of the service port, determine the socket corresponding to the message type corresponding to the service request message as a candidate socket; determine the service request message according to the candidate socket The corresponding target socket.
  • the method includes:
  • the target client identification information is not found based on the pre-established service data file or the socket of the service response process corresponding to the target client identification information is not found, detect at least one socket of the preset service port.
  • the protocol flag bit of the word determines the socket corresponding to the message type corresponding to the service request message as the candidate socket, and determines the target socket corresponding to the service request message based on the candidate socket.
  • the protocol flag bit may be a flag bit used to describe the service protocol of the socket. For example, if the service protocol of the socket is the RTS protocol, the protocol flag bit may be 1; if the service protocol of the socket is the HTTP/3 protocol, the protocol flag bit may be 2, etc.
  • this embodiment can detect at least one socket of the preset service port when the target client identification information or the socket of the service response process corresponding to the target client identification information is not found according to the service data file.
  • the protocol flag bit of the word is used to determine the socket corresponding to the message type of the service request message in the at least one socket, that is, the socket whose service protocol is consistent with the message type is determined, and the socket is determined. as a candidate socket.
  • any socket among the candidate sockets can be used as the target socket.
  • the candidate socket corresponding to the new service response process can be determined as the target socket according to the process flag bit of the candidate socket. It can be understood that if there are multiple candidate sockets corresponding to the new service response process, any one of the candidate sockets can be used as the target socket, and the candidate socket with the smallest load can also be used as the target socket. pick up words.
  • the client can be requested to serve the first request.
  • the client is a client, based on detecting the process flag bit and protocol flag bit of at least one socket of the preset service port, a new service response that satisfies the message type of the service request message is determined in the at least one socket.
  • the socket corresponding to the process is implemented based on the process flag bit. Accurate determination of socket and protocol flags.
  • the five-tuple information can be extracted from the IP header and UDP (User Datagram Protocol) header of the RTS message, and then based on the five-tuple information Calculate the 32-bit ID (that is, the target client identification information), and query in the MAP (that is, the service data file) based on the target client identification information to see whether the ID is in the MAP. If the ID is in the MAP, the service request message is sent to the socket corresponding to the ID (that is, the target socket). If the ID is not in the MAP, all sockets bound to the preset service port are traversed. The default socket option of the socket, find the process flag bit to represent the new service response process, and the protocol flag bit represents the socket of the RTS protocol, send the service request message to the socket, and combine the ID with the socket The association is stored in MAP.
  • UDP User Datagram Protocol
  • the technical solution of the embodiment of the present disclosure is that when the target client identification information is not found based on the pre-established service data file or the socket of the service response process corresponding to the target client identification information is not found, the preset service is detected based on The protocol flag bit of at least one socket of the port determines the socket corresponding to the message type corresponding to the service request message as a candidate socket, and determines the target socket corresponding to the service request message based on the candidate socket.
  • the word realizes the accurate determination of the process that responds to the client's service request for the first time based on the process flag bit, ensuring that the client's service request can be effectively responded to.
  • Figure 5 is a schematic structural diagram of a service response device provided by an embodiment of the present disclosure. As shown in Figure 5, the device includes: a client request module 510, a socket determination module 520, and a request response module 530.
  • the client request module 510 is configured to determine a target corresponding to the requesting client based on the service request message when a service request message initiated by the requesting client through the preset service port is detected through the socket detection mechanism.
  • Client identification information
  • the socket determination module 520 is configured to determine the socket based on the target client identification information and the pre-established service.
  • the service data file determines the target socket corresponding to the service request message, wherein the service data file is used to store the client identification information of the connected client of the connected service response process and the socket of the connected service response process. Correspondence between interfaces;
  • the request response module 530 is configured to send the service request message to the target service response process through the target socket.
  • this embodiment can also provide a kernel module.
  • the service response device is integrated in the kernel module.
  • the kernel module can transfer the service request message sent by the client to the correct service response process through the service response device.
  • the technical solution provided by the embodiment of the present disclosure detects the service request message initiated by the requesting client through the preset service port through the socket detection mechanism, and determines the target client identification information corresponding to the requesting client according to the service request message. Then, according to the target client identification information, in the pre-established service data file corresponding to the client identification information of the connected client and the socket of the service response process connected by the connected client, the service request report is determined. The target socket corresponding to the file is sent to the target service response process according to the target socket. After obtaining the service request by detecting the preset service port, the corresponding socket is selected through the target client identification information.
  • the service request message carries the protocol port of the requesting client, the Internet protocol address of the requesting client, the protocol port of the service response process, The Internet Protocol address and transport layer protocol of the service response process;
  • the client request module 510 includes an identification determination unit, and the identification determination unit is configured to respond to the request The protocol port of the client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address of the service response process and the transport layer protocol generate a target corresponding to the requesting client.
  • Client identification information is configured to respond to the request The protocol port of the client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address of the service response process and the transport layer protocol generate a target corresponding to the requesting client.
  • the identification determination unit is configured to: determine the protocol port of the requesting client and the Internet connection of the requesting client according to a preset hash algorithm.
  • the interconnection protocol address, the protocol port of the service response process, the Internet protocol address of the service response process and the transport layer protocol are calculated, and the calculated hash value is used as the target client identification information corresponding to the requesting client.
  • the socket determination module 520 includes a first socket determination unit, and the first socket determination unit is set to if Based on the pre-established service data file, the target client identification information is not found or the socket of the service response process corresponding to the target client identification information is not found, then at least one of the preset service ports is detected based on The default socket option of a socket determines the target socket corresponding to the service request message.
  • the preset socket option includes a process flag bit, and the process flag bit is used to reflect the relationship between the socket and the service response process.
  • the corresponding relationship; the first socket determination unit is also configured to determine the target socket corresponding to the service request message based on detecting the process flag bit of at least one socket of the preset service port. .
  • the service response process includes an old service response process for connecting to service resources before the service version is updated and an old service response process for connecting to after the service version is updated.
  • the new service response process of the service resource; the first socket determination unit is also configured to determine the process corresponding to the new service response based on detecting the process flag bit of the at least one socket of the preset service port.
  • the socket corresponding to the process is used as an alternative socket; the target socket corresponding to the service request message is determined according to the alternative socket.
  • the device further includes a process creation module.
  • the process creation module is configured to when a service for updating service resources is received.
  • the version update instruction is issued, use the service response process currently connected to the service resource as the parent process, create a child process for connecting to the updated service resource, use the parent process as the old service response process, and use the child process as the old service response process. Respond to the process as a new service.
  • the process creation module is also configured to be at least one corresponding to the old service response process for detecting the preset service port. Adding a preset socket option to a socket to distinguish the corresponding relationship between the old service response process and the new service response process and the at least one socket and/or the at least one socket and the service The correspondence between the message types of the request message.
  • the preset socket option also includes a protocol flag bit, and the protocol flag bit is used to reflect the socket and the service request.
  • the socket determination module 520 includes a second socket determination unit, the second determination unit is configured to detect at least one socket of the preset service port The protocol flag bit of the socket determines the socket corresponding to the message type corresponding to the service request message as the candidate socket; determines the target socket corresponding to the service request message according to the candidate socket. pick up words.
  • the socket determination module is also configured to combine the target client identification information corresponding to the requesting client and the target socket.
  • the interface correspondence is stored in the service data file.
  • the socket determination module is also configured to find the corresponding target client identification information based on the pre-established service data file. If the socket of the service response process is found, the found socket of the service response process corresponding to the target client identification information is used as the target socket corresponding to the service request message.
  • the service response device provided by the embodiment of the present disclosure can execute the service response method provided by any embodiment of the present disclosure, and has corresponding functional modules for executing the method.
  • FIG. 6 is a schematic structural diagram of an electronic device provided by an embodiment of the present disclosure.
  • Terminal devices in embodiments of the present disclosure may include, but are not limited to, mobile phones, notebook computers, digital broadcast receivers, personal digital assistants (Personal Digital Assistant, PDA), PAD (tablet computers), portable multimedia players (Portable Media Player , PMP), mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals), and fixed terminals such as digital televisions (Television, TV), desktop computers, etc.
  • PDA Personal Digital Assistant
  • PAD tablet computers
  • PMP portable multimedia players
  • mobile terminals such as vehicle-mounted terminals (such as vehicle-mounted navigation terminals)
  • fixed terminals such as digital televisions (Television, TV), desktop computers, etc.
  • the electronic device shown in FIG. 6 is only an example and should not impose any limitations on the functions and scope of use of the embodiments of the present disclosure.
  • the electronic device 600 may include a processing device (such as a central processing unit, a graphics processor, etc.) 601, which may process data according to a program stored in a read-only memory (Read-Only Memory, ROM) 602 or from a storage device. 608 loads the program in the random access memory (Random Access Memory, RAM) 603 to perform various appropriate actions and processing. In the RAM 603, various programs and data required for the operation of the electronic device 600 are also stored.
  • the processing device 601, ROM 602 and RAM 603 are connected to each other via a bus 604.
  • An input/output (I/O) interface 605 is also connected to bus 604.
  • input devices 606 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; including, for example, a Liquid Crystal Display (LCD) , an output device 607 such as a speaker, a vibrator, etc.; a storage device 608 including a magnetic tape, a hard disk, etc.; and a communication device 609.
  • Communication device 609 may allow electronic device 600 to communicate wirelessly or wiredly with other devices to exchange data.
  • FIG. 6 illustrates electronic device 600 with various means, it should be understood that implementation or availability of all illustrated means is not required. More or fewer means may alternatively be implemented or provided.
  • embodiments of the present disclosure include a computer program product that includes A computer program contained on a non-transitory computer-readable medium, the computer program containing program code for performing the method illustrated in the flowchart.
  • the computer program may be downloaded and installed from the network via communication device 609, or from storage device 608, or from ROM 602.
  • the processing device 601 When the computer program is executed by the processing device 601, the above functions defined in the method of the embodiment of the present disclosure are performed.
  • Embodiments of the present disclosure provide a computer storage medium on which a computer program is stored.
  • the program is executed by a processor, the service response method provided by the above embodiments is implemented.
  • the computer-readable medium mentioned above in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium, or any combination of the above two.
  • the computer-readable storage medium may be, for example, but is not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus or device, or any combination thereof.
  • Computer readable storage media may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard drive, random access memory (RAM), read only memory (ROM), removable Programmable read-only memory (EPROM (Erasable Programmable Read-Only Memory) or flash memory), optical fiber, portable compact disk read-only memory (Compact Disc Read-Only Memory, CD-ROM), optical storage device, magnetic storage device, or the above Any suitable combination.
  • a computer-readable storage medium may be any tangible medium that contains or stores a program for use by or in connection with an instruction execution system, apparatus, or device.
  • a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code therein. Such propagated data signals may take many forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above.
  • a computer-readable signal medium can also be any computer-readable medium other than a computer-readable storage medium that can be sent, propagated, or transmitted A program for use by or in connection with an instruction execution system, apparatus, or device.
  • Program code contained on a computer-readable medium can be transmitted using any appropriate medium, including but not limited to: wires, optical cables, radio frequency (Radio Frequency, RF), etc., or any suitable combination of the above.
  • the client and server can communicate using any currently known or future developed network protocol such as HTTP (HyperText Transfer Protocol), and can communicate with digital data in any form or medium.
  • Communications e.g., communications network
  • Examples of communication networks include Local Area Networks (LANs), Wide Area Networks (WANs), the Internet (e.g., the Internet), and end-to-end networks (e.g., ad hoc end-to-end networks), as well as any current network for knowledge or future research and development.
  • LANs Local Area Networks
  • WANs Wide Area Networks
  • the Internet e.g., the Internet
  • end-to-end networks e.g., ad hoc end-to-end networks
  • the above-mentioned computer-readable medium may be included in the above-mentioned electronic device; it may also exist independently without being assembled into the electronic device.
  • the above-mentioned computer-readable medium carries at least one program.
  • the electronic device executes the above-mentioned at least one program.
  • the computer-readable medium carries at least one program.
  • the electronic device detects a service request report initiated by the requesting client through the preset service port through the socket detection mechanism.
  • Target socket wherein the client identification information of the connected client of the connected service response process in the service data file is stored correspondingly with the socket of the service response process connected to the connected client; through the target The socket sends the service request message to the target service response process.
  • Computer program code for performing the operations of the present disclosure may be written in one or more programming languages, including but not limited to object-oriented programming languages—such as Java, Smalltalk, C++, and Includes conventional procedural programming languages—such as "C” or similar programming languages.
  • the program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on the user's computer.
  • Executed on a remote computer or entirely on a remote computer or server.
  • the remote computer can be connected to the user's computer through any kind of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (such as an Internet service provider through Internet connection).
  • LAN local area network
  • WAN wide area network
  • Internet service provider such as an Internet service provider through Internet connection
  • each block in the flowchart or block diagram may represent a module, segment, or portion of code that contains one or more logic functions that implement the specified executable instructions.
  • the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown one after another may actually execute substantially in parallel, or they may sometimes execute in the reverse order, depending on the functionality involved.
  • each block of the block diagram and/or flowchart illustration, and combinations of blocks in the block diagram and/or flowchart illustration can be implemented by special purpose hardware-based systems that perform the specified functions or operations. , or can be implemented using a combination of specialized hardware and computer instructions.
  • the units involved in the embodiments of the present disclosure can be implemented in software or hardware.
  • the name of the unit does not constitute a limitation on the unit itself under certain circumstances.
  • the first acquisition unit can also be described as "the unit that acquires at least two Internet Protocol addresses.”
  • exemplary types of hardware logic components include: field programmable gate array (Field Programmable Gate Array, FPGA), application specific integrated circuit (Application Specific Integrated Circuit, ASIC), application specific standard product (Application Specific Standard Parts (ASSP), System on Chip (SOC), Complex Programmable Logic Device (CPLD), etc.
  • a machine-readable medium may be a tangible medium that may contain or be stored for use by or in connection with an instruction execution system, apparatus, or device program used.
  • the machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium.
  • Machine-readable media may include, but are not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or devices, or any suitable combination of the foregoing.
  • machine-readable storage media would include one or more wire-based electrical connections, laptop disks, hard drives, random access memory (RAM), read only memory (ROM), erasable programmable read only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination of the above.
  • RAM random access memory
  • ROM read only memory
  • EPROM or flash memory erasable programmable read only memory
  • CD-ROM portable compact disk read-only memory
  • magnetic storage device or any suitable combination of the above.
  • Example 1 provides a service response method, including:
  • the service request message is sent to the target service response process through the target socket.
  • Example 2 provides a service response method, which further includes:
  • the service request message carries the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address and the transport layer protocol of the service response process;
  • Determining the target client identification information corresponding to the requesting client based on the service request message includes:
  • a link is generated with the requesting client.
  • the target client identification information corresponding to the client.
  • Example 3 provides a service response method, which further includes:
  • the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address of the service response process and the transport layer protocol are generated and described.
  • Request the target client identification information corresponding to the client including:
  • the protocol port of the requesting client, the Internet Protocol address of the requesting client, the protocol port of the service response process, the Internet Protocol address and the transport layer protocol of the service response process are calculated according to the preset hash algorithm, and the The calculated hash value is used as the target client identification information corresponding to the requesting client.
  • Example 4 provides a service response method, which further includes:
  • determining the target socket corresponding to the service request message based on the target client identification information and a pre-established service data file includes:
  • the preset socket option of at least one socket determines the target socket corresponding to the service request message.
  • Example 5 provides a service response method, which further includes:
  • the preset socket options include a process flag bit, and the process flag bit is used to reflect the corresponding relationship between the socket and the service response process;
  • Determining the target socket corresponding to the service request message based on detecting the preset socket option of at least one socket of the preset service port includes:
  • the target socket corresponding to the service request message is determined based on detecting the process flag bit of the at least one socket of the preset service port.
  • Example 6 provides a service response method, which Law, also includes:
  • the service response process includes an old service response process used to connect to service resources before the service version is updated and a new service response process used to connect to service resources after the service version is updated;
  • Determining the target socket corresponding to the service request message based on detecting the process flag bit of the at least one socket of the preset service port includes:
  • Example 7 provides a service response method, which further includes:
  • Optional also includes:
  • the service response process currently connected to the service resource is used as the parent process, a child process for connecting to the updated service resource is created, and the parent process is used as the parent process.
  • the old service response process uses the child process as the new service response process.
  • Example 8 provides a service response method, which further includes:
  • Optional also includes:
  • Example 9 provides a service response method, which further includes:
  • the preset socket option also includes a protocol flag bit, which is used to reflect the correspondence between the socket and the message type of the service request message;
  • Example 10 provides a service response method, which method further includes:
  • the method further includes:
  • Target client identification information corresponding to the requesting client and the target socket are correspondingly stored in the service data file.
  • Example 11 provides a service response method, which further includes:
  • Optional also includes:
  • the found socket of the service response process corresponding to the target client identification information is As the target socket corresponding to the service request message.
  • Example 12 provides a service response device, which includes:
  • the client request module is configured to determine the target client corresponding to the requesting client based on the service request message when a service request message initiated by the requesting client through the preset service port is detected through the socket detection mechanism. terminal identification information;
  • a socket determination module configured to determine the target socket corresponding to the service request message according to the target client identification information and a pre-established service data file, wherein the service data file is used to store the connected The correspondence between the client identification information of the connected client of the service response process and the socket of the connected service response process;
  • the request response module is configured to send the service request message to the target through the target socket. Standard service response process.

Abstract

本公开实施例提供了一种服务响应方法、装置、设备及存储介质。该方法通过套接字检测机制检测请求客户端通过预设服务端口发起的服务请求报文,根据服务请求报文确定该请求客户端对应的目标客户端标识信息,进而根据该目标客户端标识信息,在预先建立的对应存储了已连接客户端的客户端标识信息和已连接客户端连接的服务响应进程的套接字的服务数据文件中,确定与该服务请求报文对应的目标套接字,根据目标套接字将该服务请求报文发送至目标服务响应进程。

Description

服务响应方法、装置、设备及存储介质
本公开要求在2022年5月11日提交中国专利局、申请号为202210513481.0的中国专利申请的优先权,该申请的全部内容通过引用结合在本公开中。
技术领域
本公开实施例涉及通信技术,例如涉及一种服务响应方法、装置、设备及存储介质。
背景技术
在一个服务器集群中,不同的服务器可能检测不同的端口。客户端在向服务器请求服务时,会先与服务器进行端口协商,再根据协商的端口进行实际建连,即客户端和协商的端口建立连接。
然而,在服务器集群受负载均衡调度控制的场景下,上述请求服务的方法可能会使得客户端协商时的服务器与实际建连的服务器不同,如客户端与服务器A进行端口协商,协商的端口为端口a,但负载均衡调度下使得客户端与服务器B进行实际建连。各服务器所检测的端口可能不一致,如服务器B并没有检测端口a,使得客户端建连失败。
因此,相关技术存在以下技术问题:在负载均衡调度的服务器集群的场景下,各个服务器所检测的端口可以不同,若与客户端实际建连的服务器未检测到与客户端协商的服务器的端口,则造成客户端服务请求失效。
发明内容
本公开提供一种服务响应方法、装置、设备及存储介质,以解决在负载均衡调度的服务器集群的场景下,由于与客户端实际建连的服务器未检测到与客户端协商的服务器的端口所造成的客户端服务请求失效的技术问题。
第一方面,本公开实施例提供了一种服务响应方法,包括:
响应于通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;
根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件中已连接服务响应进程的已连接客户端的客户端标识信息与所述已连接客户端连接的服务响应进程的套接字对应存储;
通过所述目标套接字将所述服务请求报文发送至目标服务响应进程。
第二方面,本公开实施例还提供了一种服务响应装置,包括:
客户端请求模块,设置为响应于通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;
套接字确定模块,设置为根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件用于存储已连接服务响应进程的已连接客户端的客户端标识信息与所述已连接客户端连接的服务响应进程的套接字之间的对应关系;
请求响应模块,设置为通过所述目标套接字将所述服务请求报文发送至目标服务响应进程。
第三方面,本公开实施例还提供了一种电子设备,所述电子设备包括:
至少一个处理器;
存储装置,设置为存储至少一个程序,
当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如本公开任一实施例所述的服务响应方法。
第四方面,本公开实施例还提供了一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如本公开任一实施例所述的服务响应方法。
附图说明
贯穿附图中,相同或相似的附图标记表示相同或相似的元素。应当理解附图是示意性的,原件和元素不一定按照比例绘制。
图1为本公开实施例所提供的一种服务响应方法的流程示意图;
图2为本公开实施例所提供的另一种服务响应方法的流程示意图;
图3A为本公开实施例所提供的另一种服务响应方法的流程示意图;
图3B为本公开实施例所提供的一种应用层NSS架构的工作示意图;
图4A为本公开实施例所提供的另一种服务响应方法的流程示意图;
图4B为本公开实施例所提供的一种服务响应方法的过程示意图;
图5为本公开实施例所提供的一种服务响应装置的结构示意图;
图6为本公开实施例所提供的一种电子设备的结构示意图。
具体实施方式
下面将参照附图更详细地描述本公开的实施例。
应当理解,本公开的方法实施方式中记载的各个步骤可以按照不同的顺序执行,和/或并行执行。此外,方法实施方式可以包括附加的步骤和/或省略执行示出的步骤。本公开的范围在此方面不受限制。
本文使用的术语“包括”及其变形是开放性包括,即“包括但不限于”。术语“基于”是“至少部分地基于”。术语“一个实施例”表示“至少一个实施例”;术语“另一实施例”表示“至少一个另外的实施例”;术语“一些实施例”表示“至少一些实施例”。其他术语的相关定义将在下文描述中给出。
需要注意,本公开中提及的“第一”、“第二”等概念仅用于对不同的装置、模块或单元进行区分,并非用于限定这些装置、模块或单元所执行的功能的顺序或者相互依存关系。
需要注意,本公开中提及的“一个”、“多个”的修饰是示意性而非限制性的,本领域技术人员应当理解,除非在上下文另有明确指出,否则应该理解为“至少 一个”。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
可以理解的是,在使用本公开各实施例公开的技术方案之前,均应当依据相关法律法规通过恰当的方式对本公开所涉及个人信息的类型、使用范围、使用场景等告知用户并获得用户的授权。
例如,在响应于接收到用户的主动请求时,向用户发送提示信息,以明确地提示用户,其请求执行的操作将需要获取和使用到用户的个人信息。从而,使得用户可以根据提示信息来自主地选择是否向执行本公开技术方案的操作的电子设备、应用程序、服务器或存储介质等软件或硬件提供个人信息。
作为一种可选的但非限定性的实现方式,响应于接收到用户的主动请求,向用户发送提示信息的方式例如可以是弹窗的方式,弹窗中可以以文字的方式呈现提示信息。此外,弹窗中还可以承载供用户选择“同意”或者“不同意”向电子设备提供个人信息的选择控件。
可以理解的是,上述通知和获取用户授权过程仅是示意性的,不对本公开的实现方式构成限定,其它满足相关法律法规的方式也可应用于本公开的实现方式中。
图1为本公开实施例所提供的一种服务响应方法的流程示意图,本公开实施例适用于通过套接字检测机制检测预设服务端口,获取各客户端通过预设服务端口所发起的服务请求报文,确定服务请求报文对应的目标服务响应进程,通过该目标服务响应进程对该服务请求报文进行响应的情形,该方法可以由服务响应装置来执行,该装置可以通过软件和/或硬件的形式实现,可选的,通过电子设备来实现,该电子设备可以是移动终端、个人计算机(Personal Computer,PC)端或服务器等。
如图1所示,所述方法包括:
S110、当通过套接字检测机制检测到请求客户端通过预设服务端口发起的 服务请求报文时,基于服务请求报文确定与请求客户端对应的目标客户端标识信息。
其中,套接字检测机制可以是服务器中与预设服务端口对应的至少一个套接字对预设服务端口进行检测的机制,以检测各个请求客户端通过预设服务端口发送的服务请求报文。
示例性的,预设服务端口可以是面向请求客户端的用于让请求客户端向服务器请求业务服务的端口,请求客户端可以通过向预设服务端口发送服务请求报文,以请求与该预设服务端口对应的业务服务。其中,不同的业务服务所对应的预设服务端口可以不同。例如,请求直播数据对应的预设服务端口为端口_a,请求网页更新数据对应的预设服务端口为端口_b。
在本公开实施例中,若通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文,则可以根据该服务请求报文确定出与请求客户端对应的标识信息,即目标客户端标识信息。
在一种实施方式中,可以对服务请求报文进行解析,从服务请求报文中解析出唯一描述请求客户端的标识信息,将其作为目标客户端标识信息。例如,若服务请求报文为HTTP/3(HyperText Transfer Protocol/3,超文本传输协议/3)的报文,则可以从HTTP3协议的报文中直接提取可以用于描述请求客户端的身份信息的目标客户端标识信息。
在另一种可选的实施方式中,还可以根据服务请求报文中的信息计算出用于描述请求客户端的身份信息的目标客户端标识信息。示例性的,服务请求报文携带有请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议;基于服务请求报文确定与请求客户端对应的目标客户端标识信息,包括:根据请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议,生成与请求客户端对应的目标客户端标识信息。
其中,请求客户端的协议端口可以是服务请求报文的源端口;请求客户端的网际互连协议地址可以是服务请求报文的源IP(Internet Protocol,网际互连协议)地址;服务响应进程的协议端口可以是服务请求报文的目的端口;服务响应进程的网际互连协议地址可以是服务请求报文的目的IP地址。
在该可选的实施方式中,可以将请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议作为服务请求报文的五元组信息,根据五元组信息生成与请求客户端对应的目标客户端标识信息。示例性的,对于网页即时通信实时流式传输(Real Time Streaming via WebRTC,RTS)协议的服务请求报文,可以根据报文中的五元组信息生成目标客户端标识信息。通过该方式,可以得到描述目标客户端请求业务服务的唯一标识信息,进而便于根据该唯一标识信息确定响应客户端服务请求的进程。
例如,可以直接将五元组信息中的源端口、源IP、目的端口、目的IP和传输层协议组合,将组合后的字符串作为与请求客户端对应的目标客户端标识信息。或者,还可以分别选取源端口、源IP、目的端口、目的IP和传输层协议中的部分信息,组合成与请求客户端对应的目标客户端标识信息。
又比如,根据请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议,生成与请求客户端对应的目标客户端标识信息,可以是:根据预设哈希算法对请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议进行计算,将计算出的哈希值作为与请求客户端对应的目标客户端标识信息。
其中,预设哈希算法可以是诸如MD5(MD5Message-Digest Algorithm,MD5信息摘要算法)、SHA(Secure Hash Algorithm,安全哈希算法)等哈希算法。预设哈希算法可以用于根据给定的五元组信息计算出符合预设长度的散列数值,即哈希值。
通过预设哈希算法所计算出的哈希值具备唯一性,不同的五元组信息所对应的哈希值不同。因此,可以采用预设哈希算法对五元组信息进行计算,得到符合预设长度的目标客户端标识信息。可选的,预设长度可以是32位,本公开实施例对此不进行限定。通过哈希算法计算目标客户端标识信息,可以确保目标客户端标识信息具备唯一性,并且,能够得到固定长度的目标客户端标识信息,降低目标客户端标识信息所需的存储开销。
S120、根据目标客户端标识信息与预先建立的服务数据文件确定与服务请求报文对应的目标套接字,其中,服务数据文件中已连接服务响应进程的已连接客户端的客户端标识信息与已连接客户端连接的服务响应进程的套接字对应存储。
其中,服务数据文件中记录有已连接过服务响应进程的已连接客户端的客户端标识信息,以及该已连接客户端所连接的服务响应进程的套接字。其中,服务响应进程可以是服务器中用于响应客户端的业务服务的进程,即处理客户端的服务请求报文的进程。针对每一个服务响应进程,都可以设置与其对应的套接字。
示例性的,在获取到目标客户端标识信息后,可以在服务数据文件中查询是否存在该目标客户端标识信息,若存在,即表示该请求客户端为已连接过服务响应进程的已连接客户端,可以将服务数据文件中该目标客户端标识信息对应的套接字作为与服务请求报文对应的目标套接字,以通过上一次与请求客户端连接过的服务响应进程对该服务请求报文进行处理。
若服务数据文件中不存在该目标客户端标识信息,则可以表示该请求客户端为未连接过服务响应进程的未连接客户端。针对未连接客户端,可以根据该服务请求报文对应的协议,在监控预设服务端口的至少一个套接字中确定符合该服务请求报文对应的协议的目标套接字。
或者,若服务数据文件中不存在该目标客户端标识信息,还可以确定服务请求报文对应的预计处理开销,根据预计处理开销以及监控预设服务端口的至 少一个套接字对应的服务响应进程的负载信息,在至少一个套接字中确定目标套接字。例如,根据对服务器中的各个服务响应进程的负载均衡调度原则,通过至少一个套接字对应的服务响应进程的负载信息,以及处理该服务请求报文的预计处理开销,在各服务响应进程中确定出目标服务响应进程,将该目标服务响应进程对应的套接字作为目标套接字。
或者,若服务数据文件中不存在该目标客户端标识信息,也可以根据与套接字对应的服务响应进程的优先级以及服务响应进程的负载信息,在服务响应进程中确定出目标服务响应进程,将该目标服务响应进程对应的套接字作为目标套接字。
S130、通过目标套接字将服务请求报文发送至目标服务响应进程。
示例性的,在确定出与服务请求报文对应的目标套接字后,可以通过目标套接字将该服务请求报文发送给与该目标套接字对应的目标服务响应进程,以使该目标服务响应进程对该服务请求报文进行处理,即响应客户端的服务请求。
本公开实施例的技术方案,通过套接字检测机制检测请求客户端通过预设服务端口发起的服务请求报文,根据服务请求报文确定该请求客户端对应的目标客户端标识信息,进而根据该目标客户端标识信息,在预先建立的对应存储了已连接客户端的客户端标识信息和已连接客户端连接的服务响应进程的套接字的服务数据文件中,确定与该服务请求报文对应的目标套接字,根据目标套接字将该服务请求报文发送至目标服务响应进程,以通过检测预设服务端口获取到服务请求后,通过目标客户端标识信息选取对应的套接字,进而通过套接字选取处理该服务请求报文的进程,实现了响应服务请求的进程的准确确定,进而实现了基于检测预设服务端口对客户端的服务请求的响应,解决了在负载均衡调度的服务器集群的场景下,由于与客户端实际建连的服务器未检测到与客户端协商的服务器的端口所造成的客户端服务请求失效的技术问题,在负载均衡调度的服务器集群的场景下可保证有效响应客户端服务请求。并且,该方法不依赖于负载均衡调度的服务器集群,还可以适用于各种服务器,扩展性和 可移植性强。
图2为本公开实施例所提供的另一种服务响应方法的流程示意图,可选的,根据目标客户端标识信息与预先建立的服务数据文件确定与服务请求报文对应的目标套接字,包括:如果基于预先建立的服务数据文件未查找到目标客户端标识信息或者未查找到与目标客户端标识信息对应的服务响应进程的套接字,则根据检测预设服务端口的至少一个套接字的预设套接字选项,确定与服务请求报文对应的目标套接字。如图2所示,所述方法包括:
S210、当通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文时,基于服务请求报文确定与请求客户端对应的目标客户端标识信息。
S220、如果基于预先建立的服务数据文件未查找到目标客户端标识信息或者未查找到与目标客户端标识信息对应的服务响应进程的套接字,则根据检测预设服务端口的至少一个套接字的预设套接字选项,确定与服务请求报文对应的目标套接字。
其中,预设套接字选项可以包括套接字的服务协议、进程类别、进程优先级以及负载等属性信息中的至少一种。在本实施例中,每一个套接字具备其对应的预设套接字选项,在确定服务请求报文对应的目标套接字的过程中,可以根据检测预设服务端口的至少一个套接字的预设套接字选项,选取出目标套接字。
示例性的,若在服务数据文件未查找到目标客户端标识信息,或者,未查找到与目标客户端标识信息对应的服务响应进程的套接字,则可以确定该请求客户端为首次建连的客户端。针对首次建连的客户端,示例性的,根据检测预设服务端口的至少一个套接字的预设套接字选项,确定与服务请求报文对应的目标套接字,可以是:根据检测预设服务端口的至少一个套接字的预设套接字选项中的负载信息和进程优先级,在检测预设服务端口的至少一个套接字中确 定目标套接字。
在一种可选的实施方式中,预设套接字选项包括进程标志位,进程标志位用于反映套接字与服务响应进程之间的对应关系;根据检测预设服务端口的至少一个套接字的预设套接字选项,确定与服务请求报文对应的目标套接字,包括:根据检测预设服务端口的所述至少一个套接字的进程标志位,确定与服务请求报文对应的目标套接字。
其中,进程标志位可以用于确定套接字对应的服务响应进程的进程类别。如,在服务器RTS(Real Time Streaming via WebRTC,网页即时通信实时流式传输)平滑升级场景下,服务响应进程可以包括用于连接服务版本更新前的服务资源的旧服务响应进程和用于连接服务版本更新后的服务资源的新服务响应进程。即,进程标志位可以用于区分套接字对应的服务响应进程为旧服务响应进程或为新服务响应进程。
典型地,本公开实施例的方案可以应用于平滑升级的场景。其中,平滑升级是指在不停止服务的同时实现服务器版本的热更新,更新过程中存量连接不断,且可对外正常服务,可以通过旧服务响应进程和新服务响应进程分别处理客户端的服务请求。
示例性的,可以在服务数据文件未查找到目标客户端标识信息,或者,未查找到与目标客户端标识信息对应的服务响应进程的套接字时,根据检测预设服务端口的至少一个套接字的进程标志位,在所述至少一个套接字中确定新服务响应进程对应的套接字,将新服务响应进程对应的套接字作为目标套接字,以通过该目标套接字将服务请求报文发送至新服务响应进程进行处理。在该可选的实施方式中,根据套接字的进程标志位确定出响应服务请求报文的进程,实现了响应服务请求报文的进程的准确确定,确保了对客户端的服务请求的响应。
其中,可选的,根据检测预设服务端口的至少一个套接字的进程标志位,确定与服务请求报文对应的目标套接字,可以是:根据检测预设服务端口的至 少一个套接字的进程标志位,确定出与新服务响应进程对应的套接字作为备选套接字;根据备选套接字确定与服务请求报文对应的目标套接字。
例如,进程标志位为1时表示该进程标志位的套接字对应的服务响应进程为旧服务响应进程,进程标志位为0时表示该进程标志位的套接字对应的服务响应进程为新服务响应进程。
示例性的,可以根据进程标志位的取值,在检测预设服务端口的所有套接字中确定出新服务响应进程对应的套接字,作为备选套接字。根据备选套接字的负载、优先级、或服务协议,在备选套接字中确定出目标套接字。通过该方式,实现了响应客户端的服务请求报文的旧服务响应进程或新服务响应进程的确定,在服务器的RTS平滑升级场景下,可以使得客户端在首次请求服务器时由连接服务版本更新后的服务资源的进程进行处理,在非首次请求服务器时由连接服务版本更新前的服务资源的进程进行处理,确保了在服务器RTS平滑升级下对客户端的服务请求的有效响应。
S230、通过目标套接字将服务请求报文发送至目标服务响应进程。
可选的,在通过目标套接字将服务请求报文发送至目标服务响应进程之后,还包括:将与请求客户端对应的目标客户端标识信息和目标套接字对应存储于服务数据文件中。
即,在对请求客户端的服务请求报文进行处理之后,该请求客户端可以视为已连接服务响应进程的已连接客户端。因此,可以将该请求客户端对应的目标客户端标识信息以及目标套接字关联存储至服务数据文件,以使在后续获取到该请求客户端的服务请求报文时,可以根据服务数据文件中存储的与该请求客户端对应的目标客户端标识信息确定出目标套接字。
在上述方法中,对如果在服务数据文件中未查找到目标客户端标识信息或未查找到与目标客户端标识信息对应的服务响应进程的套接字的情形进行描述。可选的,还包括:如果基于预先建立的服务数据文件查找到与目标客户端标识信息对应的服务响应进程的套接字,则将查找到的与目标客户端标识信息对应 的服务响应进程的套接字作为与服务请求报文对应的目标套接字。
即,如果在服务数据文件中查找到与目标客户端标识信息对应的服务响应进程的套接字,则确定请求客户端不是首次连接的客户端,基于此,可以将查找到的与目标客户端标识信息对应的服务响应进程的套接字作为目标套接字,以继续通过目标套接字对应的服务响应进程对该请求客户端的服务请求报文进行处理。通过该方式,可以实现针对已响应过服务请求的客户端,通过历史响应该客户端的服务请求的进程继续对其进行服务响应。
本公开实施例的技术方案,在预先建立的服务文件数据中未查找到目标客户端标识信息或与目标客户端标识信息对应的服务响应进程的套接字时,基于检测预设服务端口的至少一个套接字的预设套接字选项,确定与该服务请求报文对应的目标套接字,以实现对首次响应客户端的服务请求的进程的准确确定,确保客户端的服务请求可以被有效响应。
图3A为本公开实施例所提供的另一种服务响应方法的流程示意图,可选的,还包括:当接收到用于更新服务资源的服务版本的更新指令时,以当前连接服务资源的服务响应进程作为父进程,创建用于连接更新后的服务资源的子进程,将父进程作为旧服务响应进程,将子进程作为新服务响应进程。如图3A所示,所述方法包括:
S310、当接收到用于更新服务资源的服务版本的更新指令时,以当前连接服务资源的服务响应进程作为父进程,创建用于连接更新后的服务资源的子进程,将父进程作为旧服务响应进程,将子进程作为新服务响应进程。
其中,更新指令可以是云端或管理服务器发送的,例如云端或管理服务器在检测到存在新版本时,生成更新指令发送至服务器。或者,更新指令也可以在用户触发版本更新控件时自动生成。
示例性的,若服务器接收到更新指令,则表明服务器需要更新服务版本,以更新面向客户端的服务资源;此时,可以将当前连接服务资源的服务响应进 程作为父进程,即旧服务响应进程,并创建用于连接更新后的服务资源的子进程,即新服务响应进程。其中,子进程可以继承父进程的数据段、用户堆栈、地址空间、共享内存等信息。
在本实施例中,若服务器创建新服务响应进程,为了实现对新服务响应进程和旧服务响应进程的区分,可以在创建新服务响应进程的同时,为各个服务响应进程对应的套接字添加预设套接字选项。
即,可选的,还包括:为与旧服务响应进程对应的用于检测预设服务端口的至少一个套接字添加预设套接字选项,以区分旧服务响应进程和新服务响应进程与所述至少一个套接字之间的对应关系和/或所述至少一个套接字与服务请求报文的报文类型之间的对应关系。
示例性的,可以是在创建新服务响应进程时,为旧服务响应进程对应的套接字、以及新服务响应进程对应的套接字添加预设套接字选项。若预设套接字选项包括进程标志位,则可以区分各套接字对应的服务响应进程为旧服务响应进程或新服务响应进程。若预设套接字选项包括协议标志位,则可以区分各套接字对应的服务协议,即区分套接字所可以处理的服务请求报文的报文类型。
通过为旧服务响应进程对应的用于检测预设服务端口的至少一个套接字添加预设套接字选项,可以实现对旧服务响应进程和新服务响应进程与至少一个套接字之间的对应关系的区分,并且,还可以实现对套接字与服务请求报文的报文类型之间的对应关系的区分,以便于在获取到服务请求报文时,根据预设套接字选项确定出对应的目标套接字。
可选的,可以通过在服务器中部署应用层NSS(Next generation Streaming Server,下一代流媒体服务器)架构,通过应用层NSS架构对检测预设服务端口的至少一个套接字设置对应的预设套接字选项。示例性的,如图3B所示,展示了一种应用层NSS架构的工作示意图。其中,首先,应用层NSS架构启动,服务器进行NSS平滑升级;NSS架构进行初始化,遍历正在检测的地址,确定出检测预设服务端口的至少一个套接字,对父进程对应的套接字的预设套接字 选项中的进程标志位赋予预设标记,或者,根据所述至少一个套接字的服务协议对所述至少一个套接字的预设套接字选项中的协议标志位赋值,以设置所述至少一个套接字的预设套接字选项。
S320、当通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文时,基于服务请求报文确定与请求客户端对应的目标客户端标识信息。
S330、如果基于预先建立的服务数据文件未查找到目标客户端标识信息或者未查找到与目标客户端标识信息对应的服务响应进程的套接字,则根据检测预设服务端口的至少一个套接字的进程标志位,确定出与新服务响应进程对应的套接字作为备选套接字,根据备选套接字确定与服务请求报文对应的目标套接字。
在本实施例中,可以将任意一个备选套接字作为目标套接字。或者,还可以根据预设的轮询机制在各备选套接字中确定与服务请求报文对应的目标套接字。示例性的,预设的轮询机制可以是按照预设的与各新服务响应进程对应的套接字的排列列表中的顺序,依次确定出与当前的服务请求报文对应的目标套接字。
S340、通过目标套接字将服务请求报文发送至目标服务响应进程。
示例性的,可以通过上述方式,在服务器平滑升级的场景下,确定出处理当前请求客户端发送的服务请求报文的进程。平滑升级是指在不停止服务的同时实现服务器版本的热更新,更新过程中存量连接不断,且可对外正常服务。平滑升级一般是服务器在父进程中拉起子进程,并在一段时间后关闭父进程的方法,该子进程代表了新版本。RTS协议的平滑升级当前采用双端口模式,即子进程与父进程分别检测不同的端口。RTS握手时客户端会先与服务器进行端口协商,若服务器在平滑升级期间则协商结果为子进程端口,从而客户端和子进程端口建立连接。然而在服务器集群的负载均衡调度下,客户端协商时的服务器与实际建连的服务器可能不同,且各服务器检测的端口也可能不同,进而 可能使得客户端建连失败,造成客户端的RTS协议的服务请求失效。因此,为了解决该问题,可以采用本公开各实施例提供的服务响应方法,对预设服务端口进行检测,获取客户端发出的RTS协议的服务请求报文,各服务器通过检测预设服务端口获取到客户端的服务请求报文后确定目标客户端标识信息,若服务数据文件中不存在与目标客户端标识信息对应的套接字,则可以通过至少一个套接字的进程标识位,确定出与新服务响应进程对应的套接字,以将服务请求报文交由新服务响应进程处理,实现了处理服务请求报文的进程的确定,进而实现了对客户端的服务请求的响应,解决了在服务器集群下各服务器检测不同的端口所造成的客户端的RTS协议平滑升级服务请求失效的问题。
本公开实施例的技术方案,在接收到用于更新服务资源的服务版本的更新指令时,以当前连接所述服务资源的服务响应进程作为父进程,即旧服务响应进程,并且,创建用于连接更新后的服务资源的子进程,即新服务响应进程,实现了新服务响应进程和旧服务响应进程的确定,在服务器RTS平滑升级场景下,可以实现通过新服务响应进程和旧服务响应进程,分别对首次请求服务的客户端以及非首次请求服务的客户端进行响应。
图4A为本公开实施例所提供的另一种服务响应方法的流程示意图,可选的,还包括:预设套接字选项还包括协议标志位,协议标志位用于反映套接字与服务请求报文的报文类型之间的对应关系;根据检测预设服务端口的至少一个套接字的预设套接字选项,确定与服务请求报文对应的目标套接字,包括:根据检测预设服务端口的所述至少一个套接字的协议标志位,确定与服务请求报文对应的报文类型对应的套接字作为候选套接字;根据候选套接字确定与服务请求报文对应的目标套接字。如图4A所示,所述方法包括:
S410、当通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文时,基于服务请求报文确定与请求客户端对应的目标客户端标识信息。
S420、如果基于预先建立的服务数据文件未查找到目标客户端标识信息或者未查找到与目标客户端标识信息对应的服务响应进程的套接字,则根据检测预设服务端口的至少一个套接字的协议标志位,确定与服务请求报文对应的报文类型对应的套接字作为候选套接字,根据候选套接字确定与服务请求报文对应的目标套接字。
其中,协议标志位可以是用于描述套接字的服务协议的标志位。示例性的,若套接字的服务协议为RTS协议,则协议标志位可以为1,若套接字的服务协议为HTTP/3协议,则协议标志位可以为2,等。
示例性的,本实施例可以在根据服务数据文件未查找到目标客户端标识信息或与目标客户端标识信息对应的服务响应进程的套接字时,根据检测预设服务端口的至少一个套接字的协议标志位,在所述至少一个套接字中确定出与服务请求报文的报文类型相对应的套接字,即确定出服务协议与报文类型一致的套接字,将其作为候选套接字。
示例性的,可以将候选套接字的任意一个套接字作为目标套接字。或者,根据候选套接字的负载信息,在候选套接字中确定目标套接字。
可选的,根据候选套接字确定与服务请求报文对应的目标套接字,还可以是:根据候选套接字的进程标志位,确定与服务请求报文对应的目标套接字。如,可以根据候选套接字的进程标志位,确定与新服务响应进程对应的候选套接字作为目标套接字。可以理解的是,若存在多个与新服务响应进程对应的候选套接字,可以将其中任意一个候选套接字作为目标套接字,还可以将其中负载最小的候选套接字作为目标套接字。
通过该方式,可以在基于预先建立的服务数据文件未查找到目标客户端标识信息或者未查找到与目标客户端标识信息对应的服务响应进程的套接字时,即请求客户端为首次请求服务的客户端时,根据检测预设服务端口的至少一个套接字的进程标志位和协议标志位,在所述至少一个套接字中确定出满足服务请求报文的报文类型的新服务响应进程对应的套接字,实现了基于进程标志位 和协议标志位的套接字的准确确定。
示例性的,如图4B所示,展示了一种服务响应方法的过程示意图。以服务请求报文为RTS报文为例,首先,可以从RTS报文的IP头部和UDP(User Datagram Protocol,用户数据报协议)头部提取出五元组信息,进而根据五元组信息计算出32位的ID(即目标客户端标识信息),根据目标客户端标识信息,在MAP(即服务数据文件)中进行查询,ID是否在MAP中。在ID在MAP中的情况下,将服务请求报文发送至该ID对应的socket(即目标套接字),在ID不在MAP中的情况下,则遍历所有绑定到预设服务端口的套接字的预设套接字选项,找到进程标志位代表新服务响应进程,且协议标志位代表RTS协议的套接字,将服务请求报文发送至该套接字,并将该ID与socket关联存储至MAP中。
S430、通过目标套接字将服务请求报文发送至目标服务响应进程。
本公开实施例的技术方案,在基于预先建立的服务数据文件未查找到目标客户端标识信息或者未查找到与目标客户端标识信息对应的服务响应进程的套接字时,根据检测预设服务端口的至少一个套接字的协议标志位,确定与服务请求报文对应的报文类型对应的套接字作为候选套接字,根据候选套接字确定与服务请求报文对应的目标套接字,实现了基于进程标志位对首次响应客户端的服务请求的进程的准确确定,确保客户端的服务请求可以被有效响应。
图5为本公开实施例所提供的一种服务响应装置的结构示意图,如图5所示,所述装置包括:客户端请求模块510、套接字确定模块520以及请求响应模块530。
客户端请求模块510,设置为当通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文时,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;
套接字确定模块520,设置为根据所述目标客户端标识信息与预先建立的服 务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件用于存储已连接服务响应进程的已连接客户端的客户端标识信息与其连接的服务响应进程的套接字之间的对应关系;
请求响应模块530,设置为通过所述目标套接字将所述服务请求报文发送至目标服务响应进程。
可选的,本实施例也可以提供一种内核模块,该服务响应装置集成在内核模块中,内核模块可以通过服务响应装置将客户端发送的服务请求报文交由正确的服务响应进程处理。
本公开实施例所提供的技术方案,通过套接字检测机制检测请求客户端通过预设服务端口发起的服务请求报文,根据服务请求报文确定该请求客户端对应的目标客户端标识信息,进而根据该目标客户端标识信息,在预先建立的对应存储了已连接客户端的客户端标识信息和已连接客户端连接的服务响应进程的套接字的服务数据文件中,确定与该服务请求报文对应的目标套接字,根据目标套接字将该服务请求报文发送至目标服务响应进程,以通过检测预设服务端口获取到服务请求后,通过目标客户端标识信息选取对应的套接字,进而通过套接字选取处理该服务请求报文的进程,实现了响应服务请求的进程的准确确定,进而实现了基于检测预设服务端口对客户端的服务请求的响应,解决了在负载均衡调度的服务器集群的场景下,由于与客户端实际建连的服务器未检测到与客户端协商的服务器的端口所造成的客户端服务请求失效的技术问题,在负载均衡调度的服务器集群的场景下可保证有效响应客户端服务请求。并且,该方法不依赖于负载均衡调度的服务器集群,还可以适用于各种服务器,扩展性和可移植性强。
在本公开实施例中任一可选技术方案的基础上,可选的,所述服务请求报文携带有请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议;所述客户端请求模块510包括标识确定单元,所述标识确定单元,设置为根据所述请求 客户端的协议端口、所述请求客户端的网际互连协议地址、所述服务响应进程的协议端口、所述服务响应进程的网际互连协议地址和传输层协议生成与所述请求客户端对应的目标客户端标识信息。
在本公开实施例中任一可选技术方案的基础上,可选的,所述标识确定单元,设置为:根据预设哈希算法对所述请求客户端的协议端口、所述请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议进行计算,将计算出的哈希值作为与所述请求客户端对应的目标客户端标识信息。
在本公开实施例中任一可选技术方案的基础上,可选的,所述套接字确定模块520包括套接字第一确定单元,所述套接字第一确定单元,设置为如果基于预先建立的服务数据文件未查找到所述目标客户端标识信息或者未查找到与所述目标客户端标识信息对应的服务响应进程的套接字,则根据检测所述预设服务端口的至少一个套接字的预设套接字选项,确定与所述服务请求报文对应的目标套接字。
在本公开实施例中任一可选技术方案的基础上,可选的,所述预设套接字选项包括进程标志位,所述进程标志位用于反映套接字与服务响应进程之间的对应关系;所述套接字第一确定单元,还设置为根据检测所述预设服务端口的至少一个套接字的进程标志位,确定与所述服务请求报文对应的目标套接字。
在本公开实施例中任一可选技术方案的基础上,可选的,所述服务响应进程包括用于连接服务版本更新前的服务资源的旧服务响应进程和用于连接服务版本更新后的服务资源的新服务响应进程;所述套接字第一确定单元,还设置为根据检测所述预设服务端口的所述至少一个套接字的进程标志位,确定出与所述新服务响应进程对应的套接字作为备选套接字;根据所述备选套接字确定与所述服务请求报文对应的目标套接字。
在本公开实施例中任一可选技术方案的基础上,可选的,所述装置还包括进程创建模块,所述进程创建模块,设置为当接收到用于更新服务资源的服务 版本的更新指令时,以当前连接所述服务资源的服务响应进程作为父进程,创建用于连接更新后的服务资源的子进程,将所述父进程作为旧服务响应进程,将所述子进程作为新服务响应进程。
在本公开实施例中任一可选技术方案的基础上,可选的,所述进程创建模块,还设置为为与所述旧服务响应进程对应的用于检测所述预设服务端口的至少一个套接字添加预设套接字选项,以区分旧服务响应进程和新服务响应进程与所述至少一个套接字之间的对应关系和/或所述至少一个套接字与所述服务请求报文的报文类型之间的对应关系。
在本公开实施例中任一可选技术方案的基础上,可选的,所述预设套接字选项还包括协议标志位,所述协议标志位用于反映套接字与所述服务请求报文的报文类型之间的对应关系;所述套接字确定模块520包括套接字第二确定单元,所述第二确定单元,设置为根据检测所述预设服务端口的至少一个套接字的协议标志位,确定与所述服务请求报文对应的报文类型对应的套接字作为候选套接字;根据所述候选套接字确定与所述服务请求报文对应的目标套接字。
在本公开实施例中任一可选技术方案的基础上,可选的,所述套接字确定模块,还设置为将与所述请求客户端对应的目标客户端标识信息和所述目标套接字对应存储于所述服务数据文件中。
在本公开实施例中任一可选技术方案的基础上,可选的,所述套接字确定模块,还设置为如果基于预先建立的服务数据文件查找到与所述目标客户端标识信息对应的服务响应进程的套接字,则将查找到的与所述目标客户端标识信息对应的服务响应进程的套接字作为与所述服务请求报文对应的目标套接字。
本公开实施例所提供的服务响应装置可执行本公开任意实施例所提供的服务响应方法,具备执行方法相应的功能模块。
值得注意的是,上述装置所包括的各个单元和模块只是按照功能逻辑进行划分的,但并不局限于上述的划分,只要能够实现相应的功能即可;另外,各功能单元的具体名称也只是为了便于相互区分,并不用于限制本公开实施例的 保护范围。
图6为本公开实施例所提供的一种电子设备的结构示意图。下面参考图6,其示出了适于用来实现本公开实施例的电子设备(例如图6中的终端设备或服务器)600的结构示意图。本公开实施例中的终端设备可以包括但不限于诸如移动电话、笔记本电脑、数字广播接收器、个人数字助理(Personal Digital Assistant,PDA)、PAD(平板电脑)、便携式多媒体播放器(Portable Media Player,PMP)、车载终端(例如车载导航终端)等等的移动终端以及诸如数字电视(Television,TV)、台式计算机等等的固定终端。图6示出的电子设备仅仅是一个示例,不应对本公开实施例的功能和使用范围带来任何限制。
如图6所示,电子设备600可以包括处理装置(例如中央处理器、图形处理器等)601,其可以根据存储在只读存储器(Read-Only Memory,ROM)602中的程序或者从存储装置608加载到随机访问存储器(Random Access Memory,RAM)603中的程序而执行各种适当的动作和处理。在RAM 603中,还存储有电子设备600操作所需的各种程序和数据。处理装置601、ROM 602以及RAM 603通过总线604彼此相连。输入/输出(Input/Output,I/O)接口605也连接至总线604。
通常,以下装置可以连接至I/O接口605:包括例如触摸屏、触摸板、键盘、鼠标、摄像头、麦克风、加速度计、陀螺仪等的输入装置606;包括例如液晶显示器(Liquid Crystal Display,LCD)、扬声器、振动器等的输出装置607;包括例如磁带、硬盘等的存储装置608;以及通信装置609。通信装置609可以允许电子设备600与其他设备进行无线或有线通信以交换数据。虽然图6示出了具有各种装置的电子设备600,但是应理解的是,并不要求实施或具备所有示出的装置。可以替代地实施或具备更多或更少的装置。
特别地,根据本公开的实施例,上文参考流程图描述的过程可以被实现为计算机软件程序。例如,本公开的实施例包括一种计算机程序产品,其包括承 载在非暂态计算机可读介质上的计算机程序,该计算机程序包含用于执行流程图所示的方法的程序代码。在这样的实施例中,该计算机程序可以通过通信装置609从网络上被下载和安装,或者从存储装置608被安装,或者从ROM602被安装。在该计算机程序被处理装置601执行时,执行本公开实施例的方法中限定的上述功能。
本公开实施方式中的多个装置之间所交互的消息或者信息的名称仅用于说明性的目的,而并不是用于对这些消息或信息的范围进行限制。
本公开实施例提供的电子设备与上述实施例提供的服务响应方法属于同一发明构思,未在本实施例中详尽描述的技术细节可参见上述实施例。
本公开实施例提供了一种计算机存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述实施例所提供的服务响应方法。
需要说明的是,本公开上述的计算机可读介质可以是计算机可读信号介质或者计算机可读存储介质或者是上述两者的任意组合。计算机可读存储介质例如可以是——但不限于——电、磁、光、电磁、红外线、或半导体的系统、装置或器件,或者任意以上的组合。计算机可读存储介质的更具体的例子可以包括但不限于:具有一个或多个导线的电连接、便携式计算机磁盘、硬盘、随机访问存储器(RAM)、只读存储器(ROM)、可擦式可编程只读存储器(EPROM(Erasable Programmable Read-Only Memory)或闪存)、光纤、便携式紧凑磁盘只读存储器(Compact Disc Read-Only Memory,CD-ROM)、光存储器件、磁存储器件、或者上述的任意合适的组合。在本公开中,计算机可读存储介质可以是任何包含或存储程序的有形介质,该程序可以被指令执行系统、装置或者器件使用或者与其结合使用。而在本公开中,计算机可读信号介质可以包括在基带中或者作为载波一部分传播的数据信号,其中承载了计算机可读的程序代码。这种传播的数据信号可以采用多种形式,包括但不限于电磁信号、光信号或上述的任意合适的组合。计算机可读信号介质还可以是计算机可读存储介质以外的任何计算机可读介质,该计算机可读信号介质可以发送、传播或者传输 用于由指令执行系统、装置或者器件使用或者与其结合使用的程序。计算机可读介质上包含的程序代码可以用任何适当的介质传输,包括但不限于:电线、光缆、射频(Radio Frequency,RF)等等,或者上述的任意合适的组合。
在一些实施方式中,客户端、服务器可以利用诸如HTTP(HyperText Transfer Protocol,超文本传输协议)之类的任何当前已知或未来研发的网络协议进行通信,并且可以与任意形式或介质的数字数据通信(例如,通信网络)互连。通信网络的示例包括局域网(Local Area Network,LAN),广域网(Wide Area Network,WAN),网际网(例如,互联网)以及端对端网络(例如,ad hoc端对端网络),以及任何当前已知或未来研发的网络。
上述计算机可读介质可以是上述电子设备中所包含的;也可以是单独存在,而未装配入该电子设备中。
上述计算机可读介质承载有至少一个程序,当上述至少一个程序被该电子设备执行时,使得该电子设备:
上述计算机可读介质承载有至少一个程序,当上述至少一个程序被该电子设备执行时,使得该电子设备:当通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文时,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件中已连接服务响应进程的已连接客户端的客户端标识信息与所述已连接客户端连接的服务响应进程的套接字对应存储;通过所述目标套接字将所述服务请求报文发送至目标服务响应进程。
可以以一种或多种程序设计语言或其组合来编写用于执行本公开的操作的计算机程序代码,上述程序设计语言包括但不限于面向对象的程序设计语言—诸如Java、Smalltalk、C++,还包括常规的过程式程序设计语言—诸如“C”语言或类似的程序设计语言。程序代码可以完全地在用户计算机上执行、部分地在用户计算机上执行、作为一个独立的软件包执行、部分在用户计算机上部分在 远程计算机上执行、或者完全在远程计算机或服务器上执行。在涉及远程计算机的情形中,远程计算机可以通过任意种类的网络——包括局域网(LAN)或广域网(WAN)—连接到用户计算机,或者,可以连接到外部计算机(例如利用因特网服务提供商来通过因特网连接)。
附图中的流程图和框图,图示了按照本公开各种实施例的系统、方法和计算机程序产品的可能实现的体系架构、功能和操作。在这点上,流程图或框图中的每个方框可以代表一个模块、程序段、或代码的一部分,该模块、程序段、或代码的一部分包含一个或多个用于实现规定的逻辑功能的可执行指令。也应当注意,在有些作为替换的实现中,方框中所标注的功能也可以以不同于附图中所标注的顺序发生。例如,两个接连地表示的方框实际上可以基本并行地执行,它们有时也可以按相反的顺序执行,这依所涉及的功能而定。也要注意的是,框图和/或流程图中的每个方框、以及框图和/或流程图中的方框的组合,可以用执行规定的功能或操作的专用的基于硬件的系统来实现,或者可以用专用硬件与计算机指令的组合来实现。
描述于本公开实施例中所涉及到的单元可以通过软件的方式实现,也可以通过硬件的方式来实现。其中,单元的名称在某种情况下并不构成对该单元本身的限定,例如,第一获取单元还可以被描述为“获取至少两个网际协议地址的单元”。
本文中以上描述的功能可以至少部分地由一个或多个硬件逻辑部件来执行。例如,非限制性地,可以使用的示范类型的硬件逻辑部件包括:现场可编程门阵列(Field Programmable Gate Array,FPGA)、专用集成电路(Application Specific Integrated Circuit,ASIC)、专用标准产品(Application Specific Standard Parts,ASSP)、片上系统(System on Chip,SOC)、复杂可编程逻辑设备(Complex Programmable Logic Device,CPLD)等等。
在本公开的上下文中,机器可读介质可以是有形的介质,其可以包含或存储以供指令执行系统、装置或设备使用或与指令执行系统、装置或设备结合地 使用的程序。机器可读介质可以是机器可读信号介质或机器可读储存介质。机器可读介质可以包括但不限于电子的、磁性的、光学的、电磁的、红外的、或半导体系统、装置或设备,或者上述内容的任何合适组合。机器可读存储介质的更具体示例会包括基于一个或多个线的电气连接、便携式计算机盘、硬盘、随机存取存储器(RAM)、只读存储器(ROM)、可擦除可编程只读存储器(EPROM或快闪存储器)、光纤、便捷式紧凑盘只读存储器(CD-ROM)、光学储存设备、磁储存设备、或上述内容的任何合适组合。
根据本公开的至少一个实施例,【示例一】提供了一种服务响应方法,包括:
当通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文时,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;
根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件中已连接服务响应进程的已连接客户端的客户端标识信息与所述已连接客户端连接的服务响应进程的套接字对应存储;
通过所述目标套接字将所述服务请求报文发送至目标服务响应进程。
根据本公开的至少一个实施例,【示例二】提供了一种服务响应方法,该方法,还包括:
可选的,所述服务请求报文携带有请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议;
所述基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息,包括:
根据所述请求客户端的协议端口、所述请求客户端的网际互连协议地址、所述服务响应进程的协议端口、所述服务响应进程的网际互连协议地址和传输层协议生成与所述请求客户端对应的目标客户端标识信息。
根据本公开的至少一个实施例,【示例三】提供了一种服务响应方法,该方法,还包括:
可选的,所述根据所述请求客户端的协议端口、所述请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议生成与所述请求客户端对应的目标客户端标识信息,包括:
根据预设哈希算法对所述请求客户端的协议端口、所述请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议进行计算,将计算出的哈希值作为与所述请求客户端对应的目标客户端标识信息。
根据本公开的至少一个实施例,【示例四】提供了一种服务响应方法,该方法,还包括:
可选的,所述根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,包括:
如果基于预先建立的服务数据文件未查找到所述目标客户端标识信息或者未查找到与所述目标客户端标识信息对应的服务响应进程的套接字,则根据检测所述预设服务端口的至少一个套接字的预设套接字选项,确定与所述服务请求报文对应的目标套接字。
根据本公开的至少一个实施例,【示例五】提供了一种服务响应方法,该方法,还包括:
可选的,所述预设套接字选项包括进程标志位,所述进程标志位用于反映套接字与服务响应进程之间的对应关系;
所述根据检测所述预设服务端口的至少一个套接字的预设套接字选项,确定与所述服务请求报文对应的目标套接字,包括:
根据检测所述预设服务端口的所述至少一个套接字的进程标志位,确定与所述服务请求报文对应的目标套接字。
根据本公开的至少一个实施例,【示例六】提供了一种服务响应方法,该方 法,还包括:
可选的,所述服务响应进程包括用于连接服务版本更新前的服务资源的旧服务响应进程和用于连接服务版本更新后的服务资源的新服务响应进程;
所述根据检测所述预设服务端口的所述至少一个套接字的进程标志位,确定与所述服务请求报文对应的目标套接字,包括:
根据检测所述预设服务端口的所述至少一个套接字的进程标志位,确定出与所述新服务响应进程对应的套接字作为备选套接字;
根据所述备选套接字确定与所述服务请求报文对应的目标套接字。
根据本公开的至少一个实施例,【示例七】提供了一种服务响应方法,该方法,还包括:
可选的,还包括:
当接收到用于更新服务资源的服务版本的更新指令时,以当前连接所述服务资源的服务响应进程作为父进程,创建用于连接更新后的服务资源的子进程,将所述父进程作为旧服务响应进程,将所述子进程作为新服务响应进程。
根据本公开的至少一个实施例,【示例八】提供了一种服务响应方法,该方法,还包括:
可选的,还包括:
为与所述旧服务响应进程对应的用于检测所述预设服务端口的至少一个套接字添加预设套接字选项,以区分旧服务响应进程和新服务响应进程与所述至少一个套接字之间的对应关系和/或所述至少一个套接字与所述服务请求报文的报文类型之间的对应关系。
根据本公开的至少一个实施例,【示例九】提供了一种服务响应方法,该方法,还包括:
可选的,所述预设套接字选项还包括协议标志位,所述协议标志位用于反映套接字与所述服务请求报文的报文类型之间的对应关系;
所述根据检测所述预设服务端口的至少一个套接字的预设套接字选项,确 定与所述服务请求报文对应的目标套接字,包括:
根据检测所述预设服务端口的所述至少一个套接字的协议标志位,确定与所述服务请求报文对应的报文类型对应的套接字作为候选套接字;
根据所述候选套接字确定与所述服务请求报文对应的目标套接字。
根据本公开的至少一个实施例,【示例十】提供了一种服务响应方法,该方法,还包括:
可选的,在所述通过所述目标套接字将所述服务请求报文发送至目标服务响应进程之后,还包括:
将与所述请求客户端对应的目标客户端标识信息和所述目标套接字对应存储于所述服务数据文件中。
根据本公开的至少一个实施例,【示例十一】提供了一种服务响应方法,该方法,还包括:
可选的,还包括:
如果基于预先建立的服务数据文件查找到与所述目标客户端标识信息对应的服务响应进程的套接字,则将查找到的与所述目标客户端标识信息对应的服务响应进程的套接字作为与所述服务请求报文对应的目标套接字。
根据本公开的至少一个实施例,【示例十二】提供了一种服务响应装置,该装置,包括:
客户端请求模块,设置为当通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文时,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;
套接字确定模块,设置为根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件用于存储已连接服务响应进程的已连接客户端的客户端标识信息与其连接的服务响应进程的套接字之间的对应关系;
请求响应模块,设置为通过所述目标套接字将所述服务请求报文发送至目 标服务响应进程。
此外,虽然采用特定次序描绘了各操作,但是这不应当理解为要求这些操作以所示出的特定次序或以顺序次序执行来执行。在一定环境下,多任务和并行处理可能是有利的。同样地,虽然在上面论述中包含了若干具体实现细节,但是这些不应当被解释为对本公开的范围的限制。在单独的实施例的上下文中描述的某些特征还可以组合地实现在单个实施例中。相反地,在单个实施例的上下文中描述的各种特征也可以单独地或以任何合适的子组合的方式实现在多个实施例中。

Claims (14)

  1. 一种服务响应方法,包括:
    响应于通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;
    根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件中已连接服务响应进程的已连接客户端的客户端标识信息与所述已连接客户端连接的服务响应进程的套接字对应存储;
    通过所述目标套接字将所述服务请求报文发送至目标服务响应进程。
  2. 根据权利要求1所述的服务响应方法,其中,所述服务请求报文携带有请求客户端的协议端口、请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议;
    所述基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息,包括:
    根据所述请求客户端的协议端口、所述请求客户端的网际互连协议地址、所述服务响应进程的协议端口、所述服务响应进程的网际互连协议地址和传输层协议,生成与所述请求客户端对应的目标客户端标识信息。
  3. 根据权利要求2所述的服务响应方法,其中,所述根据所述请求客户端的协议端口、所述请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议,生成与所述请求客户端对应的目标客户端标识信息,包括:
    根据预设哈希算法对所述请求客户端的协议端口、所述请求客户端的网际互连协议地址、服务响应进程的协议端口、服务响应进程的网际互连协议地址和传输层协议进行计算,将计算出的哈希值作为与所述请求客户端对应的目标客户端标识信息。
  4. 根据权利要求1所述的服务响应方法,其中,所述根据所述目标客户端 标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,包括:
    响应于基于预先建立的服务数据文件未查找到所述目标客户端标识信息或者未查找到与所述目标客户端标识信息对应的服务响应进程的套接字,根据检测所述预设服务端口的至少一个套接字的预设套接字选项,确定与所述服务请求报文对应的目标套接字。
  5. 根据权利要求4所述的服务响应方法,其中,所述预设套接字选项包括进程标志位,所述进程标志位用于反映套接字与服务响应进程之间的对应关系;
    所述根据检测所述预设服务端口的至少一个套接字的预设套接字选项,确定与所述服务请求报文对应的目标套接字,包括:
    根据检测所述预设服务端口的所述至少一个套接字的进程标志位,确定与所述服务请求报文对应的目标套接字。
  6. 根据权利要求5所述的服务响应方法,其中,所述服务响应进程包括用于连接服务版本更新前的服务资源的旧服务响应进程和用于连接服务版本更新后的服务资源的新服务响应进程;
    所述根据检测所述预设服务端口的所述至少一个套接字的进程标志位,确定与所述服务请求报文对应的目标套接字,包括:
    根据检测所述预设服务端口的所述至少一个套接字的进程标志位,确定出与所述新服务响应进程对应的套接字作为备选套接字;
    根据所述备选套接字确定与所述服务请求报文对应的目标套接字。
  7. 根据权利要求6所述的服务响应方法,还包括:
    响应于接收到用于更新服务资源的服务版本的更新指令,以当前连接所述服务资源的服务响应进程作为父进程,创建用于连接更新后的服务资源的子进程,将所述父进程作为旧服务响应进程,将所述子进程作为新服务响应进程。
  8. 根据权利要求7所述的服务响应方法,还包括:
    为与所述旧服务响应进程对应的用于检测所述预设服务端口的至少一个套 接字添加预设套接字选项,以区分以下至少之一:旧服务响应进程和新服务响应进程与所述至少一个套接字之间的对应关系;所述至少一个套接字与所述服务请求报文的报文类型之间的对应关系。
  9. 根据权利要求4所述的服务响应方法,其中,所述预设套接字选项还包括协议标志位,所述协议标志位用于反映套接字与所述服务请求报文的报文类型之间的对应关系;
    所述根据检测所述预设服务端口的至少一个套接字的预设套接字选项,确定与所述服务请求报文对应的目标套接字,包括:
    根据检测所述预设服务端口的所述至少一个套接字的协议标志位,确定与所述服务请求报文对应的报文类型对应的套接字作为候选套接字;
    根据所述候选套接字确定与所述服务请求报文对应的目标套接字。
  10. 根据权利要求4所述的服务响应方法,在所述通过所述目标套接字将所述服务请求报文发送至目标服务响应进程之后,还包括:
    将与所述请求客户端对应的目标客户端标识信息和所述目标套接字对应存储于所述服务数据文件中。
  11. 根据权利要求4所述的服务响应方法,还包括:
    响应于基于预先建立的服务数据文件查找到与所述目标客户端标识信息对应的服务响应进程的套接字,将查找到的与所述目标客户端标识信息对应的服务响应进程的套接字作为与所述服务请求报文对应的目标套接字。
  12. 一种服务响应装置,包括:
    客户端请求模块,设置为响应于通过套接字检测机制检测到请求客户端通过预设服务端口发起的服务请求报文,基于所述服务请求报文确定与所述请求客户端对应的目标客户端标识信息;
    套接字确定模块,设置为根据所述目标客户端标识信息与预先建立的服务数据文件确定与所述服务请求报文对应的目标套接字,其中,所述服务数据文件用于存储已连接服务响应进程的已连接客户端的客户端标识信息与其连接的 服务响应进程的套接字之间的对应关系;
    请求响应模块,设置为通过所述目标套接字将所述服务请求报文发送至目标服务响应进程。
  13. 一种电子设备,包括:
    至少一个处理器;
    存储装置,设置为存储至少一个程序,
    当所述至少一个程序被所述至少一个处理器执行,使得所述至少一个处理器实现如权利要求1-11中任一所述的服务响应方法。
  14. 一种包含计算机可执行指令的存储介质,所述计算机可执行指令在由计算机处理器执行时用于执行如权利要求1-11中任一所述的服务响应方法。
PCT/CN2023/093269 2022-05-11 2023-05-10 服务响应方法、装置、设备及存储介质 WO2023217187A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202210513481.0 2022-05-11
CN202210513481.0A CN114938395A (zh) 2022-05-11 2022-05-11 服务响应方法、装置、设备及存储介质

Publications (1)

Publication Number Publication Date
WO2023217187A1 true WO2023217187A1 (zh) 2023-11-16

Family

ID=82865289

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2023/093269 WO2023217187A1 (zh) 2022-05-11 2023-05-10 服务响应方法、装置、设备及存储介质

Country Status (2)

Country Link
CN (1) CN114938395A (zh)
WO (1) WO2023217187A1 (zh)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114938395A (zh) * 2022-05-11 2022-08-23 北京字节跳动网络技术有限公司 服务响应方法、装置、设备及存储介质
CN115767684B (zh) * 2022-11-09 2023-09-08 深圳金信诺高新技术股份有限公司 数据传输方法、装置、设备及介质

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105553977A (zh) * 2015-12-15 2016-05-04 网易(杭州)网络有限公司 请求消息的处理、发送方法及装置
US20200296141A1 (en) * 2019-03-14 2020-09-17 T-Mobile Usa, Inc. Secure and transparent transport of application level protocols to non-ip data delivery communication channels
CN113132356A (zh) * 2021-03-23 2021-07-16 网宿科技股份有限公司 Udp报文的分发方法、设备及存储介质
CN114079653A (zh) * 2021-11-17 2022-02-22 北京字节跳动网络技术有限公司 一种通信方法、装置、计算机设备和存储介质
CN114416149A (zh) * 2022-01-04 2022-04-29 北京金山云网络技术有限公司 一种服务的处理方法、装置及设备
CN114938395A (zh) * 2022-05-11 2022-08-23 北京字节跳动网络技术有限公司 服务响应方法、装置、设备及存储介质

Family Cites Families (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100344122C (zh) * 2003-04-22 2007-10-17 华为技术有限公司 一种实现从指定端口发送数据报类型报文的方法
KR101005093B1 (ko) * 2008-07-15 2011-01-04 인터리젠 주식회사 클라이언트 식별 방법 및 장치
SG2014008932A (en) * 2014-02-06 2015-09-29 Mastercard Asia Pacific Pte Ltd A method and a corresponding proxy server, system, computer-readable storage medium and computer program
US10637906B2 (en) * 2017-10-31 2020-04-28 Cisco Technology, Inc. Dynamic socket QoS settings for web service connections
US11329959B2 (en) * 2018-12-21 2022-05-10 Fortinet, Inc. Virtual routing and forwarding (VRF)-aware socket
CN110413420B (zh) * 2019-01-23 2024-01-30 腾讯科技(深圳)有限公司 数据传输方法、装置、终端及存储介质
CN110677392B (zh) * 2019-09-12 2022-03-15 视联动力信息技术股份有限公司 一种视频数据传输方法和装置
CN114448929B (zh) * 2022-04-08 2022-06-21 统信软件技术有限公司 数据链路转接方法、装置和系统,以及计算设备

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105553977A (zh) * 2015-12-15 2016-05-04 网易(杭州)网络有限公司 请求消息的处理、发送方法及装置
US20200296141A1 (en) * 2019-03-14 2020-09-17 T-Mobile Usa, Inc. Secure and transparent transport of application level protocols to non-ip data delivery communication channels
CN113132356A (zh) * 2021-03-23 2021-07-16 网宿科技股份有限公司 Udp报文的分发方法、设备及存储介质
CN114079653A (zh) * 2021-11-17 2022-02-22 北京字节跳动网络技术有限公司 一种通信方法、装置、计算机设备和存储介质
CN114416149A (zh) * 2022-01-04 2022-04-29 北京金山云网络技术有限公司 一种服务的处理方法、装置及设备
CN114938395A (zh) * 2022-05-11 2022-08-23 北京字节跳动网络技术有限公司 服务响应方法、装置、设备及存储介质

Also Published As

Publication number Publication date
CN114938395A (zh) 2022-08-23

Similar Documents

Publication Publication Date Title
WO2023217187A1 (zh) 服务响应方法、装置、设备及存储介质
CN110708393B (zh) 用于传输数据的方法、装置和系统
US7788522B1 (en) Autonomous cluster organization, collision detection, and resolutions
RU2366108C2 (ru) Метапространство: промежуточное коммуникационное программное обеспечение для частично соединенных одноранговых сетей мобильной связи с произвольной структурой
JP5863942B2 (ja) ウィットネスサービスの提供
KR20150013860A (ko) 클라이언트 없는 클라우드 컴퓨팅
CN112261094B (zh) 一种报文处理方法及代理服务器
CN113259479B (zh) 一种数据处理方法以及设备
WO2023279891A1 (zh) 投屏设备的发现方法、装置、电子设备和存储介质
CN111414208A (zh) 应用程序的启动方法、装置及设备
WO2023202276A1 (zh) 域名解析请求的处理方法、装置、设备、介质和程序产品
EP4221233A1 (en) Data download method and apparatus, computer device and storage medium
US9292358B2 (en) Remotely retrieving information from consumer devices
CN113765867B (zh) 一种数据传输方法、装置、设备及存储介质
WO2023246480A1 (zh) 一种身份认证方法、装置、设备、介质及产品
US10742776B1 (en) Accelerating isochronous endpoints of redirected USB devices
WO2023273576A1 (zh) 异常请求处理方法、装置、电子设备和存储介质
US10594511B2 (en) Address system
Khan et al. Software architecture and algorithm for reliable RPC for geo-distributed mobile computing systems
US8880670B1 (en) Group membership discovery service
CN112162868B (zh) 应用于集群处理的数据通信方法、装置及存储介质
US11895196B1 (en) Efficient update mechanism in IoT event driven architectures
WO2022001530A1 (zh) 建立管道的方法及装置
US20240106889A1 (en) Data resource storage method and apparatus, data resource query method and apparatus, and electronic device
US11677724B1 (en) Data access and firewall tunneling using a custom socket factory

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: 23802956

Country of ref document: EP

Kind code of ref document: A1