CN114979099A - Target service access method, module and system - Google Patents

Target service access method, module and system Download PDF

Info

Publication number
CN114979099A
CN114979099A CN202210395377.6A CN202210395377A CN114979099A CN 114979099 A CN114979099 A CN 114979099A CN 202210395377 A CN202210395377 A CN 202210395377A CN 114979099 A CN114979099 A CN 114979099A
Authority
CN
China
Prior art keywords
target
proxy server
service access
server
target service
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202210395377.6A
Other languages
Chinese (zh)
Other versions
CN114979099B (en
Inventor
马韶华
陈志强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tianjin Chezhijia Software Co ltd
Original Assignee
Tianjin Chezhijia Software Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tianjin Chezhijia Software Co ltd filed Critical Tianjin Chezhijia Software Co ltd
Priority to CN202210395377.6A priority Critical patent/CN114979099B/en
Publication of CN114979099A publication Critical patent/CN114979099A/en
Application granted granted Critical
Publication of CN114979099B publication Critical patent/CN114979099B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/02Protocols based on web technology, e.g. hypertext transfer protocol [HTTP]
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/10Active monitoring, e.g. heartbeat, ping or trace-route
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/14Session management
    • H04L67/141Setup of application sessions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Health & Medical Sciences (AREA)
  • Cardiology (AREA)
  • General Health & Medical Sciences (AREA)
  • Computer And Data Communications (AREA)

Abstract

The invention discloses a target service access method, a module and a system, wherein the method is suitable for being executed in a proxy server and comprises the following steps: receiving a target service access request sent by any one of a plurality of client devices; determining a target server corresponding to the target service access request as a server to be accessed, and taking a proxy server connected with the server to be accessed as a target proxy server; if the target proxy server is not the proxy server receiving the target service access request, sending the target service access request to the target proxy server to indicate the target proxy server to forward the target service access request to the server to be accessed and receive a target service access result returned by the server to be accessed; and receiving a target service access result sent by the target proxy server, and feeding back the target service access result to the client equipment sending the target service access request.

Description

Target service access method, module and system
Technical Field
The present invention relates to the field of computer and network technologies, and in particular, to a method, a module, a system, a computing device, and a storage medium for accessing a target service.
Background
Currently, when a client sends a message to a designated server point-to-point for a target service access, the message is usually forwarded by using an intermediate proxy server. For example, a target server registers with a proxy server and establishes a connection, and a client (e.g., a browser) installed on a client device (e.g., a personal computer) receives and transmits a message through a WebSocket service after being started. WebSocket is a communication Protocol that enables full duplex communication over a single TCP (Transmission Control Protocol) connection. When the client sends the message to the WebSocket service, the WebSocket service forwards the message to the target server through the proxy server.
Because the proxy service generally needs to be provided by a proxy server cluster, the client establishes a point-to-point connection with any proxy server in the proxy server cluster, and the target server also establishes a point-to-point connection with any proxy server in the proxy server cluster. If the proxy server that establishes a connection with the client and the proxy server that establishes a connection with the target server are not the same, then the message may not be forwarded.
A common solution is through a distributed coordination service such as ZooKeeper (a centralized service that maintains configuration information, names, provides distributed synchronization, and provides group services). The target server and the proxy server are both registered in the ZooKeeper, the client inquires the proxy server information which is registered in the ZooKeeper and connected with the target server before sending the message to the target server, and the client establishes connection with the target server to send the message. ZooKeeper is a centralized service to which all services need to establish connections.
In other words, when a client connects to a different target server, a new connection needs to be created with the proxy server connected to the target server, i.e., the client must create connections with multiple proxy servers, and the influence of excessive connection times on the system performance cannot be ignored.
Therefore, a new target service access method is needed to optimize the above process.
Disclosure of Invention
To this end, the present invention provides a targeted service access scheme in an attempt to solve, or at least alleviate, the problems presented above.
According to an aspect of the present invention, there is provided a target service access method adapted to be executed in a proxy server, the method comprising the steps of: firstly, receiving a target service access request sent by any one of a plurality of client devices; determining a target server corresponding to the target service access request as a server to be accessed, and taking a proxy server connected with the server to be accessed as a target proxy server; if the target proxy server is not the proxy server receiving the target service access request, the target service access request is sent to the target proxy server so as to indicate the target proxy server to forward the target service access request to the server to be accessed and receive a target service access result returned by the server to be accessed; and receiving a target service access result sent by the target proxy server, and feeding back the target service access result to the client equipment sending the target service access request.
Optionally, in the target service access method according to the present invention, the proxy server provides a WebSoc key service, and before the step of sending the target service access request to the target proxy server, the method further includes: if the proxy server receiving the target service access request is used for proxy access of the server to be accessed for the first time, a proxy client is established for the proxy server receiving the target service access request through the WebSocket service, and connection is established between the proxy client and a proxy server in the target proxy server; and storing the established connection relation in a local cache in a key value pair mode, and starting a proxy client in the proxy server which receives the target service access request.
Optionally, in the target service access method according to the present invention, the step of sending the target service access request to the target proxy server to instruct the target proxy server to forward the target service access request to the server to be accessed includes: and sending the target service access request to a proxy server in the target proxy server through the proxy client in the proxy server which receives the target service access request so as to indicate the proxy server in the target proxy server and forward the target service access request to the server to be accessed.
Optionally, in the target service access method according to the present invention, the method further includes: sending heartbeat information to the target proxy server according to a preset time interval to indicate the target proxy server to feed back reply information; and if the reply information is not received for the preset times, determining that the target proxy server cannot provide the proxy service, and providing an available proxy server for the server to be accessed again.
Optionally, in the target service access method according to the present invention, the step of sending heartbeat information to the target proxy server at a predetermined time interval to instruct the target proxy server to feed back the reply information includes: and sending heartbeat information to the proxy server side in the target proxy server through the proxy client side in the proxy server receiving the target service access request according to a preset time interval so as to indicate the proxy server side in the target proxy server to feed back the reply information.
Optionally, in the target service access method according to the present invention, before the step of receiving the target service access request sent by any one of the plurality of client devices, the method further includes: starting proxy service to create a proxy server and WebSocket service; and storing the starting information of the proxy server to a cache server, wherein the starting information comprises an IP address, a port and starting time.
Optionally, in the target service access method according to the present invention, before the step of receiving a target service access request sent by any one of a plurality of client devices, the method further includes: receiving an agent connection request sent by any one of a plurality of target servers; responding to the proxy connection request, establishing connection with a target server sending the proxy connection request, and storing the connection information in a cache server.
According to still another aspect of the present invention, there is provided a target service access module residing in a proxy server, the module including a receiving unit, a determining unit, a transmitting unit, and a feedback unit. The receiving unit is suitable for receiving a target service access request sent by any one of a plurality of client devices; the determining unit is suitable for determining a target server corresponding to the target service access request as a server to be accessed and taking a proxy server connected with the server to be accessed as a target proxy server; the sending unit is suitable for sending the target service access request to the target proxy server when the target proxy server is not the proxy server receiving the target service access request so as to instruct the target proxy server to forward the target service access request to the server to be accessed and receive a target service access result returned by the server to be accessed; the feedback unit is suitable for receiving the target service access result sent by the target proxy server and feeding back the target service access result to the client equipment sending the target service access request.
According to still another aspect of the present invention, there is provided a target service access system including: the system comprises a plurality of client devices, a plurality of proxy servers and a plurality of target servers, wherein each proxy server comprises the target service access module.
According to yet another aspect of the present invention, there is provided a computing device comprising: at least one processor; and a memory storing program instructions, wherein the program instructions are configured to be executed by the at least one processor, the program instructions comprising instructions for performing the target service access method as described above.
According to still another aspect of the present invention, there is provided a readable storage medium storing program instructions which, when read and executed by a computing device, cause the computing device to perform the target service access method as described above.
According to the target service access scheme, after a target service access request sent by client equipment is received, a target server corresponding to the target service access request is determined to serve as a server to be accessed, a proxy server connected with the server to be accessed serves as a target proxy server, the target service access request is sent to the target proxy server to indicate the target proxy server to forward the target service access request to the server to be accessed, a target service access result returned by the server to be accessed is received, the target service access result sent by the target proxy server is received, and the target service access result is fed back to the client equipment sending the target service access request, so that the decentralized client and the multi-service endpoint point-to-point communication are achieved.
In the technical scheme, the configuration is simplified through decentralization, the project complexity caused by introducing the distributed coordination service is avoided, and the client equipment is ensured to be connected with one proxy server to access all target services. The intermediate routing rules are forwarded by the proxy service internally, and each client device does not need to establish connection with each proxy server, so that the connection times are reduced, the access safety is ensured, and the risk of exposing the information of the target server to the outside is avoided.
Drawings
To the accomplishment of the foregoing and related ends, certain illustrative aspects are described herein in connection with the following description and the annexed drawings, which are indicative of various ways in which the principles disclosed herein may be practiced, and all aspects and equivalents thereof are intended to be within the scope of the claimed subject matter. The above and other objects, features and advantages of the present disclosure will become more apparent from the following detailed description read in conjunction with the accompanying drawings. Throughout this disclosure, like reference numerals generally refer to like parts or elements.
FIG. 1 shows a schematic diagram of a target service access system 100 according to one embodiment of the invention;
FIG. 2 illustrates a schematic diagram of a target service access system 200 according to yet another embodiment of the invention;
FIG. 3 illustrates a block diagram of a computing device 300, according to one embodiment of the invention;
FIG. 4 illustrates a flow diagram of a target service access method 400 according to one embodiment of the invention; and
FIG. 5 shows a schematic diagram of a target service access module 500 according to one embodiment of the invention.
Detailed Description
Exemplary embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While exemplary embodiments of the present disclosure are shown in the drawings, it should be understood that the present disclosure may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
FIG. 1 shows a schematic diagram of a target service access system 100 according to one embodiment of the invention. It should be noted that the target service access system 100 of fig. 1 is only exemplary, and in a specific implementation, there may be different numbers of client devices, proxy servers, and target servers in the target service access system 100 according to actual situations, and the present invention is not limited thereto.
As shown in fig. 1, the target service access system 100 includes a target server 111, a target server 112, a proxy server 121, a proxy server 122, a client device 131, and a client device 132. The proxy server 121 establishes communication connections with the target server 111 and the client device 131, respectively, and the proxy server 122 establishes communication connections with the target server 112 and the client device 132, respectively. The proxy server 121 and the proxy server 122 may form a proxy server cluster, which is communicatively connected to each other, and on which a target service access module (not shown in fig. 1) is deployed, and on each of the client device 131 and the client device 132, a client (not shown in fig. 1) that needs to access a target service is installed.
A brief example of a target service access procedure is given below. The client installed on the client device 131 transmits a target service access request to the proxy server 121, and the target service access module in the proxy server 121 receives the target service access request, determines the target server 112 corresponding to the target service access request as a server to be accessed, and takes the proxy server 122 connected to the target server 112 as a target proxy server.
Since the proxy server 122 is not the proxy server 121 that received the target service access request, the target service access module in the proxy server 121 transmits the target service access request to the proxy server 122. Proxy server 122 receives the target service access request and forwards the target service access request to target server 112. Target server 112 receives the target service access request and then responds to it, and returns the target service access result to proxy server 122.
The proxy server 122 receives the target service access result and then transmits the target service access result to the proxy server 121. The target service access module in the proxy server 121 receives the target service access result and feeds it back to the client installed on the client device 131.
It should be noted that although the client devices 131 and 132 shown in fig. 1 are illustrations of computing devices, the device types are not limited thereto, and the client devices 131 and 132 may be computing devices (such as personal computers, etc.) or mobile terminals (such as smartphones, etc.), and the present invention is not limited thereto.
FIG. 2 shows a schematic diagram of a target service access system 200 according to yet another embodiment of the invention. It should be noted that the target service access system 200 of fig. 2 is only exemplary, and in a specific implementation, there may be different numbers of client devices, proxy servers, and target servers in the target service access system 200 according to actual situations, and the present invention is not limited thereto.
For convenience of understanding, the construction of the proxy server will be briefly described below.
For each proxy server, after the proxy server is started, a proxy server is created based on a Netty (a high-performance event-driven, asynchronous and non-blocking network input/output framework) technology, and a WebSocket service is created. When a certain proxy server is selected to establish a connection with a certain target server, the proxy server can be regarded as a server of the Netty service, a corresponding proxy server can be established for the target server, and the target server can be regarded as a client of the Netty service.
When the WebSocket service receives a request (such as a page request in a browser) from a client device, if the proxy server is a target server corresponding to the request for the first proxy access, a proxy client is created, and a connection is established with a proxy server in a proxy server connected to the target server.
Therefore, after the system starts to operate normally, each proxy server at least consists of three parts, namely a WebSocket service part, a proxy client and a proxy server. The WebSocket service is used for interacting with a page in a client (such as a browser) installed on client equipment, the proxy server is used for interacting with a connected target server, the proxy client is used for forwarding a page request received by the WebSocket service to the corresponding proxy server, receiving a result processed by the proxy server and returning the result to the WebSocket service, and the WebSocket service returns the result to the client for page display.
As shown in fig. 2, the target service access system 200 includes a client device 1, a proxy server 210, a proxy server 220, and a target server 2. For convenience of description, the target server 1 establishing a connection with the proxy server 210 and the client device 2 establishing a connection with the proxy server 220 are omitted in fig. 2.
The proxy server 210 may provide WebSocket service (denoted as WebSocket1), and is deployed with a proxy client 1 and a proxy server 1, and the proxy server 220 may also provide WebSocket service (denoted as WebSocket2), and is deployed with a proxy client 2 and a proxy server 2.
The client device 1 is installed with a client, which is a browser, and when a user accesses a browser page, the browser creates a connection with the WebSocket1 in the proxy server 210 and creates a Session (Session). WebSocket1 stores sessions in the form of key-value pairs in a local cache.
After the browser page establishes a connection with WebSocket1, a list of currently available target servers is queried according to an interface provided by proxy server 210. The user can select a target server, a query instruction, etc. that the user needs to query, for example, if a machine CPU (Central Processing Unit) of the query target server 2 queries, the user requests a proxy service through a WebSocket protocol, and if a request URL (Uniform Resource locator) is "ws:// 192.168.73.1: 10079/linux/CPU" for querying, the WebSocket1 receives a browser page and sends selected target service information. That is, the proxy server 210 receives the target service access request issued by the client device 1.
From the target service access request, it may be determined that the target server 2 is a server to be accessed, and the proxy server 220 connected to the target server 2 is a target proxy server. Since the proxy server 210 is not the proxy server 220 and receives the target service access request, the proxy client 1 in the proxy server 210 needs to send the target service access request to the proxy server 2 in the proxy server 220.
The proxy server 2 forwards the target service access request to the target server 2, and the target server 2 responds to the received target service access request and returns a target service access result to the proxy server 2. After receiving the target service access result, the proxy server 2 sends the target service access result to the proxy client 1, and the proxy client 1 feeds the received target service access result back to the client device 1 through the WebSocket1 so as to display the target service access result in the browser page.
FIG. 3 shows a block diagram of a computing device 300, according to one embodiment of the invention.
As shown in FIG. 3, in a basic configuration 302, a computing device 300 typically includes a system memory 306 and one or more processors 304. A memory bus 308 may be used for communication between the processor 304 and the system memory 306.
Depending on the desired configuration, the processor 304 may be any type of processing, including but not limited to: a microprocessor (UP), a microcontroller (UC), a digital information processor (DSP), or any combination thereof. The processor 304 may include one or more levels of cache, such as a level one cache 310 and a level two cache 312, a processor core 314, and registers 316. The example processor core 314 may include an Arithmetic Logic Unit (ALU), a Floating Point Unit (FPU), a digital signal processing core (DSP core), or any combination thereof. The example memory controller 318 may be used with the processor 304, or in some implementations the memory controller 318 may be an internal part of the processor 304.
Depending on the desired configuration, system memory 306 may be any type of memory including, but not limited to: volatile memory (such as RAM), non-volatile memory (such as ROM, flash memory, etc.), or any combination thereof. System memory 306 may include an operating system 320, one or more applications 322, and program data 324. In some implementations, the application 322 can be arranged to execute instructions on the operating system with the program data 324 by one or more processors 304.
The computing device 300 also includes a storage device 332, the storage device 332 including removable storage 336 and non-removable storage 338.
Computing device 300 may also include a storage interface bus 334. The storage interface bus 334 enables communication from a storage device 332 (e.g., removable storage 336 and non-removable storage 338) to the basic configuration 302 via the bus/interface controller 330. Operating system 320, applications 322, and at least a portion of program data 324 may be stored on removable storage 336 and/or non-removable storage 338, and loaded into system memory 306 via storage interface bus 334 and executed by one or more processors 304 when computing device 300 is powered on or applications 322 are to be executed.
The computing device 300 may also include an interface bus 340 that facilitates communication from various interface devices (e.g., output devices 342, peripheral interfaces 344, and communication devices 346) to the basic configuration 302 via the bus/interface controller 330. The example output devices 342 include a graphics processing unit 348 and an audio processing unit 350. They may be configured to facilitate communications with various external devices, such as a display or speakers, via one or more a/V ports 352. Example peripheral interfaces 344 can include a serial interface controller 354 and a parallel interface controller 356, which can be configured to facilitate communication with external devices such as input devices (e.g., keyboard, mouse, pen, voice input device, touch input device) or other peripherals (e.g., printer, scanner, etc.) via one or more I/O ports 358. An example communication device 346 can include a network controller 360, which can be arranged to facilitate communications with one or more other computing devices 362 over a network communication link via one or more communication ports 364.
A network communication link may be one example of a communication medium. Communication media may typically be embodied by computer readable instructions, data structures, program modules, and may include any information delivery media, such as carrier waves or other transport mechanisms, in a modulated data signal. A "modulated data signal" may be a signal that has one or more of its data set or its changes made in a manner that encodes information in the signal. By way of non-limiting example, communication media may include wired media such as a wired network or private-wired network, and various wireless media such as acoustic, Radio Frequency (RF), microwave, Infrared (IR), or other wireless media. The term computer readable media as used herein may include both storage media and communication media.
Computing device 300 may be implemented as a personal computer including both desktop and notebook computer configurations. Of course, computing device 300 may also be implemented as part of a small-form factor portable (or mobile) electronic device such as a cellular telephone, a digital camera, a Personal Digital Assistant (PDA), a personal media player device, a wireless web-watch device, a personal headset, an application specific device, or a hybrid device that include any of the above functions. And may even be implemented as a server, such as a file server, a database server, an application server, a WEB server, and so forth. The embodiments of the present invention do not limit this.
In an embodiment according to the invention, the computing device 300 may be implemented as a proxy server 121, 122 as shown in FIG. 1, or a proxy server 210, 220 as shown in FIG. 2, and configured to perform the target service access method 400 according to the invention. Among other things, application 322 disposed on an operating system contains therein a plurality of program instructions for carrying out the target service access method 400 of the present invention, which may instruct processor 304 to carry out the target service access method 400 of the present invention such that computing device 300 accesses a target service by carrying out the target service access method 400 of the present invention.
According to one embodiment of the present invention, application 322 disposed on an operating system includes a target service access module 500, the target service access module 500 containing a plurality of program instructions for performing target service access method 400 of the present invention, such that target service access method 400 of the present invention may be performed in target service access module 500.
FIG. 4 shows a flow diagram of a target service access method 400 according to one embodiment of the invention. Target service access method 400 may be performed in a target service access module 500 of a computing device (e.g., computing device 300 described above). The target service access method 400 is described below with reference to the target service access system 200 as an example.
As shown in fig. 4, the method 400 begins at step S410. In step S410, a target service access request sent by any one of a plurality of client devices is received.
According to an embodiment of the present invention, before step S410, the method 400 further includes starting a proxy service to create a proxy server and a WebSocket service, and saving start information of the proxy server to the cache server, where the start information includes an IP (Internet Protocol) address, a port, and a start time.
Of course, before the proxy service is started, a nginnx server (a high-performance network and a reverse proxy server) needs to be deployed for load balancing. The target service access system 100 shown in fig. 1 and the target service access system 200 shown in fig. 2 may also include a Nginx server and the above-described cache server.
Then, a plurality of proxy servers are deployed. Taking fig. 2 as an example, a proxy server 210 and a proxy server 220 may be deployed. Modifying the Nginx service configuration information, configuring a server routing address in an HTTP (Hyper Text Transfer Protocol) module, setting the server routing address as an IP address and a port of a plurality of deployed proxy servers (such as the proxy server 210 and the proxy server 220) and using the IP address and the port for load balancing of requests. When a request is made to access the Nginx server, the Nginx server forwards the request to one proxy server according to the routing rule.
After the proxy service is started, a proxy server is established based on the Netty technology, and a WebSocket service is established. For example, proxy server 1 and WebSocket1 are created for proxy server 210, and proxy server 2 and WebSocket2 are created for proxy server 220. Then, the proxy Server 1 and the proxy Server 2 are started, and the IP addresses, ports, and start time of the two proxy servers are saved to a cache Server implemented by a Remote Dictionary service (Redis).
In addition, proxy 210 and proxy 220 provide an interface for querying the list of currently available proxy servers, through which proxy queries may be made from cache servers.
And deploying and starting a plurality of corresponding target servers according to the service, and creating a client of the Netty service by using a Netty technology. When the target server is started, the proxy server is inquired through a currently available proxy server list provided by the proxy server, and one proxy server needing to be connected can be selected according to different algorithms such as a random algorithm or a polling algorithm.
Taking the target server 2 in fig. 2 as an example, if the proxy server 220 is selected by a random algorithm, the target server 2 is a client of the Netty service, and the proxy server 2 in the proxy server 220 is a server of the Netty service.
According to an embodiment of the present invention, before step S410, the method further includes receiving a proxy connection request from any target server of the plurality of target servers, establishing a connection with the target server that sent the proxy connection request in response to the proxy connection request, and storing connection information in the cache server.
In this embodiment, after receiving the proxy connection request from the target server 2, the proxy server 2 in the proxy server 220 will respond to the proxy connection request to establish a connection with the target server 2. The target server 2 establishes a long TCP connection from point to point with it through the IP address and port provided by the proxy server 2.
The proxy server 2 stores the connection information with the target server 2 in a cache server, and a list of connection information between all target servers and the proxy server is maintained in the cache server.
The following is an example of a format of the connection information:
Figure BDA0003597150220000111
Figure BDA0003597150220000121
in order to ensure the stable connection between the target server and the proxy server, the target server sends heartbeat information to a proxy server in the proxy server connected with the target server at regular intervals (such as 30 seconds), and the proxy server sends corresponding reply information to the target server after receiving the heartbeat information sent by the target server. If the target server does not receive the reply information of the proxy server continuously for a plurality of times (for example, 3 times), the target server determines that the proxy server cannot provide the service, and the target server initiates the creation of a new connection again to select the proxy server from the available proxy servers.
In addition, if the target server is offline, the proxy server connected with the target server is disconnected, and the proxy server deletes the connection information of the target server and the proxy server in the cache server. In fig. 2, operations related to the connection process between the proxy server 210 and the target server 1, which are not shown, can be referred to the connection process between the proxy server 220 and the target server 2, and are not described herein again.
Before receiving the target service access request, the related contents of establishing a WebSocket service connection, creating a session, providing an interface so as to query a currently available target server list, requesting a query, and the like are already described in the foregoing description on the target service access system 200, and are not described in detail in the following.
According to an embodiment of the present invention, after the proxy server 210 receives the target service access request sent by the client device 1, the process proceeds to step S420, where a target server corresponding to the target service access request is determined as a server to be accessed, and a proxy server connected to the server to be accessed is determined as a target proxy server.
In this embodiment, according to the target service access request, the corresponding target server 2 is determined as the server to be accessed, and the proxy server 220 to which the target server 2 is connected is determined as the target proxy server.
According to an embodiment of the present invention, before performing step S430, the method 400 further includes: if the proxy server receiving the target service access request is used for proxy access of the server to be accessed for the first time, a proxy client is established for the proxy server receiving the target service access request through the WebSocket service, and connection is established between the proxy client and a proxy server in the target proxy server; and storing the established connection relation in a local cache in a key value pair mode, and starting a proxy client in the proxy server which receives the target service access request.
Since the proxy server 210 that receives the target service access request firstly proxies the proxy server 220, that is, firstly queries whether a corresponding connection relationship exists from the local cache, the proxy server creates a proxy client 1 through the WebSocket1, and establishes a connection with the proxy server 2 in the proxy server 220. And storing the established connection relation in a local cache in a key value pair mode, and starting the proxy client 1. If there is a target server 2 connected to the proxy server 220 through the proxy server 210, the connection relationship may be directly obtained from the local cache.
And if the proxy server receiving the target service access request does not perform proxy access on the server to be accessed for the first time, acquiring a corresponding connection relation from the local cache, and establishing connection between the proxy client in the proxy server receiving the target service access request and the proxy server in the target proxy server according to the connection relation.
In step S430, if the target proxy server is not the proxy server that received the target service access request, the target service access request is sent to the target proxy server to instruct the target proxy server to forward the target service access request to the server to be accessed, and receive the target service access result returned by the server to be accessed.
According to one embodiment of the invention, the target service access request can be sent to the target proxy server in the following way to instruct the target proxy server to forward the target service access request to the server to be accessed. In the embodiment, the target service access request is sent to the proxy server in the target proxy server through the proxy client in the proxy server which receives the target service access request to indicate the proxy server in the target proxy server, and the target service access request is forwarded to the server to be accessed.
The target proxy server is the proxy server 220, and not the proxy server 210 which receives the target service access request, the target service access request is sent to the proxy server 2 in the proxy server 220 through the proxy client 1 in the proxy server 210, so as to instruct the proxy server 2 to forward the target service access request to the target server 2.
According to another embodiment of the invention, if the target proxy server is the proxy server which receives the target service access request, the target service access request is forwarded to the server to be accessed so as to receive the target service access result returned by the server to be accessed. In this embodiment, if the target proxy server is a proxy server that receives the target service access request, the target service access request is sent to a proxy server in the target proxy server through a proxy client in the target proxy server to indicate the proxy server in the target proxy server, the target service access request is forwarded to the server to be accessed, and a target service access result returned by the server to be accessed is received.
Finally, step S440 is executed to receive the target service access result sent by the target proxy server, and feed back the target service access result to the client device sending the target service access request.
According to an embodiment of the present invention, after receiving a target service access request sent by the proxy server 2, the target server 2 responds to the target service access request and sends a corresponding target service access result to the proxy server 2. The proxy server 2 sends the received target service access result to the proxy client 1 in the proxy server 210. The proxy client 1 receives the target service access result, and feeds back the target service access result to the client device 1 through the WebSocket 1.
According to an embodiment of the invention, the method 400 further comprises: sending heartbeat information to the target proxy server according to a preset time interval to indicate the target proxy server to feed back reply information; and if the reply information is not received for the preset times, determining that the target proxy server cannot provide the proxy service, and providing an available proxy server for the server to be accessed again.
In this embodiment, heartbeat information is sent to the proxy server in the target proxy server through the proxy client in the proxy server receiving the target service access request, typically at a predetermined time interval, so as to instruct the proxy server in the target proxy server to feed back the reply information.
For example, the time interval is set to 30 seconds, the preset number of times is 3, the proxy client 1 sends heartbeat information to the proxy server 2 every 30 seconds, and the proxy server 2 feeds back reply information to the proxy client 1 after receiving the heartbeat information. If the proxy client 1 does not receive the reply information for 3 consecutive times, it is determined that the proxy server 220 or the proxy server 2 cannot provide the proxy service, and an available proxy server is newly provided for the target server 2.
FIG. 5 shows a schematic diagram of a target service access module 500 according to one embodiment of the invention. The target service access module 500 resides in a proxy server, such as the proxy servers 121, 122 shown in fig. 1, or the proxy servers 210, 220 shown in fig. 2, and the computing device 300 shown in fig. 3 may be implemented as a proxy server. The target service access module 500 accesses the target server by performing the target service access method 400 of the present invention.
As shown in fig. 5, the target service access module 500 includes a receiving unit 510, a determining unit 520, a transmitting unit 530, and a feedback unit 540, which are connected in sequence.
The receiving unit 510 may receive a target service access request sent by any one of the plurality of client devices. Subsequently, the determination unit 520 may determine a target server corresponding to the target service access request as a server to be accessed, and a proxy server connected to the server to be accessed as a target proxy server. The sending unit 530 may send the target service access request to the target proxy server to instruct the target proxy server to forward the target service access request to the server to be accessed and receive a target service access result returned by the server to be accessed, when the target proxy server is not the proxy server that received the target service access request. The feedback unit 540 may receive the target service access result sent by the target proxy server and feed back the target service access result to the client device that sent the target service access request.
It should be noted that the receiving unit 510 is configured to execute the aforementioned step S410, the determining unit 520 is configured to execute the aforementioned step S420, the sending unit 530 is configured to execute the aforementioned step S430, and the feedback unit 540 is configured to execute the aforementioned step S440. Here, for the execution logic of the receiving unit 510, the determining unit 520, the sending unit 530 and the feedback unit 540, reference may be made to the detailed description of steps S410 to S440 in the method 400, and details are not repeated here.
According to the target service access scheme provided by the embodiment of the invention, after a target service access request sent by client equipment is received, a target server corresponding to the target service access request is determined to be used as a server to be accessed, a proxy server connected with the server to be accessed is used as a target proxy server, the target service access request is sent to the target proxy server so as to instruct the target proxy server to forward the target service access request to the server to be accessed, a target service access result returned by the server to be accessed is received, the target service access result sent by the target proxy server is received, and the target service access result is fed back to the client equipment sending the target service access request, so that the decentralized client and the multi-service endpoint point-to-point communication are realized.
In the technical scheme, the configuration is simplified through decentralization, the project complexity caused by introducing the distributed coordination service is avoided, and the client equipment is ensured to be connected with one proxy server to access all target services. The intermediate routing rules are forwarded by the proxy service internally, and each client device does not need to establish connection with each proxy server, so that the connection times are reduced, the access safety is ensured, and the risk of exposing the information of the target server to the outside is avoided.
A7 the method of any one of claims a1-a6, further comprising, prior to the step of receiving a target service access request by any one of a plurality of client devices:
receiving an agent connection request sent by any one of a plurality of target servers;
responding to the proxy connection request, establishing connection with a target server sending the proxy connection request, and storing connection information in a cache server.
The various techniques described herein may be implemented in connection with hardware or software or, alternatively, with a combination of both. Thus, the methods and apparatus of the present invention, or certain aspects or portions thereof, may take the form of program code (i.e., instructions) embodied in tangible media, such as removable hard drives, U.S. disks, floppy disks, CD-ROMs, or any other machine-readable storage medium, wherein, when the program is loaded into and executed by a machine, such as a computer, the machine becomes an apparatus for practicing the invention.
In the case of program code execution on programmable computers, the computing device will generally include a processor, a storage medium readable by the processor (including volatile and non-volatile memory and/or storage elements), at least one input device, and at least one output device. Wherein the memory is configured to store program code; the processor is configured to perform the target service access method of the present invention according to instructions in the program code stored in the memory.
By way of example, and not limitation, readable media may comprise readable storage media and communication media. Readable storage media store information such as computer readable instructions, data structures, program modules or other data. Communication media typically embodies computer readable instructions, data structures, program modules or other data in a modulated data signal such as a carrier wave or other transport mechanism and includes any information delivery media. Combinations of any of the above are also included within the scope of readable media.
In the description provided herein, algorithms and displays are not inherently related to any particular computer, virtual system, or other apparatus. Various general purpose systems may also be used with examples of this invention. The required structure for constructing such a system will be apparent from the description above. Moreover, the present invention is not directed to any particular programming language. It is appreciated that a variety of programming languages may be used to implement the teachings of the present invention as described herein, and any descriptions of specific languages are provided above to disclose the best mode of the invention.
In the description provided herein, numerous specific details are set forth. It is understood, however, that embodiments of the invention may be practiced without these specific details. In some instances, well-known methods, structures and techniques have not been shown in detail in order not to obscure an understanding of this description.
Similarly, it should be appreciated that in the foregoing description of exemplary embodiments of the invention, various features of the invention are sometimes grouped together in a single embodiment, figure, or description thereof for the purpose of streamlining the disclosure and aiding in the understanding of one or more of the various inventive aspects. However, the disclosed method should not be interpreted as reflecting an intention that: that the invention as claimed requires more features than are expressly recited in each claim. Rather, as the following claims reflect, inventive aspects lie in less than all features of a single foregoing disclosed embodiment. Thus, the claims following the detailed description are hereby expressly incorporated into this detailed description, with each claim standing on its own as a separate embodiment of this invention.
Those skilled in the art will appreciate that the modules or units or components of the devices in the examples disclosed herein may be arranged in a device as described in this embodiment or alternatively may be located in one or more devices different from the devices in this example. The modules in the foregoing examples may be combined into one module or may be further divided into multiple sub-modules.
Those skilled in the art will appreciate that the modules in the device in an embodiment may be adaptively changed and disposed in one or more devices different from the embodiment. The modules or units or components of the embodiments may be combined into one module or unit or component, and furthermore they may be divided into a plurality of sub-modules or sub-units or sub-components. All of the features disclosed in this specification (including any accompanying claims, abstract and drawings), and all of the processes or elements of any method or apparatus so disclosed, may be combined in any combination, except combinations where at least some of such features and/or processes or elements are mutually exclusive. Each feature disclosed in this specification (including any accompanying claims, abstract and drawings) may be replaced by alternative features serving the same, equivalent or similar purpose, unless expressly stated otherwise.
Furthermore, those skilled in the art will appreciate that while some embodiments described herein include some features included in other embodiments, rather than other features, combinations of features of different embodiments are meant to be within the scope of the invention and form different embodiments. For example, in the following claims, any of the claimed embodiments may be used in any combination.
Furthermore, some of the described embodiments are described herein as a method or combination of method elements that can be performed by a processor of a computer system or by other means of performing the described functions. A processor having the necessary instructions for carrying out the method or method elements thus forms a means for carrying out the method or method elements. Further, the elements of the apparatus embodiments described herein are examples of the following apparatus: the apparatus is used to implement the functions performed by the elements for the purpose of carrying out the invention.
As used herein, unless otherwise specified the use of the ordinal adjectives "first", "second", "third", etc., to describe a common object, merely indicate that different instances of like objects are being referred to, and are not intended to imply that the objects so described must be in a given sequence, either temporally, spatially, in ranking, or in any other manner.
While the invention has been described with respect to a limited number of embodiments, those skilled in the art, having benefit of this description, will appreciate that other embodiments can be devised which do not depart from the scope of the invention as described herein. Furthermore, it should be noted that the language used in the specification has been principally selected for readability and instructional purposes, and may not have been selected to delineate or circumscribe the inventive subject matter. Accordingly, many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the appended claims. The present invention has been disclosed in an illustrative rather than a restrictive sense, and the scope of the present invention is defined by the appended claims.

Claims (10)

1. A target service access method adapted to be executed in a proxy server, the method comprising:
receiving a target service access request sent by any one of a plurality of client devices;
determining a target server corresponding to the target service access request as a server to be accessed, and taking a proxy server connected with the server to be accessed as a target proxy server;
if the target proxy server is not the proxy server receiving the target service access request, sending the target service access request to the target proxy server to indicate the target proxy server to forward the target service access request to the server to be accessed, and receiving a target service access result returned by the server to be accessed;
and receiving the target service access result sent by the target proxy server, and feeding back the target service access result to the client equipment sending the target service access request.
2. The method of claim 1, wherein the proxy server provides WebSocket services, and further comprising, prior to the step of sending the target service access request to the target proxy server:
if the proxy server receiving the target service access request is used for proxy access of the server to be accessed for the first time, establishing a proxy client for the proxy server receiving the target service access request through the WebSocket service, and establishing connection with a proxy server in the target proxy server;
and storing the established connection relation in a local cache in a key value pair mode, and starting a proxy client in the proxy server which receives the target service access request.
3. The method of claim 1 or 2, wherein the step of sending the target service access request to the target proxy server to instruct the target proxy server to forward the target service access request to the server to be accessed comprises:
sending the target service access request to a proxy server in the target proxy server through a proxy client in the proxy server which receives the target service access request so as to indicate the proxy server in the target proxy server, and forwarding the target service access request to the server to be accessed.
4. The method of any of claims 1-3, further comprising:
sending heartbeat information to the target proxy server according to a preset time interval to indicate the target proxy server to feed back reply information;
and if the reply information is not received for the continuous preset times, determining that the target proxy server cannot provide proxy service, and providing an available proxy server for the server to be accessed again.
5. The method of claim 4, wherein the step of sending a heartbeat message to the target proxy server at a predetermined time interval to instruct the target proxy server to feed back a reply message comprises:
and sending heartbeat information to the proxy server side in the target proxy server through the proxy client side in the proxy server which receives the target service access request according to a preset time interval so as to indicate the proxy server side in the target proxy server to feed back the reply information.
6. The method of any of claims 1-5, further comprising, prior to the step of receiving the target service access request sent by any of the plurality of client devices:
starting proxy service to create a proxy server and WebSocket service;
and storing the starting information of the proxy server to a cache server, wherein the starting information comprises an IP address, a port and starting time.
7. A target service access module residing in a proxy server, the module comprising:
the system comprises a receiving unit, a processing unit and a processing unit, wherein the receiving unit is suitable for receiving a target service access request sent by any one of a plurality of client devices;
the determining unit is suitable for determining a target server corresponding to the target service access request as a server to be accessed and taking a proxy server connected with the server to be accessed as a target proxy server;
the sending unit is suitable for sending the target service access request to the target proxy server when the target proxy server is not the proxy server receiving the target service access request, so as to instruct the target proxy server to forward the target service access request to the server to be accessed and receive a target service access result returned by the server to be accessed;
and the feedback unit is suitable for receiving the target service access result sent by the target proxy server and feeding back the target service access result to the client equipment sending the target service access request.
8. A target service access system, comprising:
a plurality of client devices, a plurality of proxy servers, and a plurality of target servers, wherein each proxy server comprises the target service access module of claim 8.
9. A computing device, comprising:
at least one processor; and
a memory storing program instructions, wherein the program instructions are configured to be adapted to be executed by the at least one processor, the program instructions comprising instructions for performing the method of any of claims 1-6.
10. A readable storage medium storing program instructions that, when read and executed by a computing device, cause the computing device to perform the method of any of claims 1-6.
CN202210395377.6A 2022-04-14 2022-04-14 Target service access method, module and system Active CN114979099B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210395377.6A CN114979099B (en) 2022-04-14 2022-04-14 Target service access method, module and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210395377.6A CN114979099B (en) 2022-04-14 2022-04-14 Target service access method, module and system

Publications (2)

Publication Number Publication Date
CN114979099A true CN114979099A (en) 2022-08-30
CN114979099B CN114979099B (en) 2024-02-23

Family

ID=82977893

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210395377.6A Active CN114979099B (en) 2022-04-14 2022-04-14 Target service access method, module and system

Country Status (1)

Country Link
CN (1) CN114979099B (en)

Citations (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624920A (en) * 2012-03-31 2012-08-01 奇智软件(北京)有限公司 Method and device for performing access through proxy server
CN102970384A (en) * 2012-11-13 2013-03-13 北京奇虎科技有限公司 Proxy server and communication system
US20140068001A1 (en) * 2012-07-05 2014-03-06 Tencent Technology (Shenzhen) Company Limited Intermediate proxy server, communication method, and communication system based on http multi-level proxy
CN105635338A (en) * 2015-12-31 2016-06-01 迈普通信技术股份有限公司 Data transmission method and device
CN108063714A (en) * 2016-11-09 2018-05-22 北京国双科技有限公司 A kind of processing method and processing device of network request
CN108156210A (en) * 2016-12-06 2018-06-12 腾讯科技(深圳)有限公司 The acquisition methods and device of target resource
CN110138586A (en) * 2019-04-04 2019-08-16 平安科技(深圳)有限公司 Block chain node administration method, electronic device, system and readable storage medium storing program for executing
CN111064795A (en) * 2019-12-20 2020-04-24 腾讯科技(深圳)有限公司 Web page access acceleration method, system, computer equipment, server and medium
CN112637346A (en) * 2020-12-24 2021-04-09 北京知道创宇信息技术股份有限公司 Proxy method, device, proxy server and storage medium
CN113364818A (en) * 2020-03-03 2021-09-07 北京搜狗科技发展有限公司 Data processing method and device and electronic equipment
WO2022048069A1 (en) * 2020-09-03 2022-03-10 浙江宇视科技有限公司 Device cross-area access method and apparatus, electronic device, and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102624920A (en) * 2012-03-31 2012-08-01 奇智软件(北京)有限公司 Method and device for performing access through proxy server
CN105100260A (en) * 2012-03-31 2015-11-25 北京奇虎科技有限公司 Method and device for carrying out access through proxy server
US20140068001A1 (en) * 2012-07-05 2014-03-06 Tencent Technology (Shenzhen) Company Limited Intermediate proxy server, communication method, and communication system based on http multi-level proxy
CN102970384A (en) * 2012-11-13 2013-03-13 北京奇虎科技有限公司 Proxy server and communication system
CN105635338A (en) * 2015-12-31 2016-06-01 迈普通信技术股份有限公司 Data transmission method and device
CN108063714A (en) * 2016-11-09 2018-05-22 北京国双科技有限公司 A kind of processing method and processing device of network request
CN108156210A (en) * 2016-12-06 2018-06-12 腾讯科技(深圳)有限公司 The acquisition methods and device of target resource
CN110138586A (en) * 2019-04-04 2019-08-16 平安科技(深圳)有限公司 Block chain node administration method, electronic device, system and readable storage medium storing program for executing
CN111064795A (en) * 2019-12-20 2020-04-24 腾讯科技(深圳)有限公司 Web page access acceleration method, system, computer equipment, server and medium
CN113364818A (en) * 2020-03-03 2021-09-07 北京搜狗科技发展有限公司 Data processing method and device and electronic equipment
WO2022048069A1 (en) * 2020-09-03 2022-03-10 浙江宇视科技有限公司 Device cross-area access method and apparatus, electronic device, and storage medium
CN112637346A (en) * 2020-12-24 2021-04-09 北京知道创宇信息技术股份有限公司 Proxy method, device, proxy server and storage medium

Also Published As

Publication number Publication date
CN114979099B (en) 2024-02-23

Similar Documents

Publication Publication Date Title
EP2633667B1 (en) System and method for on the fly protocol conversion in obtaining policy enforcement information
JP2000232446A (en) Data transfer method and device
CN113329069B (en) Instant messaging method, system and computing device
JP2005216309A (en) Printing method and system employing instant message protocol
US20150324160A1 (en) Network Printing Device, Server, System and Method
CN101729598A (en) Method and system for increasing Web service response speed and network processor
CN110806928A (en) Job submitting method and system
US10986066B2 (en) Systems, apparatuses, methods, and non-transitory computer readable media for efficient call processing
JP6417046B2 (en) Technology that translates network resource requirements into zero rating network requirements
JP6039446B2 (en) Web server device, control method, and program thereof.
CN112732468B (en) Data processing method, data interaction system and computing equipment
CN114979099B (en) Target service access method, module and system
CN111949275A (en) Script deployment method, request processing method and device
CN113382050B (en) Message transmission method, system, computing device and storage medium
CN112395070A (en) Data processing system and method
CN111405046B (en) Authorization method for batch equipment
CN113300895A (en) Cable processing method and system and computing device
US9634987B2 (en) Obtaining a MAC address from an external source
CN112671843A (en) Data request method, system and computing device
CN114513500B (en) Method, device, system and computing device for batch installation of browser plug-ins
CN115361277B (en) Method, device, equipment and medium for deploying general cluster system
CN113076113B (en) Method, host and system for installing operating system
CN116095164B (en) Device connection network access method, device and storage medium based on communication protocol
CN114650271B (en) Global load DNS neighbor site learning method and device
WO2016197995A1 (en) Method and device for realizing stateful operation in stateless network protocol

Legal Events

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