A method for a client to access a low-latency server based on a master service assignment
By allocating client access to low-latency servers through the master control service, the problem of uneven latency caused by client distribution in the C/S architecture is solved, enabling efficient data exchange across regions and networks and enhancing the reliability and timeliness of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- AISINO CREDIT INFORMATION CO LTD
- Filing Date
- 2022-12-02
- Publication Date
- 2026-07-24
AI Technical Summary
In a client/server architecture, when clients are distributed across different regions and networks, the latency of a single backend business service system varies, resulting in uneven latency for clients in different regions or networks connecting to the backend. This affects data acquisition efficiency and may lead to lag or inability to access the backend service system.
The method of assigning client access to low-latency servers by master control service is adopted. The master control server obtains the client's regional and telecommunications network information, selects the nearest business server, uses national cryptographic algorithms for encrypted communication, and realizes logical decoupling between master control and business servers to handle login and business data interaction respectively.
It improves the timeliness and reliability of data exchange between client machines and backend system services, reduces the dependence of backend system services on regions and networks, and enables deployment across regions and different telecommunications networks.
Smart Images

Figure CN116032538B_ABST
Abstract
Description
Technical Field
[0001] This invention belongs to the field of network communication technology, and in particular relates to a method for allocating client access to a low-latency server based on a master control service. Background Technology
[0002] C / S architecture is a software system architecture that typically employs a two-tier structure: Client-Server. Generally, the front end is the client, and the back end is the server. The client is responsible for user interaction, such as displaying the user interface, accepting data input, validating data, sending requests to the server, receiving responses, processing application logic, and displaying the results on the page. The server is responsible for data management, such as accepting client requests, running the DBMS, providing database queries and management, and submitting data to the client.
[0003] In practical project applications, due to project implementation and promotion, client machines are located in various provinces and on different telecommunications networks, such as China Mobile and China Unicom, as well as numerous sub-regional networks built by network companies scattered across different regions. If a single backend service system is used, client machines in different regions or on different networks may experience varying latency when connecting to the backend, affecting the efficiency of client data acquisition. This can even lead to client interface lag and slow data loading, and in severe cases, the inability to access the backend service system. Summary of the Invention
[0004] In view of this, the present invention aims to overcome the shortcomings of the above-mentioned problems in the prior art and proposes a method for allocating client access to a low-latency server based on the master control service.
[0005] To achieve the above objectives, the technical solution of the present invention is implemented as follows:
[0006] A method for allocating client access to a low-latency server based on a master control service includes the following steps:
[0007] S1. Client starts up;
[0008] S2. The client program obtains the local machine's signature code, connects to the main control server, and sends the client's login account information to the main control server;
[0009] S3. After receiving the client's connection information, the master server verifies the login information. If the verification is successful, the master server caches the client's signature code in the Redis server and records the client's access record in the master server.
[0010] S4. The master control server obtains the client's geographic information and telecommunications network information based on the client's IP information, and then uses the obtained geographic information and telecommunications network information to obtain the nearest business server information from the business server list;
[0011] S5. The master control server selects two business server nodes in the business server cluster. The two business servers serve as backup servers for each other. The master control server synchronizes the client's login information and signature code to the two business servers and notifies the two business servers of the client's legitimate login request.
[0012] S6. The master server assigns the business server address information to the client and returns token data and data encryption key to the client;
[0013] S7. The client machine stores the login information of the two business servers;
[0014] S8. The client performs network speed tests on the two service servers and selects the best service server to connect to;
[0015] S9. The client interacts with business data using the token data and data encryption key returned by the selected business server. At the same time, the client uses the token data and data encryption key generated by another alternative server to notify the alternative server to give up access, so that the alternative server releases the service resources requested by the client's connection.
[0016] S10. The client uses the token data and data encryption key of the selected business server to interact with the business server and perform normal business operations;
[0017] S11. Exit the application and end.
[0018] Furthermore, in step S1, the client is a PC desktop application or a mobile-based App application.
[0019] Furthermore, in step S2, the client and the master server communicate using HTTPS. The data content of the communication message is symmetrically encrypted using an sm4 key randomly generated by the client, and the communication message data is encrypted and protected using the master server's sm2 public key.
[0020] Furthermore, after the master control server performs step S5, the client of the business server performs login initialization. After obtaining the client's login information, the business server generates the client's token data and SM4 communication key.
[0021] Furthermore, the login information of the business server in step S7 includes the IP address of the business server, the login token data of the business server, and the data encryption SM4 key data.
[0022] Furthermore, in step S8, the network speed test method is: to test the network speed by delaying the ping method, or to test the network speed by sending a heartbeat packet and returning the delay. If the network speed test is performed by the heartbeat packet method, the login token data corresponding to the business server and the data encrypted with the sm4 key must be sent, and the business server will determine whether the client can log in and connect.
[0023] Furthermore, the business server decrypts the data and verifies the token for the access request, and blacklists the IP address for access requests that fail to decrypt multiple times or have an abnormal token.
[0024] Compared with the prior art, the present invention has the following advantages:
[0025] The method for allocating client access to low-latency servers based on master control service described in this invention utilizes national cryptographic algorithms and combines them with the concept of token-based access control for backend services. This improves upon the shortcomings of single-service systems in C / S backend services, and the improved method achieves logical decoupling of system login and business data interaction. It is implemented separately on different backend server systems, enhancing the timeliness and reliability of data exchange between clients and backend system services for normal business operations. This significantly reduces the limitation of C / S architecture backend system services to deployment within a certain region or network, enabling the possibility of deploying backend service systems across regions or different telecommunications networks. Attached Figure Description
[0026] The accompanying drawings, which form part of this invention, are used to provide a further understanding of the invention. The illustrative embodiments of the invention and their descriptions are used to explain the invention and do not constitute an undue limitation of the invention. In the drawings:
[0027] Figure 1 This is a flowchart illustrating the method for allocating client access to a low-latency server based on a master control service, as described in an embodiment of the present invention. Detailed Implementation
[0028] It should be noted that, unless otherwise specified, the embodiments and features described in the present invention can be combined with each other.
[0029] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0030] As shown in the figure, a method for allocating client access to a low-latency server based on a master control service includes the following steps:
[0031] S1. Client starts up;
[0032] S2. The client program obtains the local machine's signature, such as the CPU or motherboard serial number, performs an MD5 hash operation on the above information to form the local machine's signature, connects to the main control server, and sends the client's login account information to the main control server.
[0033] S3. After receiving the client's connection information, the master server verifies the login information. If the verification is successful, the master server caches the client's signature code in the Redis server and records the client's access record in the master server.
[0034] S4. The master control server obtains the client's regional information and telecommunications network information based on the client's IP information, such as province information and telecommunications network parameters. Based on the obtained regional information and telecommunications network information, the master control server obtains the information of the nearest business server to the client through the business server list. For example, if the business server and the client are in the same province or in the same telecommunications operator network, the number of routing hops for network access is reduced.
[0035] S5. The master control server selects two business server nodes in the business server cluster. One server is the primary business server for client access, and the other server is the backup access server for client access. The two business servers are backup servers for each other. The master control server synchronizes the client's login information and signature code to the two business servers and notifies the two business servers of the client's legitimate login request.
[0036] S6. The master server assigns the business server address information to the client and returns token data and data encryption key to the client;
[0037] S7. The client machine stores the login information of the two business servers;
[0038] S8. The client performs network speed tests on the two service servers and selects the best service server to connect to;
[0039] S9. The client interacts with business data using the token data and data encryption key returned by the selected business server. At the same time, the client uses the token data and data encryption key generated by another alternative server to notify the alternative server to give up access, so that the alternative server releases the service resources requested by the client's connection.
[0040] S10. The client uses the token data and data encryption key of the selected business server to interact with the business server and perform normal business operations;
[0041] S11. Exit the application and end.
[0042] In step S1, the client is a PC desktop application, a mobile app application, or other client programs based on a client / server architecture.
[0043] In step S2, the client and the master server communicate using HTTPS. The data content of the communication message is symmetrically encrypted using an sm4 key randomly generated by the client, and the communication message data is encrypted and protected using the sm2 public key of the master server.
[0044] After the master control server performs step S5, the client on the business server performs login initialization. After obtaining the client's login information, the business server generates the client's token data and SM4 communication key. Since there are random parameters in the generation of token data and SM4 communication key, the token data and SM4 generated by the two business servers for the same client are different.
[0045] In step S6, after completing step S5, the master control server obtains the login token data and sm4 key returned by the two business servers and then returns them to the client.
[0046] The login information for the business server in step S7 includes the business server's IP address, the business server's login token data, and the data encryption SM4 key data.
[0047] In step S8, the network speed test method is as follows: the network speed test is performed by delaying the ping method or by sending a heartbeat packet and returning the delay. If the network speed test is performed by the heartbeat packet method, the login token data corresponding to the business server and the data encrypted with the sm4 key must be sent. The business server then determines whether the client can log in and connect.
[0048] The business server decrypts data and verifies tokens upon access requests. For access requests that fail to decrypt multiple times or contain invalid tokens, the server blacklists the IP address. This prevents malicious third-party attempts to probe or attack the business server. The business server can assess the malice of access connections and add the IP to a restricted list or deny access altogether.
[0049] To achieve efficient communication of business data between the client and the server, this embodiment abandons the traditional single backend service system model and implements the login function and business data exchange function on different servers, namely the main control server and the business server, to realize the total-splitting mode, 1-N mode and even MN mode of the backend business.
[0050] The communication between the client and the master server uses a combination of two national cryptographic algorithms, SM4 and SM2. The key for the SM4 algorithm is randomly generated when the client accesses the master server. The data packets are encrypted using the inner layer of the communication packets using the SM4 algorithm, and the communication packets are encrypted using the SM2 algorithm using the public key provided by the master server.
[0051] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the present invention should be included within the protection scope of the present invention.
Claims
1. A method for allocating client access to a low-latency server based on a master control service, characterized in that, Includes the following steps: S1. Client starts up; S2. The client program obtains the local machine's signature code, connects to the main control server, and sends the client's login account information to the main control server; S3. After receiving the client's connection information, the master server verifies the login information. If the verification is successful, the master server caches the client's signature code in the Redis server and records the client's access record in the master server. S4. The master control server obtains the client's geographic information and telecommunications network information based on the client's IP information, and then uses the obtained geographic information and telecommunications network information to obtain the information of the nearest business server to the client from the business server list; S5. The master control server selects two business server nodes in the business server cluster. The two business servers serve as backup servers for each other. The master control server synchronizes the client's login information and signature code to the two business servers and notifies the two business servers of the client's legitimate login request. After the master control server performs step S5, the client of the business server performs login initialization. After the business server obtains the client's login information, it generates the client's token data and sm4 communication key. S6. The master server assigns the business server address information to the client and returns token data and data encryption key to the client; S7. The client stores the login information of two business servers, including the IP address of the business server, the login token data of the business server, and the data encryption SM4 key data; S8. The client performs network speed tests on two business servers and selects one of them to connect to. The network speed test method is to send a heartbeat packet and return the delay to perform the network speed test. When performing the network speed test, the client must send the login token data corresponding to the business server and the data encrypted with the sm4 key. The business server then determines whether the client can log in and connect. S9. The client interacts with business data using the token data and data encryption key returned by the selected business server. At the same time, the client uses the token data and data encryption key generated by another alternative server to notify the alternative server to give up access, so that the alternative server releases the service resources requested by the client's connection. S10. The client uses the token data and data encryption key of the selected business server to interact with the business server and perform normal business operations; S11. Exit the application and end.
2. The method for allocating client access to a low-latency server based on a master control service according to claim 1, characterized in that: In step S1, the client is a PC desktop application or a mobile-based App application.
3. The method for allocating client access to a low-latency server based on a master control service according to claim 1, characterized in that: In step S2, the client and the master server communicate using HTTPS. The data content of the communication message is symmetrically encrypted using an sm4 key randomly generated by the client, and the communication message data is encrypted and protected using the sm2 public key of the master server.
4. The method for allocating client access to a low-latency server based on a master control service according to claim 1, characterized in that: The business server decrypts data and verifies tokens for access requests. For access requests that fail to decrypt multiple times or have abnormal tokens, the IP address is blacklisted.