Data acquisition load balancing method based on Tomcat abstract authentication

By using Redis to share digest information in Tomcat digest authentication, the problem of uneven load of the collection server under Tomcat digest authentication is solved, and more efficient server resource utilization is achieved.

CN119311412APending Publication Date: 2025-01-14SHANDONG INSPUR ULTRA HD INTELLIGENT TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411360163.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

Tomcat digest authentication requires that two requests be processed by the same server, resulting in uneven IP distribution under the IPHash load balancing strategy, resulting in uneven load on the acquisition server and low resource utilization.

Method used

During the first request, the digest authentication information (Nonce, Opaque) is stored in the Redis cluster. After receiving the 401 status code, the client carries the authentication information and digest information to initiate a second request. The data collection server obtains the digest from Redis. Comparative and authentication of information to achieve load balancing of different servers.

Benefits of technology

Through Redis sharing digest information, digest authentication between different collection servers is realized, allowing two requests to fall on different machines, using polling strategies to solve the load uneven problem, and improving the utilization rate of server resources.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311412A_ABST
    Figure CN119311412A_ABST
Patent Text Reader

Abstract

The invention discloses a data acquisition load balancing method based on Tomcat summary authentication, which is characterized in that a Tomcat summary authentication function is enhanced, summary authentication information (Non, Opaque) is placed in a Redis cluster during a first request, a second request is initiated by the summary information returned by a server side, and the summary authentication function is enhanced. And after receiving the request carrying the authentication information and the summary information, the data acquisition server acquires the summary information from the Redis to perform comparison authentication of the summary information, performs authentication of user information after successful matching, performs processing of acquisition service logic after successful authentication, and returns a data acquisition report result to the client. The method has the beneficial effects that different acquisition servers share the same Redis service data, so that each acquisition server can perform abstract authentication, and two requests in abstract authentication can fall on different machines, so that the problem of non-uniform load of different servers can be solved in a polling manner, and the resource utilization rate of the servers is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of data collection, and in particular to a data collection load balancing method based on Tomcat digest authentication. Background Art

[0002] In the information age, the volume of data is getting bigger and bigger, the concurrency requirements for collection and reporting are getting higher and higher, the concurrency of collection and reporting servers is also getting higher and higher, and the requirements for information security are also getting higher and higher. The reverse proxy load balancing application based on Tomcat digest authentication is becoming more and more widespread. However, Tomcat digest authentication requires that two requests must be processed by the same server. The load balancing strategy used needs to use IPHash to ensure that the requests of the same client fall on the same machine, which causes uneven IP distribution and uneven load on the collection server. In severe cases, some data collection servers are overloaded, while some data collection servers are relatively idle, and server resources cannot be efficiently utilized. Summary of the invention

[0003] In view of the defects in the prior art, the present invention provides a data collection load balancing method based on Tomcat digest authentication to solve the existing problems.

[0004] The present invention is realized by the following technical scheme: a data acquisition load balancing method based on Tomcat digest authentication, characterized in that: the Tomcat digest authentication function is enhanced, by placing the digest authentication information (Nonce, Opaque) in the Redis cluster at the first request, returning to a client along with the 401 status code, after the client receives the 401 status code and the summary information returned by the server, carrying the authentication information (userName, pwd) and the summary information returned by the server, initiating a second request, after the data acquisition server receives the request carrying the authentication information and the summary information, obtaining the summary information from Redis to perform comparison authentication of the summary information, performing authentication of the user information after successful matching, performing processing of the acquisition business logic after successful authentication, and returning the data acquisition reporting result to the client.

[0005] Preferably, the method comprises the following steps: (1) The client initiates a request to the Nginx proxy server for the first time; (2) The Nginx proxy server forwards the request to Tomcat A in the data collection server cluster; (3) Tomcat A detects that there is no authentication information, generates summary information (Nonce, Opaque), stores it in the Redis cluster, and returns it to the client; (4) The client receives the 401 status code and initiates a second request with the authentication information (userName, pwd) and the summary information (Nonce, Opaque) returned by the server; (5) After receiving the request, the Nginx load balancing server forwards the request to Tomcat B in the data acquisition server cluster according to the polling load balancing strategy.

[0006] Preferably, after receiving the request, Tomcat B obtains summary information from the Redis cluster for comparison according to the summary information; after Tomcat B summary information comparison is passed, authentication is performed for verification; after Tomcat B authentication information verification is passed, data collection and reporting business logic processing is performed; after Tomcat B business logic processing is completed, it returns to the client to complete the collection and reporting data processing.

[0007] The beneficial effects of the present invention are as follows: each request is distributed equally to different collection servers, data is reported on the client, and when the first request is initiated, the Nonce and Opaque information generated in the DigestAuthenticator authentication of Tomcat is placed in Redis, and when the second request with authentication information is carried out, it is directly obtained from Redis according to the transmitted Nonce and Opaque, so as to achieve the verification comparison of None and Opaque, and after passing, the user password and other information are authenticated, different collection servers share the same Redis service data, so that each collection server can perform digest authentication, and the two requests in the digest authentication can fall on different machines, and then the problem of uneven load of different servers can be solved by polling, thereby improving the utilization rate of server resources. BRIEF DESCRIPTION OF THE DRAWINGS

