User access request processing method and device, equipment and storage medium
By analyzing the network protocol address in the user access request and querying the historical access records in the user information, dynamically determining the country code for users' preferences is solved, and the user's terminal frequently accesses inconsistent regional node servers is improved, and the user's access speed and experience is improved.
Patent Information
- Application Number
- CN202510244197.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-03
- Publication Date
- 2025-05-30
AI Technical Summary
The prior art cannot adapt to the dynamic area changes of user terminals, causing users to frequently access node servers that are inconsistent with their area, increase network delay and reduce user experience.
By analyzing the network protocol address in the user's access request, obtaining the current country code, querying the historical access record in the user information, determining the target country code with the most visited volume and its visit proportion, and dynamically selecting the node server for processing based on the current country code's access trend.
Effectively adapt to dynamic regional changes in users' cross-region access, improve user access speed, reduce network latency, and improve user experience.
Smart Images

Figure CN120075781A_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present application relate to the field of computer technologies, and in particular, to a method, apparatus, device, and storage medium for processing user access requests. Background Art
[0002] With the popularization of social networks, instant messaging systems have developed into an important platform for users' daily communication. To meet the communication needs of users in different regions, such systems generally adopt a distributed architecture design. By establishing data centers in multiple geographical regions and constructing service areas deployed with node servers, services with low latency, high reliability, and high scalability are provided. Each time a user terminal accesses an instant messaging system, the system needs to send the user access request to the node server corresponding to the target service area to process the user access request.
[0003] In related technologies, a pre-allocation mechanism based on static information is adopted for processing user access requests. Specifically, when a user completes registration, the system pre-allocates the user to a specific service area according to fixed information such as their mobile phone number, thereby establishing a fixed mapping relationship between the user and the service area. Subsequently, each time the user terminal accesses, the user access request will be fixedly sent to the node server corresponding to the pre-allocated service area for processing. However, when a user has cross-regional behavior and stays for a long time, the above solution will distribute the user access request to the node server corresponding to the fixedly allocated service area, and it cannot adapt to the dynamic regional changes of cross-regional access to select the node server, resulting in the user terminal frequently accessing the node server that is inconsistent with its affiliated area, which is likely to increase network latency and the user experience is poor. Summary of the Invention
[0004] The embodiments of the present application provide a method, apparatus, device, and storage medium for processing user access requests, which solve the problem that related technologies cannot adapt to the dynamic regional changes of the user terminal to select the node server, resulting in the user terminal frequently accessing the node server that is inconsistent with its affiliated area, which is likely to increase network latency and the user experience is poor. It can effectively adapt to the dynamic regional changes of cross-regional access, dynamically determine the user-preferred country code, make the matching degree between the node server accessed by the user and its affiliated area higher, effectively improve the user access speed, reduce network latency, and enhance the user experience.
[0005] In a first aspect, the embodiments of the present application provide a method for processing a user access request, and the method includes:
[0006] When receiving a user access request, parsing the network protocol address in the user access request to obtain the current country code, and querying in a database according to the user identifier in the user access request to obtain user information, where the user information includes historical access records;
[0007] Determine the target country code with the highest traffic volume and the corresponding traffic volume ratio from multiple set country codes according to the historical access record;
[0008] In the case where the traffic volume ratio is less than a set first preset threshold, determine whether the traffic volume of the current country code is on an upward trend according to the historical access record. In the case where the traffic volume of the current country code is on an upward trend, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0009] In a second aspect, an embodiment of the present application further provides a user access request processing device, which includes:
[0010] A current country code determination module, configured to parse the network protocol address in the user access request to obtain the current country code when receiving the user access request;
[0011] A user information determination module, configured to query user information including historical access records in a database according to the user identifier in the user access request;
[0012] A target country code determination module, configured to determine the target country code with the highest traffic volume and the corresponding traffic volume ratio from multiple set country codes according to the historical access record;
[0013] A request processing module, configured to determine whether the traffic volume of the current country code is on an upward trend according to the historical access record in the case where the traffic volume ratio is less than a set first preset threshold. In the case where the traffic volume of the current country code is on an upward trend, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0014] In a third aspect, an embodiment of the present application further provides a user access request processing device, which includes:
[0015] One or more processors;
[0016] A storage device, configured to store one or more programs,
[0017] When the one or more programs are executed by the one or more processors, the one or more processors implement the user access request processing method described in the embodiments of the present application.
[0018] Fourthly, an embodiment of the present application further provides a non-volatile storage medium storing computer-executable instructions, and the computer-executable instructions are configured to execute the user access request processing method described in the embodiments of the present application when executed by a computer processor.
[0019] Fifthly, an embodiment of the present application further provides a computer program product, which includes a computer program stored in a computer-readable storage medium. At least one processor of the device reads and executes the computer program from the computer-readable storage medium, so that the device executes the user access request processing method described in the embodiments of the present application.
[0020] In the embodiments of the present application, when a user access request is received, the network protocol address in the user access request is parsed to obtain the current country code, and user information is queried in the database according to the user identifier in the user access request, where the user information includes historical access records; the target country code with the largest access volume and the corresponding access volume ratio are determined from a plurality of set country codes according to the historical access records; when the access volume ratio is less than a set first preset threshold, it is determined whether the access volume of the current country code is on the rise according to the historical access records. When the access volume of the current country code is on the rise, the user access request is sent to the target node server corresponding to the current country code for the target node server to process the user access request. In the above solution, by parsing the network protocol address in the user access request to obtain the current country code, the service area where the user terminal is currently located can be effectively identified; according to the historical access records, the target country code with the largest access volume and the corresponding access volume ratio are determined from a plurality of set country codes, which can effectively determine the service area where the user is most frequently active recently, and the distribution of the access volume corresponding to the target country code relative to the total access volume; when the access volume ratio is less than the set first preset threshold, it can be considered that the proportion of the target country code most frequently accessed by the user recently relative to the total access volume is low, and the overall distribution of the user-preferred country codes is unstable. Therefore, by combining the historical access records to determine whether the access volume of the current country code is on the rise, if it is on the rise, the user access request is sent to the target node server corresponding to the current country code for processing, which can effectively adapt to the dynamic regional changes of cross-regional access by users, dynamically determine the user-preferred country code, improve the matching degree between the node server accessed by the user and the area to which the user belongs, effectively improve the user access speed, reduce network latency, and enhance the user experience. Description of the Drawings
[0021] Figure 1 It is a flowchart of a user access request processing method provided by an embodiment of the present application;
[0022] Figure 2Flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of determining whether the access volume of the current country code is on an upward trend;
[0023] Figure 3 Flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of sending a user access request to a target node server corresponding to the default country code;
[0024] Figure 4 Flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of sending a user access request to a target node server corresponding to the historical preferred country code;
[0025] Figure 5 Flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of sending a user access request to a target node server corresponding to the target country code;
[0026] Figure 6 Flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of comparing the data migration duration with a preset duration threshold;
[0027] Figure 7 Block diagram of a user access request processing device provided by an embodiment of the present application;
[0028] Figure 8 Structural schematic diagram of a user access request processing device provided by an embodiment of the present application. Detailed implementation manners
[0029] The following further elaborates on the embodiments of the present application in conjunction with the accompanying drawings and embodiments. It can be understood that the specific embodiments described herein are only used to explain the embodiments of the present application, rather than limiting the embodiments of the present application. Additionally, it should be noted that for the sake of description, only parts related to the embodiments of the present application are shown in the accompanying drawings, rather than all structures.
[0030] Terms such as "first" and "second" in the specification and claims of the present application are used to distinguish similar objects, rather than to describe a specific order or sequence. It should be understood that such data can be interchanged under appropriate circumstances, so that the embodiments of the present application can be implemented in an order other than those illustrated or described herein, and the objects distinguished by "first", "second", etc. are generally of the same category, and do not limit the number of objects. For example, the first object can be one or multiple. In addition, "and / or" in the specification and claims means at least one of the connected objects, and the character " / ", generally represents an "or" relationship between the associated objects before and after.
[0031] The user access request processing method provided by the embodiments of this application can adapt to the dynamic regional changes of cross-region user access, dynamically determine the country code preferred by the user, improve the matching degree between the node server accessed by the user and its affiliated region, ensure the user access speed, and optimize the user experience. Related application scenarios may include: instant messaging, online voice, online video, etc. The several application scenarios listed above are only exemplary and explanatory. In actual applications, this user access request processing method may also be used in the processing of user access requests in other scenarios. The embodiments of this application do not limit this. The user access request processing method, device, equipment, and storage medium provided by the embodiments of this application aim to solve the problem that the related technology cannot select a node server according to the dynamic regional changes of the user terminal, resulting in the user terminal frequently accessing a node server inconsistent with its affiliated region, which easily increases network latency and the user experience is poor.
[0032] For the user access request processing method provided by the embodiments of this application, the execution subject of each step may be a computer device, which refers to any electronic device with data calculation, processing, and storage capabilities, such as a server, etc. The embodiments of this application do not limit this.
[0033] Figure 1 It is a flowchart of a user access request processing method provided by the embodiments of this application. As Figure 1 shown, it includes the following steps:
[0034] Step S101: When receiving a user access request, parse the network protocol address in the user access request to obtain the current country code, and query the user information according to the user identifier in the user access request in the database, where the user information includes historical access records.
[0035] Among them, taking the instant messaging application as an example, the user access request may be a request for user data from a node server. The user data may include a friend list, avatar information, basic information, relationship list, etc. The embodiments of this application do not limit this. Parsing the network protocol address in the user access request may be based on the mapping relationship between the network protocol address and the country code provided by an open-source network protocol address library to determine the current country code corresponding to the network protocol address. Specifically, it may be a two- or three-letter code of the ISO (International Organization for Standardization) 3166-1 standard. The historical access records corresponding to different user identifiers are recorded in this database. The historical access records may record all access information of the user terminal within a preset time range. For example, the access information within the most recent 30 days, and the access information may include the country code corresponding to each access.
[0036] Step S102: Determine the target country code with the highest traffic volume and its corresponding traffic volume ratio from multiple set country codes according to the historical access records.
[0037] Among them, since the historical access records record at least one country code accessed by the user terminal within a preset time range, the traffic volume corresponding to each set country code can be statistically calculated accordingly, so as to determine the target country code with the highest traffic volume and determine the service area where the user is most frequently active recently. Moreover, the traffic volume ratio corresponding to the target country code can be statistically calculated to determine whether the distribution of the traffic volume corresponding to the target country code is concentrated relative to the total traffic volume. The larger the traffic volume ratio, the higher the frequency of the target country code appears, the more concentrated the overall distribution of the country codes is, and the more stable the user's country code preference is. The smaller the traffic volume ratio, the lower the frequency of the target country code appears, the more dispersed the overall distribution of the country codes is, and the more unstable the user's country code preference is. In one embodiment, the total traffic volume and the cumulative traffic volumes corresponding to the multiple set country codes can be statistically obtained from the historical access records, the target country code with the highest traffic volume can be determined according to the cumulative traffic volumes corresponding to the multiple country codes, and the traffic volume ratio can be obtained by dividing the cumulative traffic volume corresponding to the target country code by the total traffic volume.
[0038] Step S103: When the traffic volume ratio is less than the set first preset threshold, determine whether the traffic volume of the current country code is on the rise according to the historical access records. When the traffic volume of the current country code is on the rise, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0039] Among them, the first preset threshold can be used to determine whether the proportion of the access volume of the target country code relative to the total access volume is low. If the access volume proportion is less than the first preset threshold, it can be regarded that the access volume of the target country code relative to the total access volume is relatively low, and the overall distribution of the user-preferred country codes is unstable. If the access volume proportion is greater than or equal to the first preset threshold, it can be regarded that the access volume of the target country code relative to the total access volume is relatively high, and other preset thresholds can be further combined to determine whether the proportion of the access volume of the target country code relative to the total access volume is high, so as to determine whether to determine the target country code as the user-preferred country code. Optionally, the first preset threshold can be 60%, which can be specifically estimated by developers based on the cross-region data of users in the actual application scenario, and this application does not make a limit here. Thus, if the access volume proportion is less than the set first preset threshold, it indicates that the overall distribution of the user-preferred country codes is unstable, and the trend analysis of the current country code can be introduced as an auxiliary decision factor to accurately judge the actual needs of the user. Specifically, it is to judge whether the access volume of the current country code is on the rise according to the historical access records. In one embodiment, the access volume of the current country code at multiple consecutive specific time nodes in a recent period can be statistically counted based on the historical access records, and it is judged whether the access volume at these multiple consecutive specific time nodes gradually rises over time, so as to judge whether the access volume of the current country code is on the rise. In one embodiment, the access volume of the current country code in multiple consecutive time intervals in a recent period can be statistically counted based on the historical access records, and it is judged whether the access volume in these multiple consecutive time intervals gradually rises over time, so as to judge whether the access volume of the current country code is on the rise. Of course, other statistical methods for judging the upward trend can also be combined with the historical access records, and this application does not make a limit here. If the access volume of the current country code is on the rise, it can be regarded that the user's access habit gradually focuses on the current country code, and the current country code can be regarded as the user-preferred country code, and the user access request can be sent to the target node server corresponding to the current country code.
[0040] In the above, when receiving a user access request, the network protocol address in the user access request is parsed to obtain the current country code, and the user information is queried in the database according to the user identifier in the user access request, where the user information includes historical access records; the target country code with the largest access volume and the corresponding access volume ratio are determined from the set multiple country codes according to the historical access records; when the access volume ratio is less than the set first preset threshold, it is determined whether the access volume of the current country code is on the rise according to the historical access records. When the access volume of the current country code is on the rise, the user access request is sent to the target node server corresponding to the current country code for the target node server to process the user access request. In the above solution, by parsing the network protocol address in the user access request to obtain the current country code, the service area where the user terminal currently belongs can be effectively identified; by determining the target country code with the largest access volume and the corresponding access volume ratio from the set multiple country codes according to the historical access records, the service area where the user is most frequently active recently and the distribution of the access volume corresponding to the target country code relative to the total access volume can be effectively judged; when the access volume ratio is less than the set first preset threshold, it can be considered that the proportion of the target country code most frequently accessed by the user recently relative to the total access volume is low, and the overall distribution of the country codes preferred by the user is unstable. Therefore, by combining the historical access records to determine whether the access volume of the current country code is on the rise, if it is on the rise, the user access request is sent to the target node server corresponding to the current country code for processing, which can effectively adapt to the dynamic regional changes of cross-region access by users, dynamically determine the country codes preferred by users, make the matching degree between the node server accessed by users and their affiliated regions higher, effectively improve the user access speed, reduce network latency, and enhance the user experience.
[0041] Figure 2 This is a flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of determining whether the access volume of the current country code is on the rise. As Figure 2 shown, it includes the following steps:
[0042] Step S201: When receiving a user access request, parse the network protocol address in the user access request to obtain the current country code, and query the user information in the database according to the user identifier in the user access request, where the user information includes historical access records.
[0043] Step S202: Determine the target country code with the largest access volume and the corresponding access volume ratio from the set multiple country codes according to the historical access records.
[0044] Step S203: When the access volume ratio is less than the set first preset threshold, calculate the moving average access volumes corresponding to multiple time nodes of the current country code within a preset time range according to the historical access records. Based on the moving average access volumes corresponding to multiple time nodes, determine whether the access volume of the current country code is on the rise.
[0045] Among them, the preset time range can be the last 5 days, the last 7 days, etc. The corresponding multiple time nodes can be in days as the time unit. For example, the last 7 days can be set with 7 time nodes. According to the historical access records, the change range and fluctuation direction of the access volume of the current country code can be analyzed, so as to determine whether the access volume of the current country code is on the rise. Taking the last 7 days as an example, the moving average access volume can be based on a certain day, and the access volumes of the past several days are averaged as the access volume of that day to smooth short-term access fluctuations. The specific calculation formula is as follows:
[0046]
[0047] Among them, MA t is the moving average access volume t days ago, n is the moving window size, for example, 7 days, current_cc is the current country code, and AccessCount(t - i, current_cc) is the access count of the current country code t - i days ago. For example, taking t = 0 and n = 7 as an example, the value of t - i ranges from 0 to -6, indicating that based on the current day, the access counts of the current country code in the previous 7 days are averaged to obtain the moving average access volume of the current day.
[0048] In one embodiment, it can be determined whether the moving average access volumes corresponding to multiple time nodes continuously increase over time. If the moving average access volume continuously increases, it can be regarded that the access volume of the current country code is on the rise. If the moving average access volume remains fluctuating around a certain value or continuously decreases, it can be regarded that the access volume of the current country code is not on the rise. In one embodiment, multiple time nodes can be arranged in order from far to near in time, and the differences between the moving average access volumes corresponding to the adjacent subsequent time node and the previous time node are calculated respectively. Calculate the proportion of the positive difference in the moving average access volume. If the proportion meets or exceeds the preset threshold, and the moving average access volume of the time node closest to the current time is larger than that of the time node furthest from the current time, it can be regarded that the access volume of the current country code is on the rise. Otherwise, it is regarded that the access volume of the current country code is not on the rise.
[0049] Step S204: When the access volume of the current country code is on the rise, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0050] Optionally, when the access volume of the current country code is on the rise, the current country code can be determined as the preferred country code and used as reference information for the next determination of the selected country code.
[0051] As described above, by calculating the sliding average access volumes corresponding to multiple time nodes of the current country code within a preset time range, the short-term access fluctuations of the current country code can be effectively smoothed, providing reliable data reference for determining whether the access volume of the current country code is on the rise, which is conducive to accurately judging whether the user access behavior converges to the current country code.
[0052] Figure 3 The figure is a flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of sending a user access request to a target node server corresponding to a default country code. As Figure 3 shown, it includes the following steps:
[0053] Step S301: When receiving a user access request, resolve the network protocol address in the user access request to obtain the current country code, and query the user information according to the user identifier in the user access request in the database, where the user information includes historical access records and a default country code.
[0054] Step S302: Determine the target country code with the largest access volume and the corresponding access volume ratio from the set multiple country codes according to the historical access records.
[0055] Step S303: When the access volume ratio is less than a set first preset threshold, determine whether the access volume of the current country code is on the rise according to the historical access records.
[0056] Step S304: When the access volume of the current country code is on the rise, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0057] Step S305: When the access volume of the current country code is not on the rise, send the user access request to the target node server corresponding to the default country code for the target node server to process the user access request.
[0058] Optionally, when the access volume of the current country code is not on the rise, the current country code can be determined as the preferred country code and used as reference information for the next determination of the selected country code.
[0059] Among them, if the access volume of the current country code is not on an upward trend, it can be considered that the user's access habits are not concentrated on the current country code, indicating that the user's preference selection for the country code is overall unstable. Therefore, the default country code can be directly determined as the country code preferred by the user, and the user access request can be sent to the target node server corresponding to the default country code. The default country code can be the country code assigned based on the user's initial registration.
[0060] As described above, when the access volume of the current country code is not on an upward trend, it can be considered that the user access does not concentrate on the current country code. It is possible to choose to send the user access request to the target node server corresponding to the default country code to reduce the abnormal fluctuation of the country code access.
[0061] Figure 4 It is a flowchart of a user access request processing method provided by an embodiment of the present application, which includes a process of sending a user access request to a target node server corresponding to a historical preferred country code. As Figure 4 shown, it includes the following steps:
[0062] Step S401: When receiving a user access request, resolve the network protocol address in the user access request to obtain the current country code, and query the user information according to the user identifier in the user access request in the database. The user information includes historical access records, default country code, and historical preferred country code.
[0063] Step S402: Determine the target country code with the largest access volume and the corresponding access volume ratio from the set multiple country codes according to the historical access records.
[0064] Step S403: When the access volume ratio is less than the set first preset threshold, determine whether the access volume of the current country code is on an upward trend according to the historical access records. When the access volume of the current country code is on an upward trend, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0065] Step S404: When the access volume ratio is within the preset threshold range and the target country code is the same as the historical preferred country code, send the user access request to the target node server corresponding to the historical preferred country code for the target node server to process the user access request.
[0066] Optionally, when the access volume ratio is within the preset threshold range and the target country code is the same as the historical preferred country code, the historical preferred country code can be determined as the preferred country code as a reference for the next judgment and selection of the country code.
[0067] Step S405: When the access volume ratio is within the preset threshold range and the target country code is different from the historical preferred country code, the user access request is sent to the target node server corresponding to the default country code, so that the target node server processes the user access request.
[0068] Optionally, when the visit volume ratio is within a preset threshold range and the target country code is different from the historical preferred country code, the default country code can be determined as the preferred country code as reference information for determining and selecting a country code next time.
[0069] Among them, the historical preference country code can be the target country code with the most visits and meeting the preset threshold conditions determined according to the previous historical access records, the current country code determined to be on an upward trend, or the default country code. For details, please refer to the judgment process and selection results of the aforementioned embodiment. If the visit volume ratio is in the preset threshold interval, it can be regarded as that the user access is relatively concentrated on the target country code. The preset threshold interval can be 60%-80%, which can be obtained by the developer through statistical estimation based on the user cross-region data of the actual application scenario, and this application is not limited here. In addition, if the target country code is the same as the historical preference country code, it can be regarded as that the country code preferred by the user is relatively stable and still biased towards the historical preference country code. Accordingly, the user access request can be sent to the target node server corresponding to the historical preference country code. If the target country code is different from the historical preference country code, it can be regarded as that the country code preferred by the user is unstable, and the user access request can be sent to the target node server corresponding to the default country code as a transition.
[0070] As mentioned above, when the visit volume ratio is within the preset threshold interval, and the target country code is the same as the historical preference country code, it can be considered that the country code that the user prefers to visit has not changed, and is relatively concentrated on the historical preference country code, and the user access request can be sent to the target node server corresponding to the historical preference country code. In addition, when the visit volume ratio is within the preset threshold interval, and the target country code is different from the historical preference country code, it can be considered that the country code that the user prefers to visit is unstable, and the user access request can be sent to the target node server corresponding to the default country code, and the service area to which the user belongs is dynamically adapted to select the country code.
[0071] Figure 5 A flowchart of a method for processing a user access request including a process of sending a user access request to a target node server corresponding to a target country code is provided in an embodiment of the present application. Figure 5 As shown, the following steps are included:
[0072] Step S501: When receiving a user access request, resolve the network protocol address in the user access request to obtain the current country code, and query the user information in the database according to the user identifier in the user access request, where the user information includes historical access records.
[0073] Step S502: Determine the target country code with the highest access volume and the corresponding access volume ratio from the set multiple country codes according to the historical access records.
[0074] Step S503: When the access volume ratio is less than the set first preset threshold, determine whether the access volume of the current country code is on the rise according to the historical access records. When the access volume of the current country code is on the rise, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0075] Step S504: When the access volume ratio is greater than the set second preset threshold, send the user access request to the target node server corresponding to the target country code for the target node server to process the user access request.
[0076] Optionally, when the access volume ratio is greater than the set second preset threshold, the target country code can be determined as the preferred country code as the reference information for the next judgment of selecting the country code.
[0077] As described above, when the access volume ratio is greater than the set second preset threshold, it can be regarded that the access volume of the target country code is relatively high compared to the total access volume, the user access is concentrated and biased towards the target country code, and the user is frequently active in the service area corresponding to the target country code. By sending the user access request to the target node server corresponding to the target country code, the selection of the node server can be adapted to the concentration of user access to ensure the access quality.
[0078] Figure 6 This is a flowchart of a method for processing user access requests provided by an embodiment of the present application, which includes a comparison process between the data migration duration and the preset duration threshold. As Figure 6 shown, it includes the following steps:
[0079] Step S601: When receiving a user access request, resolve the network protocol address in the user access request to obtain the current country code, and query the user information in the database according to the user identifier in the user access request, where the user information includes historical access records and historical preferred country codes.
[0080] Step S602: Query the data migration duration corresponding to the historical preferred country code. The data migration duration is the cumulative time for migrating the user data corresponding to the user identifier to the node server corresponding to the historical preferred country code.
[0081] Step S603: When the data migration duration is less than or equal to the preset duration threshold, send the user access request to the target node server corresponding to the historical preferred country code for the target node server to process the user access request.
[0082] Step S604: When the data migration duration is greater than the preset duration threshold, determine the target country code with the highest access volume and the corresponding access volume ratio from the set multiple country codes according to the historical access records.
[0083] Among them, when the user's preferred country code changes, the system may trigger a switch in the storage area of the user data, resulting in user data migration. Therefore, the data migration duration corresponding to the historical preferred country code can be queried, and this data migration duration can be compared with the preset duration threshold to determine whether the user data corresponding to the historical preferred country code is in the migration stable period. If the data migration duration is greater than the preset duration threshold, it can be considered that the user data has passed the migration stable period, and the user's preferred country code can be re-determined by combining the historical access records and the current country code. If the data migration duration is less than or equal to the preset duration threshold, it can be considered that the user data is still in the migration stable period, and it is necessary to restrict the switching of the user's preferred country code during the stable period to avoid frequent storage migration operations caused by short-term fluctuations. Optionally, the preset duration threshold can be set to 7 days, and specifically, it can be adaptively adjusted by developers according to the system's data storage settings and user access characteristics in the actual application scenario. This application does not make any limitations here.
[0084] Step S605: When the access volume ratio is less than the set first preset threshold, determine whether the access volume of the current country code is on the rise according to the historical access records. When the access volume of the current country code is on the rise, send the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0085] As described above, by comparing the data migration duration corresponding to the historical preferred country code with the preset duration threshold, it can effectively determine whether the user data is in the migration stable period. When the data migration duration is greater than the preset duration threshold, it can be considered that the user data has passed the migration stable period, and the user's preferred country code can be re-determined. When the data migration duration is less than or equal to the preset duration threshold, the historical preferred country code is continued to be used, which can reduce multiple storage migration operations caused by short-term fluctuations and ensure the stability of the preference selection and system access.
[0086] Figure 7 The following is a structural block diagram of a user access request processing device provided by an embodiment of the present application. The device is configured to execute the user access request processing method provided by the above embodiment, and has corresponding functional modules and beneficial effects for executing the method. As Figure 7 shown, the device includes:
[0087] A current country code determination module 101, configured to parse the network protocol address in the user access request to obtain the current country code when receiving the user access request;
[0088] A user information determination module 102, configured to query the user information according to the user identifier in the user access request in the database, and the user information includes historical access records;
[0089] A target country code determination module 103, configured to determine the target country code with the largest access volume and the corresponding access volume ratio from a plurality of set country codes according to the historical access records;
[0090] A request processing module 104, configured to determine whether the access volume of the current country code is on the rise according to the historical access records when the access volume ratio is less than a set first preset threshold, and send the user access request to the target node server corresponding to the current country code when the access volume of the current country code is on the rise, for the target node server to process the user access request.
[0091] In the above, in the case of receiving a user access request, the network protocol address in the user access request is parsed to obtain the current country code, and the user information is queried in the database according to the user identifier in the user access request, where the user information includes historical access records; the target country code with the largest access volume and the corresponding access volume ratio are determined from the set multiple country codes according to the historical access records; in the case where the access volume ratio is less than the set first preset threshold, it is determined whether the access volume of the current country code is on the rise according to the historical access records, and in the case where the access volume of the current country code is on the rise, the user access request is sent to the target node server corresponding to the current country code for the target node server to process the user access request. In the above solution, by parsing the network protocol address in the user access request to obtain the current country code, the service area where the user terminal currently belongs can be effectively identified; by determining the target country code with the largest access volume and the corresponding access volume ratio from the set multiple country codes according to the historical access records, the service area where the user is most frequently active recently and the distribution of the access volume corresponding to the target country code relative to the total access volume can be effectively judged; in the case where the access volume ratio is less than the set first preset threshold, it can be considered that the proportion of the target country code most frequently accessed by the user recently relative to the total access volume is low, and the overall distribution of the country codes preferred by the user is unstable. Therefore, by combining the historical access records to determine whether the access volume of the current country code is on the rise, if it is on the rise, the user access request is sent to the target node server corresponding to the current country code for processing, which can effectively adapt to the dynamic regional changes of cross-region access by the user, dynamically determine the country code preferred by the user, make the matching degree between the node server accessed by the user and the region to which the user belongs higher, effectively improve the user access speed, reduce network latency, and enhance the user experience.
[0092] In a possible embodiment, the request processing module 104 is further configured to:
[0093] Calculate the sliding average access volume corresponding to each of multiple time nodes within a preset time range for the current country code according to the historical access records;
[0094] Based on the sliding average access volume corresponding to each of the multiple time nodes, determine whether the access volume of the current country code is on the rise.
[0095] In a possible embodiment, the user information further includes a default country code, and the user access request processing device further includes a second request processing module configured to:
[0096] In the case where the access volume of the current country code is not on the rise, send the user access request to the target node server corresponding to the default country code for the target node server to process the user access request.
[0097] In a possible embodiment, the user information further includes a historical preference country code, and the user access request processing device further includes a third request processing module, configured to:
[0098] When the access volume ratio is within a preset threshold range and the target country code is the same as the historical preference country code, send the user access request to the target node server corresponding to the historical preference country code for the target node server to process the user access request.
[0099] In a possible embodiment, the user information further includes a default country code and a historical preference country code, and the user access request processing device further includes a fourth request processing module, configured to:
[0100] When the access volume ratio is within a preset threshold range and the target country code is different from the historical preference country code, send the user access request to the target node server corresponding to the default country code for the target node server to process the user access request.
[0101] In a possible embodiment, the user access request processing device further includes a fifth request processing module, configured to:
[0102] When the access volume ratio is greater than a set second preset threshold, send the user access request to the target node server corresponding to the target country code for the target node server to process the user access request.
[0103] In a possible embodiment, the user information further includes a historical preference country code, and the user access request processing device further includes a migration duration determination module, configured to:
[0104] Query the data migration duration corresponding to the historical preference country code, where the data migration duration is the cumulative time for migrating the user data corresponding to the user identifier to the node server corresponding to the historical preference country code;
[0105] Correspondingly, the target country code determination module 103 is further configured to:
[0106] When the data migration duration is greater than a preset duration threshold, determine the target country code with the largest access volume and the corresponding access volume ratio from a set of multiple country codes according to the historical access records.
[0107] In a possible embodiment, the user access request processing device further includes a sixth request processing module, configured to:
[0108] When the data migration duration is less than or equal to the preset duration threshold, send the user access request to the target node server corresponding to the historical preference country code for the target node server to process the user access request.
[0109] In a possible embodiment, the target country code determination module 103 is configured to:
[0110] Count the historical access records to obtain the total access volume and the cumulative access volumes corresponding to multiple set country codes respectively;
[0111] Determine the target country code with the largest access volume according to the cumulative access volumes corresponding to the multiple country codes;
[0112] Divide the cumulative access volume corresponding to the target country code by the total access volume to obtain the access volume ratio.
[0113] Figure 8 FIG. is a schematic structural diagram of a user access request processing device provided by an embodiment of the present application. As Figure 8 shown, the device includes a processor 201, a memory 202, an input device 203, and an output device 204; the number of processors 201 in the device can be one or more. Figure 8 Here, one processor 201 is taken as an example; the processor 201, the memory 202, the input device 203, and the output device 204 in the device can be connected through a bus or other means. Figure 8 Here, connection through a bus is taken as an example. The memory 202, as a computer-readable storage medium, can be configured to store software programs, computer-executable programs, and modules, such as program instructions / modules corresponding to the user access request processing method in the embodiment of the present application. The processor 201 runs the software programs, instructions, and modules stored in the memory 202, thereby performing various functional applications and data processing of the device, that is, implementing the above-mentioned user access request processing method. The input device 203 can be configured to receive input digital or character information, and generate key signal inputs related to user settings and function controls of the device. The output device 204 can include a display device such as a display screen.
[0114] The embodiment of the present application further provides a non-volatile storage medium including computer-executable instructions, which are configured to execute a user access request processing method described in the above embodiment when executed by a computer processor. The method includes: when receiving a user access request, resolving the network protocol address in the user access request to obtain the current country code, and querying the user information according to the user identifier in the user access request in a database, where the user information includes historical access records; determining the target country code with the largest access volume and the corresponding access volume ratio from a set of multiple country codes according to the historical access records; when the access volume ratio is less than a set first preset threshold, determining whether the access volume of the current country code is on an upward trend according to the historical access records, and when the access volume of the current country code is on an upward trend, sending the user access request to the target node server corresponding to the current country code for the target node server to process the user access request.
[0115] It should be noted that in the embodiments of the above user access request processing device, the included units and modules are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be realized; in addition, the specific names of the functional units are only for easy distinction and are not configured to limit the protection scope of the embodiments of the present application.
[0116] In some possible implementation manners, each aspect of the method provided by the present application can also be implemented in the form of a program product, which includes program code. When the program product runs on a computer device, the program code is configured to enable the computer device to execute the steps in the method according to various exemplary embodiments of the present application described in this specification. For example, the computer device can execute the user access request processing method recorded in the embodiments of the present application. The program product can be implemented by any combination of one or more readable media.
Claims
1. A method for processing a user access request, characterized in that: include: When receiving a user access request, the network protocol address in the user access request is parsed to obtain the current country code, and the user information is obtained by querying the database according to the user identifier in the user access request, wherein the user information includes a historical access record; Determine the target country code with the most visits and the corresponding visit ratio from the set multiple country codes according to the historical access records; When the visit volume ratio is less than the first preset threshold, determine whether the visit volume of the current country code is on an upward trend based on the historical access records. When the visit volume of the current country code is on an upward trend, send the user access request to the target node server corresponding to the current country code, so that the target node server processes the user access request.
2. The method for processing user access requests according to claim 1, characterized in that: The determining, according to the historical access records, whether the access volume of the current country code is on an upward trend includes: Calculate the sliding average visits corresponding to multiple time nodes of the current country code within a preset time range according to the historical visit records; Based on the sliding average visits corresponding to the multiple time nodes, it is determined whether the visit volume of the current country code is in an upward trend.
3. The method for processing user access requests according to claim 1, characterized in that: The user information also includes a default country code, and after determining whether the number of visits of the current country code is on an upward trend according to the historical visit records, further includes: When the access volume of the current country code is not on an upward trend, the user access request is sent to the target node server corresponding to the default country code, so that the target node server processes the user access request.
4. The method for processing user access requests according to claim 1, characterized in that: The user information also includes a historical preferred country code, and after determining the target country code with the most visits and the corresponding visit proportion from the set multiple country codes according to the historical access records, it also includes: When the access volume ratio is within a preset threshold range and the target country code is the same as the historical preference country code, the user access request is sent to the target node server corresponding to the historical preference country code, so that the target node server processes the user access request.
5. The method for processing user access requests according to claim 1, characterized in that: The user information also includes a default country code and a historical preferred country code. After determining whether the number of visits to the current country code is on an upward trend according to the historical visit records, the following is further included: When the access volume ratio is within the preset threshold range and the target country code is different from the historical preferred country code, the user access request is sent to the target node server corresponding to the default country code, so that the target node server processes the user access request.
6. The method for processing user access requests according to claim 1, characterized in that: After determining the target country code with the most visits and the corresponding visit proportion from the set multiple country codes according to the historical access records, the method further includes: When the access volume ratio is greater than a second preset threshold, the user access request is sent to a target node server corresponding to the target country code, so that the target node server processes the user access request.
7. The method for processing user access requests according to claim 1, characterized in that: The user information also includes a historical preferred country code, and before determining the target country code with the most visits and the corresponding visit proportion from the set multiple country codes according to the historical access records, it also includes: Querying the data migration duration corresponding to the historical preference country code, where the data migration duration is the cumulative time for the user data corresponding to the user identifier to be migrated to the node server corresponding to the historical preference country code; Accordingly, determining the target country code with the most visits and the corresponding visit ratio from the set multiple country codes according to the historical access records includes: When the data migration duration is greater than a preset duration threshold, the target country code with the most visits and the corresponding visit proportion are determined from the set multiple country codes according to the historical access records.
8. The method for processing user access requests according to claim 7, characterized in that: After querying the data migration time corresponding to the historical preferred country code, the method further includes: When the data migration duration is less than or equal to the preset duration threshold, the user access request is sent to the target node server corresponding to the historical preference country code, so that the target node server processes the user access request.
9. The method for processing user access requests according to any one of claims 1 to 8, characterized in that: The determining, according to the historical access records, a target country code with the most visits and a corresponding visit ratio from a plurality of set country codes includes: Counting the historical access records to obtain a total number of accesses and cumulative number of accesses corresponding to the multiple country codes set; Determine the target country code with the most visits according to the accumulated visits corresponding to the multiple country codes; The cumulative number of visits corresponding to the target country code is divided by the total number of visits to obtain a visit ratio.
10. A user access request processing device, characterized in that: include: A current country code determination module is configured to, upon receiving a user access request, parse the network protocol address in the user access request to obtain the current country code; A user information determination module, configured to query a database according to a user identifier in the user access request to obtain user information, wherein the user information includes a historical access record; A target country code determination module is configured to determine the target country code with the most visits and the corresponding visit volume ratio from the set multiple country codes according to the historical access records; The request processing module is configured to determine whether the number of visits to the current country code is on an upward trend based on the historical access records when the number of visits is less than a set first preset threshold, and to send the user access request to the target node server corresponding to the current country code when the number of visits to the current country code is on an upward trend, so that the target node server processes the user access request.
11. A user access request processing device, the device comprising: one or more processors; A storage device configured to store one or more programs, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the user access request processing method described in any one of claims 1-9.
12. A non-volatile storage medium storing computer executable instructions, wherein the computer executable instructions are configured to execute the user access request processing method according to any one of claims 1 to 9 when executed by a computer processor.
13. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method for processing user access requests according to any one of claims 1 to 9 is implemented.