[0008] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following is a brief introduction to the drawings required for the specific embodiments or the description of the prior art. In all the drawings, similar elements or parts are generally identified by similar reference numerals. In the drawings, the elements or parts are not necessarily drawn according to the actual scale.

[0009] Figure 1 It is the work flow chart of the present invention. DETAILED DESCRIPTION

[0010] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the following description, many specific details are set forth to facilitate a full understanding of the present invention. However, the present invention can be implemented in many other ways different from those described herein, and those skilled in the art can make similar improvements without violating the connotation of the present invention, so the present invention is not limited by the specific embodiments disclosed below.

[0011] It should be noted that when an element is referred to as being "fixed to" another element, it may be directly on the other element or there may be an intermediate element. When an element is considered to be "connected to" another element, it may be directly connected to the other element or there may be an intermediate element at the same time.

[0012] For ease of description, spatial relative terms such as "upper," "lower," "left," and "right" may be used herein to describe the relationship of one element or feature shown in a figure relative to another element or feature. It should be understood that the spatial terms are intended to include different orientations of the device in use or operation in addition to the orientation shown in the figures. For example, if the device in the figure is inverted, elements described as being "below" other elements or features will be positioned "above" the other elements or features. Thus, the exemplary term "below" may include both upper and lower orientations.

[0013] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art of the present invention. The terms used herein in the specification of the present invention are only for the purpose of describing specific embodiments and are not intended to limit the present invention. The term "and / or" used herein includes any and all combinations of one or more related listed items.

[0014] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation of the present invention is described in detail below in conjunction with specific embodiments: Figure 1The present invention is implemented through the following technical scheme: a data acquisition load balancing method based on Tomcat digest authentication, characterized in that: the Tomcat digest authentication function is enhanced by placing the digest authentication information (Nonce, Opaque) in the Redis cluster during the first request, and returning it to the client along with the 401 status code. After the client receives the 401 status code and the summary information returned by the server, it carries the authentication information (userName, pwd) and the summary information returned by the server, and initiates a second request. After the data acquisition server receives the request carrying the authentication information and the summary information, it obtains the summary information from Redis for comparison authentication of the summary information. After the match is successful, the user information is authenticated. After the authentication is successful, the acquisition business logic is processed, and the data acquisition reporting result is returned to the client.

[0015] A data collection load balancing method based on Tomcat digest authentication includes the following steps: (1) The client initiates a request to the Nginx proxy server for the first time; (2) The Nginx proxy server forwards the request to Tomcat A in the data collection server cluster; (3) Tomcat A detects that there is no authentication information, generates summary information (Nonce, Opaque), stores it in the Redis cluster, and returns it to the client; (4) The client receives the 401 status code and initiates a second request with the authentication information (userName, pwd) and the summary information (Nonce, Opaque) returned by the server; (5) After receiving the request, the Nginx load balancing server forwards the request to Tomcat B in the data acquisition server cluster according to the polling load balancing strategy.

[0016] After Tomcat B receives the request, it obtains summary information from the Redis cluster for comparison based on the summary information; after Tomcat B summary information comparison passes, it performs authentication verification; after Tomcat B authentication information verification passes, it performs data collection and reporting business logic processing; after Tomcat B business logic processing is completed, it returns to the client to complete the data collection and reporting processing.

[0017] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or replace some or all of the technical features therein by equivalents. These modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present invention, and they should all be included in the scope of the claims and specification of the present invention.

Claims

1. A data collection load balancing method based on Tomcat digest authentication, characterized in that: The Tomcat digest authentication function is enhanced by placing the digest authentication information (Nonce, Opaque) in the Redis cluster during the first request, and returning it to the client along with the 401 status code. After the client receives the 401 status code and the digest information returned by the server, it initiates a second request with the authentication information (userName, pwd) and the digest information returned by the server. After receiving the request carrying the authentication information and the digest information, the data collection server obtains the digest information from Redis for comparison and authentication of the summary information. After a successful match, the user information is authenticated. After successful authentication, the collection business logic is processed, and the data collection reporting result is returned to the client.

2. According to claim 1, a data collection load balancing method based on Tomcat digest authentication is characterized in that: The method comprises the following steps: (1) The client initiates a request to the Nginx proxy server for the first time; (2) The Nginx proxy server forwards the request to Tomcat A in the data collection server cluster; (3) Tomcat A detects that there is no authentication information, generates summary information (Nonce, Opaque), stores it in the Redis cluster, and returns it to the client; (4) The client receives the 401 status code and initiates a second request with the authentication information (userName, pwd) and the summary information (Nonce, Opaque) returned by the server; (5) After receiving the request, the Nginx load balancing server forwards the request to Tomcat B in the data acquisition server cluster according to the polling load balancing strategy.

3. According to claim 1, a data collection load balancing method based on Tomcat digest authentication is characterized in that: After receiving the request, Tomcat B obtains summary information from the Redis cluster for comparison according to the summary information; after Tomcat B summary information comparison is passed, authentication is performed for verification; after Tomcat B authentication information verification is passed, data collection and reporting business logic processing is performed; after Tomcat B business logic processing is completed, it returns to the client to complete the collection and reporting data processing.