Serverless proxy node affinity scheduling method and system based on target characteristics

By extracting the target characteristics of proxy requests in the Serverless environment and maintaining their mapping relationship with proxy instances, request affinity scheduling is realized, the contradiction between IP continuity and resource utilization is solved, and the request success rate and system reliability are improved.

CN119865417AInactive Publication Date: 2025-04-22刘宇
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411995759.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-22
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

In the Serverless environment, it is difficult for the prior art to make full use of dynamic resources while ensuring IP continuity, resulting in an increase in resource waste or request failure rate.

Method used

By extracting the target features of the proxy request, maintaining the mapping relationship between the target features and the proxy instance, and realizing the affinity scheduling of the request. The specific steps include receiving proxy requests, extracting target features, querying the mapping table, selecting appropriate proxy instances, and updating the mapping table.

Benefits of technology

It significantly improves the request success rate of IP-sensitive target services, reduces request latency, realizes efficient resource utilization and load balancing, and improves system reliability and fault tolerance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure BDA0005224494740000101
    Figure BDA0005224494740000101
  • Figure BDA0005224494740000151
    Figure BDA0005224494740000151
  • Figure BDA0005224494740000153
    Figure BDA0005224494740000153
Patent Text Reader

Abstract

The invention provides a Serverless proxy node affinity scheduling method and a Serverless proxy node affinity scheduling system based on target characteristics, which are used for solving the problem of unstable proxy service IP (Internet Protocol) under a Serverless architecture. The method is characterized in that the target feature of the proxy request is extracted, the mapping relation between the target feature and the proxy instance is maintained, and the affinity scheduling of the request is realized. The method comprises the following specific steps: receiving a proxy request, extracting a target feature and generating an identifier, querying a mapping table to determine an associated instance, determining whether to select a new instance according to an instance state, and finally routing the request to the selected instance. The system comprises a feature extraction module, a mapping management module, a scheduling decision module and a state monitoring module. The method has the beneficial effects that the request success rate of the target service sensitive to the IP is remarkably improved, the re-authentication times are reduced, the request delay is reduced, and meanwhile, the effective utilization of resources is realized on the basis of ensuring the connection stability.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of network proxy services, and in particular to a proxy node scheduling method and system based on a Serverless architecture. The present invention is mainly applied to network proxy service scenarios where IP continuity needs to be maintained, such as data collection, API proxy, and cross-border access acceleration. Background Art

[0002] Network proxy services play a vital role in modern Internet infrastructure. They are widely used in data collection, API proxy, load balancing, and cross-border access acceleration. With the development of cloud computing technology, especially the rise of Serverless architecture, network proxy services are facing new opportunities and challenges. In this context, how to provide stable and efficient proxy services in a dynamically changing environment has become the focus of the industry.

[0003] Currently, two solutions are mainly used to provide network proxy services: fixed IP pool and dynamic proxy. The fixed IP pool solution provides clients with stable exit IPs by maintaining a set of fixed IP addresses. This method works by assigning client requests to pre-configured proxy servers, each of which has a fixed IP address. The dynamic proxy solution uses a large number of distributed nodes to dynamically assign proxy servers based on load conditions. Its working principle is based on a real-time load balancing algorithm to route requests to the most suitable proxy node.

[0004] However, these solutions all have certain limitations in the Serverless environment. The fixed IP pool solution is difficult to adapt to the elastic characteristics of the Serverless architecture, and it is easy to cause resource waste or insufficient supply. Although the dynamic proxy solution can fully utilize the advantages of Serverless, the frequently changing IP addresses will cause some serious problems. For example, for target services that require IP continuity, frequent changes in IP may trigger their anti-crawler mechanism or security protection, resulting in an increase in the request failure rate. In addition, IP changes may also cause the loss of session status, affecting service quality and user experience.

[0005] To solve the above problems, some studies have proposed a proxy scheduling method based on session persistence. This method attempts to maintain the association between the client and a specific proxy node in a dynamic environment. Although this improves the stability of the connection to a certain extent, there are still many challenges. For example, how to achieve load balancing while ensuring connection stability, and how to deal with node failures and capacity fluctuations, all need further exploration and resolution.

[0006] Therefore, there is an urgent need for a proxy node scheduling method that can ensure IP continuity and fully utilize dynamic resources in a serverless environment. This method should be able to intelligently manage the mapping relationship between requests and proxy instances, and achieve efficient resource utilization while ensuring service quality. Developing such an advanced scheduling system has become a research hotspot and development trend in the field of network proxy services. Summary of the invention

[0007] The purpose of the present invention is to solve the problem of IP instability in network proxy services under the Serverless architecture, especially for those target services that have strict requirements on IP continuity. In addition, the present invention also aims to improve the success rate of proxy services, reduce request latency, and achieve efficient resource utilization and load balancing.

[0008] To achieve the above objectives, the present invention provides a method and system for affinity scheduling of Serverless proxy nodes based on target features, which is characterized by: extracting the target features of proxy requests, maintaining the mapping relationship between target features and proxy instances, and implementing affinity scheduling of requests. In some embodiments, the method can be applied to various scenarios such as web crawlers, API proxies, and cross-border access acceleration.

[0009] Specifically, the method of the present invention includes the following steps: receiving a proxy request; extracting target features from the proxy request and generating a target feature identifier; querying a mapping table to determine a proxy instance associated with the target feature identifier; if an associated proxy instance exists and the instance is in a healthy state, routing the proxy request to the proxy instance; if there is no associated proxy instance or the associated proxy instance is in an unhealthy state, selecting a new proxy instance, updating the mapping table, and routing the proxy request to the new proxy instance.

[0010] Furthermore, the present invention provides a Serverless proxy node affinity scheduling system based on target features, including a feature extraction module, a mapping management module, a scheduling decision module and a status monitoring module. The feature extraction module is used to extract target features from proxy requests and generate target feature identifiers; the mapping management module is used to maintain the mapping relationship between target feature identifiers and proxy instances; the scheduling decision module is used to select appropriate proxy instances according to target feature identifiers; and the status monitoring module is used to monitor the health status of proxy instances.

[0011] Preferably, the target features of the present invention include but are not limited to the domain name, URL pattern, request header features, etc. of the target service. These features can be used alone or in combination to ensure accurate identification of the characteristics of the target service.

[0012] Optionally, the present invention further includes periodically checking the health status of the proxy instance in the mapping table, and removing the relevant mapping of the proxy instance from the mapping table when the proxy instance is detected to be in an unhealthy state. This helps maintain the validity of the mapping table and the stability of the system.

[0013] In one embodiment, the step of selecting a new proxy instance includes obtaining a list of available proxy instances, and selecting an optimal proxy instance from the list of available proxy instances according to a preset optimization strategy. This method ensures that while ensuring affinity, load balancing and resource optimization can also be achieved.

[0014] In some embodiments, the preset optimization strategy considers factors such as the current load, geographical location, and historical performance of the proxy instance. This multi-dimensional evaluation helps to select the most suitable proxy instance and improve the overall service quality.

[0015] In addition, the present invention can also set a time to live (TTL) for each mapping item in the mapping table. When the mapping item's time to live expires, the mapping item is re-evaluated and possibly updated. This mechanism helps to dynamically adjust the mapping relationship and adapt to changes in network environment and service requirements.

[0016] In other embodiments, the present invention may include a load balancing module for achieving balanced distribution of requests while ensuring affinity, which further optimizes the resource utilization and overall performance of the system.

[0017] In a preferred embodiment, the method of the present invention is implemented through a distributed system, which includes a front-end load balancer, a central controller and multiple proxy instances. The front-end load balancer is responsible for receiving and initially distributing requests, the central controller manages mapping tables and scheduling decisions, and the proxy instance performs the actual proxy function.

[0018] In another preferred embodiment, the present invention can be combined with a machine learning algorithm to dynamically optimize scheduling strategies and mapping relationships by analyzing historical data and real-time performance indicators, thereby further improving the intelligence and adaptability of the system.

[0019] By adopting the above scheme, the present invention has the following beneficial effects: 1. Significantly improved the request success rate for IP-sensitive target services and reduced request failures caused by IP changes; 2. Reduced request latency, reduced the number of re-authentication and connection establishment times, and improved user experience; 3. It realizes efficient utilization of resources and achieves dynamic load balancing while ensuring connection stability; 4. Improved system reliability and fault tolerance, able to quickly respond to instance failures and perform automatic switching; 5. Enhanced the flexibility and scalability of the system, able to adapt to different application scenarios and business needs.

[0020] In summary, the present invention provides an innovative Serverless proxy node scheduling method and system, which effectively solves the contradiction between IP stability and resource utilization, brings new technological breakthroughs to the field of network proxy services, and has important practical application value and broad market prospects. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solution of the present invention, the following briefly introduces the drawings required for use in the embodiments. Obviously, the drawings described below are only some embodiments of the present invention, and for those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative work.

[0022] Figure 1 This is a basic flow chart of the Serverless proxy node affinity scheduling method based on target features. It shows the complete process from receiving a request to routing processing, including key steps such as feature extraction, mapping query, health check, and instance selection.

[0023] Figure 2 It is a detailed flowchart of target feature extraction. It describes how to extract and fuse various features from proxy requests, including domain names, URL patterns, request headers, etc., and finally generate a unique target feature identifier.

[0024] Figure 3 It is the overall architecture and workflow diagram of health status monitoring. It shows the data flow from the monitoring agent to the decision module, including data collection, analysis engine and decision process, as well as various optimization strategies.

[0025] Figure 4 It is the overall architecture and workflow diagram of instance selection optimization. It describes how to perform instance scoring, selection, and feedback adjustment based on multiple factors, as well as the application of various optimization techniques.

[0026] Figure 5 It is the overall architecture and workflow diagram of mapping lifecycle management. It shows the creation of mapping, TTL setting, regular inspection and evaluation process, and related optimization mechanisms.

[0027] Figure 6 This is the overall architecture diagram of the Serverless proxy node affinity scheduling system based on target features. It shows the main modules of the system and their interrelationships, including feature extraction, mapping management, scheduling decision, status monitoring, and load balancing.

[0028] Figure 7It is the overall architecture and workflow diagram of the load balancing method. It describes the cyclic process of load monitoring, balancing strategy generation, affinity evaluation and dynamic adjustment, as well as the specific implementation of each link.

[0029] Figure 8 This is an application architecture diagram of the target feature-based Serverless proxy node affinity scheduling method in the web crawler system. It shows how this method is applied to actual web crawler scenarios, including the integration of various core modules and optimization technologies. DETAILED DESCRIPTION

[0030] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0031] In the description of the present invention, it should be noted that the terms "center", "up", "down", "left", "right", "vertical", "horizontal", "inside", "outside" and the like indicate directions or positional relationships based on the directions or positional relationships shown in the accompanying drawings, and are only for the convenience of describing the present invention and simplifying the description, and do not indicate or imply that the device or element referred to must have a specific direction, be constructed and operated in a specific direction, and therefore cannot be understood as a limitation on the present invention.

[0032] Example 1 describes the basic process of the Serverless proxy node affinity scheduling method based on target features.

[0033] Figure 1 The basic process of the target feature-based Serverless proxy node affinity scheduling method according to an embodiment of the present invention is shown. The core innovation of this method is that it realizes the continuous association between requests and processing instances in a dynamically changing Serverless environment through a scheduling strategy driven by target features, thereby solving the IP stability problem.

[0034] like Figure 1 As shown, the method comprises the following steps:

[0035] Step S101: Receive proxy requests. The system receives proxy requests from clients through the front-end interface. These requests may come from various application scenarios, such as web crawlers, API proxies, or cross-border access acceleration.

[0036] Step S102: Extract target features. The system extracts target features from the received proxy request and generates a unique target feature identifier. The target features may include, but are not limited to, the domain name, URL pattern, request header features, etc. of the target service. For example, for a web crawler request, the target feature may be "example.com / products / *", which indicates the product page for the example.com website.

[0037] Step S103: query the mapping table. The system uses the generated target feature identifier to query the mapping table to determine whether there is an agent instance associated with the target feature. The mapping table is a dynamically maintained data structure used to store the association relationship between the target feature and the agent instance.

[0038] Step S104: Determine whether the associated instance exists and is healthy. If the proxy instance associated with the target feature is found in the mapping table, the system will further check the health status of the instance. The health status judgment criteria may include indicators such as the instance's response time, error rate, and resource utilization.

[0039] Step S105: If the associated instance exists and is healthy, the proxy request is routed to the instance. This step ensures the affinity of the request, that is, requests for the same target will be continuously sent to the same proxy instance, thereby maintaining the stability of the IP.

[0040] Step S106: If there is no associated instance or the instance is unhealthy, a new proxy instance is selected. The selection process of the new instance considers multiple factors, including but not limited to current load, geographical location, historical performance, etc. The core of the selection algorithm is to achieve load balancing while ensuring service quality.

[0041] Step S107: Update the mapping table. Associate the newly selected proxy instance with the target feature and update it into the mapping table. This step ensures that the system can "remember" this new association relationship and provide a reference for subsequent requests.

[0042] Step S108: Routing the proxy request to the newly selected instance. After the routing is completed, the system will monitor the execution of this request to timely discover and handle possible problems.

[0043] A key innovation of this embodiment is the introduction of the concept of "soft state". Each mapping entry in the mapping table is set with a time to live (TTL). When the TTL expires, the system will re-evaluate the mapping relationship, which not only ensures the stability of the connection, but also provides an opportunity for load balancing. The specific value of TTL can be dynamically adjusted according to the application scenario, and the typical range is 5 minutes to 24 hours.

[0044] In order to further improve the reliability and performance of the system, this embodiment also adopts the following optimization strategies: 1. Preheating mechanism: The system will pre-create a certain number of proxy instances and keep them on standby to reduce the delay when starting new instances. 2. Batch update: To reduce the impact of frequent small-scale updates on system performance, the update operation of the mapping table will be Batch processing, the typical batch interval is 100ms. 3. Asynchronous health check: The system continuously monitors the health status of all active proxy instances asynchronously without The check is performed on each request, thus reducing the latency of request processing. 4. Intelligent retry: When a request fails, the system will intelligently decide whether to switch to a new generation based on the failure reason. Manage instances instead of simply retrying.

[0045] The method of this embodiment effectively solves the IP stability problem of the proxy service in the Serverless environment through a series of innovative designs.

[0046] It should be noted that the above embodiment is only one of the preferred implementations of the present invention, and those skilled in the art can make various modifications and improvements without departing from the essence of the present invention. For example, the method for extracting target features can be customized according to specific application scenarios, and the storage and query mechanism of the mapping table can adopt different data structures and algorithms to adapt to system requirements of different scales. These changes and improvements should be regarded as falling within the scope of protection of the present invention.

[0047] Example 2, target feature extraction example: describes in detail the method for extracting target features.

[0048] In this embodiment, the target feature extraction method will be described in detail, which is one of the core innovations of the present invention. The accuracy and efficiency of target feature extraction directly affect the performance and reliability of the entire system.

[0049] Figure 2 The detailed process of target feature extraction is shown. As shown in the figure, the target feature extraction process includes the following key steps:

[0050] First, the system receives proxy requests. These requests usually contain rich information, such as target URL, HTTP header, request body, etc. The system needs to extract features from this information that can accurately characterize the characteristics of the target service.

[0051] Next, the system performs a preliminary analysis of the request. This step breaks down the request into multiple components, including but not limited to: protocol type (such as HTTP, HTTPS), host name, path, query parameters, HTTP method (such as GET, POST), request header, and request body.

[0052] Then, the system starts to extract key features. The present invention innovatively proposes a multi-level feature extraction method, including the following levels: 1. Domain name characteristics: The system first extracts the requested host name and performs domain name analysis. For example, for "www.example.com", The system will extract "example.com" as the base domain name. In addition, the system will also consider the subdomains. For example, "api.example.com" might need to be a separate feature. 2. URL pattern characteristics: The system analyzes the path portion of the URL and identifies common patterns. For " / products / 12345" and " / products / 67890", the system will recognize a common pattern such as " / products / *". This pattern recognition uses an improved regular expression matching algorithm, which can significantly improve processing speed while maintaining accuracy. 3. Request header features: The system analyzes HTTP header information and extracts key fields such as User-Agent, Accept, Authorization, etc. In particular, the system will conduct an in-depth analysis of the User-Agent to identify the client type (such as browser, mobile device, crawler, etc.). 4. Request body features: For methods such as POST and PUT that contain a request body, the system will analyze the structure and content of the request body and extract key fields or patterns. 5. Behavioral characteristics: The system also considers behavioral characteristics such as time patterns and frequency of requests, which help distinguish different types of clients or application scenarios.

[0053] After extracting these features, the system uses an innovative feature fusion algorithm to generate the final target feature identifier. The core idea of ​​this algorithm is to assign different weights to different types of features and use a hash function to combine these features into a unique identifier. Specifically, the algorithm uses the following formula: TargetID=Hash(w 1 *f 1 +w 2 *f 2 +...+w n *fn ) (1)

[0054] Among them, f i represents the i-th feature, w i is the corresponding weight, and Hash is an appropriately selected hash function. The selection of weights is based on a large amount of experimental data. Usually, domain name features have the highest weight, followed by URL pattern features.

[0055] A key innovation of this feature extraction and fusion method is its adaptability. The system continuously monitors the effect of feature extraction and dynamically adjusts the feature weights based on the actual situation. For example, if it is found that some websites rely more on URL patterns than domain names to distinguish different services, the system will automatically increase the weight of the URL pattern feature.

[0056] In order to improve the efficiency of feature extraction, the present invention also adopts the following optimization strategy: 1. Cache mechanism: The system caches the feature extraction results of recently processed requests. For repeated or similar requests, the results can be directly reused, greatly reducing computing overhead. 2. Parallel processing: For complex requests, the system will process different types of feature extraction in parallel, taking full advantage of multi-core processors. 3. Incremental update: For long connections or continuous requests, the system only needs to process the changed parts instead of recalculating all features every time.

[0057] It should be noted that, although the present embodiment describes a specific feature extraction method in detail, the protection scope of the present invention is not limited thereto. Those skilled in the art can adjust and optimize the feature extraction method according to specific application scenarios and technological developments. For example, a machine learning algorithm can be introduced to further improve the accuracy and adaptability of feature extraction, or a special feature extraction module can be developed for a specific type of application (such as financial transactions, real-time streaming media, etc.). These changes and improvements should all be considered to fall within the protection scope of the present invention.

[0058] This embodiment is closely connected to the previous one and provides key input for the entire Serverless proxy node affinity scheduling method. Through precise target feature extraction, the system can more accurately identify and classify different requests, thus providing a solid foundation for subsequent scheduling decisions. This high-precision feature extraction directly improves the performance and reliability of the entire system and is a key link in achieving IP stability and efficient resource utilization.

[0059] Example 3, health status monitoring example: describes the monitoring mechanism of the health status of the proxy instance.

[0060] This embodiment elaborates on the proxy instance health status monitoring mechanism, which is a key link to ensure system reliability and performance. Health status monitoring not only affects the processing quality of a single request, but is also directly related to the stability and resource utilization efficiency of the entire system.

[0061] Figure 3 The overall architecture and workflow of health status monitoring are shown. As shown in the figure, the health status monitoring system includes the following core components: monitoring agent, data collector, analysis engine and decision module.

[0062] The monitoring agent is a lightweight program deployed on each agent instance. It is responsible for collecting various performance indicators and operating status of the instance. These indicators include but are not limited to: CPU usage, memory usage, network throughput, disk I / O, request response time, error rate, etc. The monitoring agent uses innovative adaptive sampling technology, which can dynamically adjust the sampling frequency according to the load of the instance, minimizing the monitoring overhead while ensuring data accuracy.

[0063] The data collector is a centralized component responsible for aggregating data from all monitoring agents. It uses an efficient data compression algorithm and batch transmission mechanism to greatly reduce network overhead. In addition, the data collector also implements data integrity verification to ensure that the collected information is accurate and reliable.

[0064] The analysis engine is one of the core innovations of this system. It uses a multi-level analysis method, including real-time analysis and historical trend analysis. Real-time analysis uses sliding time window technology to quickly detect performance anomalies. Historical trend analysis uses machine learning algorithms, such as time series analysis and anomaly detection models, to predict potential performance problems. The core algorithm of the analysis engine can be expressed as: H(t)=α·R(t)+(1-α)·T(t) (2)

[0065] Among them, H(t) is the health score at time t, R(t) is the weighted sum of real-time performance indicators, T(t) is the trend prediction value based on historical data, and α is the weight factor that balances the real-time status and historical trend.

[0066] The decision module makes a judgment on the health status of each proxy instance based on the output of the analysis engine. It adopts an innovative multi-threshold mechanism, which not only divides the instance status into "healthy" and "unhealthy", but also introduces intermediate states such as "warning" and "recovering". This fine-grained state division enables the system to manage instances more flexibly, such as reducing the allocation of new requests to instances in the "warning" state instead of immediately marking them as unhealthy.

[0067] A key innovation of the health status monitoring system is its proactive health management strategy. When instance performance degradation is detected, the system attempts to take a series of automatic repair measures, such as restarting specific services, cleaning caches, adjusting configuration parameters, etc. This strategy significantly improves the system's self-healing capabilities and reduces the need for manual intervention.

[0068] In order to further improve the efficiency and accuracy of monitoring, this system also adopts the following optimization technologies: 1. Distributed tracing: By injecting tracing points at each stage of request processing, the system can accurately locate performance bottlenecks and error sources. 2. Intelligent alarm: The system uses machine learning algorithms to cluster and correlate alarms, reduce duplicate alarms, and provide more valuable problem diagnosis information. 3. Load awareness: The monitoring system will dynamically adjust the health threshold of a single instance based on the load of the entire cluster, and appropriately relax the standards under high load conditions to avoid frequent switching caused by over-sensitivity. 4. Context-awareness: The system considers the impact of request characteristics (such as real-time requirements and importance) when determining the health status of an instance, and provides differentiated health management strategies for different types of services.

[0069] It should be noted that although this embodiment describes a specific health status monitoring method in detail, the scope of protection of the present invention is not limited to this. Those skilled in the art can adjust and expand the monitoring system according to specific needs and technological advances. For example, more external data sources (such as network conditions, data center environmental parameters, etc.) can be integrated to enhance the comprehensiveness of monitoring, or more complex artificial intelligence algorithms can be introduced to improve the accuracy of prediction. These changes and improvements should be regarded as falling within the scope of protection of the present invention.

[0070] This embodiment forms an organic whole with the previous two embodiments. Through accurate health status monitoring, the system can promptly identify and handle potential problems, providing a reliable execution environment for scheduling decisions based on target features. This efficient health management mechanism not only improves the processing quality of a single request, but also significantly enhances the stability and reliability of the entire system, and is a key support for achieving high-performance Serverless proxy services.

[0071] Embodiment 4, embodiment for optimizing instance selection: describes in detail the optimization strategy for selecting a new instance.

[0072] This embodiment describes in detail the instance selection optimization method, which is one of the core innovations of the present invention. In a serverless environment, how to achieve load balancing and resource optimization while ensuring request affinity is a complex challenge. This embodiment proposes a multi-dimensional, adaptive instance selection algorithm to effectively solve this problem.

[0073] Figure 4 The overall architecture and workflow of instance selection optimization are shown. As shown in the figure, the instance selection process includes key steps such as obtaining a list of available instances, multi-factor scoring, optimization selection, and feedback adjustment.

[0074] First, the system needs to obtain a list of currently available proxy instances. This process involves real-time communication with the resource management system to obtain information including instance ID, current load, geographic location, hardware configuration, etc. In order to improve efficiency, the system adopts an innovative hierarchical caching mechanism, which divides instance information into two categories according to the update frequency: fast-changing (such as load) and slow-changing (such as hardware configuration), and adopts different caching strategies for each.

[0075] Next is the multi-factor scoring stage, which is the core of this algorithm. The system considers key factors such as load balancing, geographic location, historical performance, resource matching, and network conditions. These factors are comprehensively scored through an innovative adaptive weight model. The scoring function can be expressed as:

[0076] Among them, Score(i) is the comprehensive score of instance i, f j (i) is the scoring function of the jth factor for instance i, w j is the corresponding weight. The key innovation is that w j It is adjusted dynamically. The system continuously analyzes historical data through machine learning algorithms to optimize the weight distribution of various factors.

[0077] The improved greedy algorithm is used in the optimization selection stage. The traditional greedy algorithm may lead to a local optimal solution. For this reason, this algorithm introduces an "exploration factor". Specifically, the algorithm will select non-highest-scoring instances with a certain probability to explore potential better solutions. This strategy improves the adaptability and robustness of the system while ensuring performance.

[0078] Feedback adjustment is the key to ensure the long-term efficient operation of the system. The system continuously monitors the results of each selection, including indicators such as request processing time, success rate, and resource utilization. This data is used to adjust the scoring function and weight model. For example, if it is found that the weight of a factor is too high and causes performance fluctuations, the system will automatically reduce the weight of the factor.

[0079] In order to further improve the efficiency and accuracy of selection, this system also uses optimization technologies such as predictive selection, affinity balancing, fault perception and resource reservation. Predictive selection uses time series analysis to predict short-term load changes, considers the prediction results when selecting, and avoids selecting instances that may be overloaded soon. Affinity balancing attempts to assign requests with similar characteristics to the same instance while ensuring request affinity, improving cache hit rate and processing efficiency. The fault perception mechanism quickly identifies and isolates instances with abnormal performance to prevent requests from being assigned to nodes that may be about to fail. Resource reservation reserves a certain proportion of resources for key services to ensure that the performance of core services can still be guaranteed under high load conditions.

[0080] It should be emphasized that although this embodiment describes in detail a specific instance selection optimization method, the scope of protection of the present invention is not limited thereto. Those skilled in the art can adjust and expand the algorithm according to specific application scenarios and technological advances. For example, a more complex reinforcement learning model can be introduced to optimize long-term performance, or edge computing nodes can be integrated to process requests with low latency requirements. These changes and improvements should be considered to fall within the scope of protection of the present invention.

[0081] This embodiment is closely linked to the previous three embodiments, forming a complete technical chain. Through precise target feature extraction (Example 2) and reliable health status monitoring (Example 3), the instance selection optimization algorithm of this embodiment can make more accurate and efficient decisions. This multi-dimensional, adaptive selection strategy not only ensures the processing quality of a single request, but also significantly improves the performance and resource utilization efficiency of the entire system. It is the core pillar for achieving high-performance, high-reliability Serverless proxy services.

[0082] Embodiment 5, mapping life cycle management embodiment: describes the life cycle management method of the mapping items in the mapping table.

[0083] This embodiment elaborates on the mapping lifecycle management method, which is a key innovation to ensure the long-term and efficient operation of the system. In a serverless environment, the mapping relationship between requests and instances needs to be dynamically managed to adapt to the ever-changing network environment and business needs. This embodiment proposes an adaptive mapping lifecycle management strategy that effectively balances connection stability and system flexibility.

[0084] Figure 5 The overall architecture and workflow of mapping lifecycle management are shown. As shown in the figure, mapping lifecycle management includes key steps such as mapping creation, TTL setting, regular inspection, update or cleanup.

[0085] First, when the system receives a new proxy request, a new mapping entry is created. This mapping entry contains information such as the target feature identifier, the selected proxy instance ID, and the creation timestamp. The creation process uses an efficient concurrency control mechanism to ensure consistency and performance under high concurrency conditions.

[0086] Next, the system will set a TTL (Time To Live) for the newly created mapping item. The TTL setting is a core innovation of this method. It uses a dynamic adaptive algorithm to determine the optimal TTL value based on multiple factors. The TTL calculation formula is as follows: TTL=T base ·f load ·f stability ·f pattern (4)

[0087] Among them, T base It is the basic TTL value, usually set to 5 minutes to 1 hour. load is the load factor, which reflects the overall load status of the current system. stability is a stability factor that takes into account the characteristics of the target service and the historical connection stability. pattern It is the request mode factor, which analyzes the time distribution characteristics of the request. This multi-factor dynamic TTL setting method can automatically adjust in different scenarios, which not only ensures the stability of the connection, but also avoids the long-term occupation of resources.

[0088] The system will periodically check whether the items in the mapping table are expired. This checking process uses an innovative hierarchical scanning algorithm, which divides the mapping items into multiple levels according to the length of TTL and uses different scanning frequencies for different levels. This method greatly reduces the scanning overhead while ensuring timeliness.

[0089] When a mapping item is close to expiration, the system will start the evaluation process. The evaluation will take into account the following factors: the performance of the current mapping, the overall system load, changes in the characteristics of the target service, etc. Based on the evaluation results, the system may take one of the following actions: 1. Extend TTL: If the current mapping performs well and the system load allows, the TTL can be appropriately extended. 2. Update mapping: If a better instance is found, the system will smoothly migrate the request to the new instance and reset the TTL. 3. Clean up the mapping: If the mapping has not been used for a long time or has poor performance, the system will clean it up to release resources.

[0090] To further optimize mapping lifecycle management, the system also uses the following innovative technologies: 1. Preheating mechanism: The system predicts the mappings that may be needed soon, creates them in advance and keeps them in a "standby" state to reduce cold start delays. 2. Batch processing: The system packages multiple mapping items that are about to expire at the same time for processing to improve efficiency. 3. Asynchronous update: Mapping updates and cleanup operations are performed asynchronously to avoid affecting requests being processed. 4. Version control: Each mapping item has a version number to ensure consistency during concurrent updates.

[0091] The mapping lifecycle management method of this embodiment is closely related to the above-mentioned embodiment. It uses the target feature extraction result in embodiment 2 as the mapping key, combines the health status monitoring information in embodiment 3 to evaluate the effectiveness of the mapping, and provides an important reference for the instance selection optimization in embodiment 4. This multi-dimensional collaboration ensures the efficient operation of the entire system.

[0092] It should be emphasized that, although the present embodiment describes a specific mapping lifecycle management method in detail, the protection scope of the present invention is not limited thereto. Those skilled in the art can adjust and expand the method according to specific application scenarios and technological advances. For example, a more complex machine learning model can be introduced to predict the optimal TTL value, or a more fine-grained mapping state transition mechanism can be designed. These changes and improvements should all be considered to fall within the protection scope of the present invention.

[0093] The adaptive mapping lifecycle management method proposed in this embodiment is a key link in achieving high-performance and high-reliability Serverless proxy services. It significantly improves the resource utilization and adaptability of the system while ensuring the quality of service. By working closely with other embodiments, this method provides a flexible and stable operating foundation for the entire system and effectively responds to various challenges in the Serverless environment.

[0094] Example 6, system architecture example: details the structure of the Serverless proxy node affinity scheduling system based on target features.

[0095] This embodiment describes in detail the overall architecture and core components of the Serverless proxy node affinity scheduling system based on target features. The system is an integrated implementation of the methods and technologies described in all the previous embodiments, aiming to provide a comprehensive, efficient, and reliable Serverless proxy service solution.

[0096] Figure 6The overall architecture of this system is shown. As shown in the figure, the system mainly includes the following core modules: feature extraction module, mapping management module, scheduling decision module, status monitoring module and load balancing module. These modules cooperate with each other through carefully designed interfaces and data flows to form a highly integrated system.

[0097] The feature extraction module is the entrance of the system, responsible for extracting target features from proxy requests and generating unique identifiers. This module implements the multi-level feature extraction method described in Example 2. It first parses the request, extracts information such as domain name, URL mode, request header, and then uses an adaptive weight algorithm to generate the final feature identifier. In order to improve processing efficiency, this module uses parallel processing and caching mechanisms, which can complete feature extraction within milliseconds.

[0098] The mapping management module is the core data storage and management unit of the system, which implements the mapping lifecycle management method described in Example 5. It maintains an efficient mapping table that stores the association between target features and proxy instances. The module uses an innovative hierarchical storage structure to store hot data in memory and cold data in persistent storage. This design greatly improves query efficiency while ensuring data persistence and reliability. The mapping management module also implements mechanisms such as dynamic TTL setting, regular cleanup, and version control to ensure the timeliness and consistency of mapping data.

[0099] The scheduling decision module is responsible for selecting the most appropriate proxy instance for each request. It implements the multi-dimensional, adaptive instance selection algorithm described in Example 4. The module first queries the mapping table and uses it directly if a valid mapping is found; otherwise, it starts the instance selection process. The selection process takes into account multiple factors such as load balancing, geographic location, and historical performance, and uses a dynamic weight model to calculate the score of each available instance. In order to improve the accuracy and adaptability of decisions, the module also integrates a machine learning algorithm that can dynamically adjust the decision strategy based on historical data.

[0100] The status monitoring module is responsible for real-time monitoring of the health status and performance indicators of all agent instances in the system. It implements the health status monitoring mechanism described in Example 3. This module adopts a distributed architecture, deploys a lightweight monitoring agent on each agent instance, and collects key indicators such as CPU usage, memory usage, and network throughput. These data are sent to the central analysis engine in real time through an efficient data compression and transmission mechanism. The analysis engine uses a multi-level analysis method, including real-time anomaly detection and long-term trend analysis, to promptly identify potential performance problems and failure risks.

[0101] The load balancing module is a key component for optimizing system performance. It works closely with the scheduling decision module to achieve overall system load balancing while ensuring request affinity. The module implements an innovative "soft balancing" strategy, which allows moderate load transfer while maintaining a certain degree of affinity. It achieves a balance between micro-affinity and macro-balance by analyzing the system load distribution in real time and dynamically adjusting the weight of instance selection.

[0102] The system also includes a central controller that coordinates the work of each module and manages the overall configuration. The controller provides a web interface that allows administrators to monitor system status, adjust parameters, view performance reports, etc. in real time. In addition, the controller also implements automated operation and maintenance functions, such as automatic expansion and contraction, fault self-healing, etc., greatly reducing the need for manual intervention.

[0103] An important innovation of this system is its high scalability and adaptability. Through modular design and standardized interfaces, the system can easily integrate new functional modules or replace existing modules. For example, a specialized security module can be added to enhance the security of the system, or an optimized module for a specific field can be integrated to meet the needs of special application scenarios.

[0104] It should be emphasized that, although the present embodiment describes the specific architecture and components of the system in detail, the protection scope of the present invention is not limited thereto. Those skilled in the art can adjust and expand the system structure according to actual needs, such as adding more monitoring dimensions, introducing more complex scheduling algorithms, or designing new load balancing strategies. These changes and improvements should be regarded as falling within the protection scope of the present invention.

[0105] The system architecture described in this embodiment is a comprehensive embodiment of all the above methods and technologies. It realizes efficient, reliable and flexible Serverless proxy service through the organic combination of various modules. This system not only solves the IP stability and resource utilization problems faced by traditional proxy services in the Serverless environment, but also provides a solid foundation for future technological evolution and application expansion.

[0106] Example 7, load balancing example: describes a method for achieving load balancing while ensuring affinity.

[0107] This example describes in detail an innovative method for achieving load balancing while ensuring affinity. This method cleverly solves two seemingly contradictory requirements faced by proxy services in a Serverless environment: maintaining connection stability and optimizing resource utilization. By introducing a dynamic balancing mechanism, this method achieves an organic unity of micro-affinity and macro-balance.

[0108] Figure 7The overall architecture and workflow of this load balancing method are shown. As shown in the figure, this method mainly includes four key links: load monitoring, balancing strategy generation, affinity evaluation, and dynamic adjustment. These links interact with each other through a carefully designed feedback loop to form an adaptive balancing system.

[0109] Load monitoring is the foundation of the entire method. The system collects load metrics of each proxy instance in real time, including CPU usage, memory usage, network throughput, number of active connections, etc. In order to ensure the real-time and accuracy of monitoring, the system adopts innovative distributed sampling technology. The lightweight monitoring agent deployed on each instance will dynamically adjust the sampling frequency according to the load situation, increase the sampling frequency when the load is high, and reduce the frequency when the load is low, thereby minimizing the monitoring overhead while ensuring data accuracy.

[0110] The core innovation of this method is the generation of balancing strategies. Based on the collected load data, the system uses machine learning algorithms to generate the optimal load distribution strategy. This process can be expressed as an optimization problem:

[0111] Where x represents the load distribution strategy, L i (x) represents the expected load of the i-th instance under strategy x, is the target average load. This optimization problem is solved by an improved gradient descent algorithm, which can produce the optimal strategy within milliseconds.

[0112] The affinity evaluation phase ensures that load balancing does not excessively affect the stability of the connection. The system calculates an affinity score for each connection, taking into account factors such as connection duration, request frequency, session status, etc. The affinity score is calculated as follows: A=w t f(t)+w f g(f)+w s ·h(s) (6)

[0113] Among them, f(t), g(f) and h(s) are functions of connection time, frequency and state respectively, and w t 、w f and w s is the corresponding weight.

[0114] The dynamic adjustment link combines the balancing strategy with the affinity evaluation results to achieve "soft balancing". The system does not perform load balancing mechanically, but dynamically adjusts the degree of balancing based on the affinity score. Specifically, the system defines an adjustment coefficient α:

[0115] Among them, A is the affinity score, A0 is the threshold, and k controls the steepness of the curve. The larger the α value, the more inclined to maintain the original connection; the smaller the α value, the more inclined to load balancing.

[0116] This method also introduces an innovative predictive balancing mechanism. The system uses time series analysis to predict load changes in the future and incorporates the prediction results into the generation process of the balancing strategy. This forward-looking method can effectively prevent the occurrence of load spikes and maintain system stability.

[0117] In order to further improve the adaptability and robustness of the system, this method also uses the following optimization techniques:

[0118] Gradual migration: When load balancing is required, the system does not immediately cut off existing connections. Instead, it adopts a gradual approach to gradually direct new requests to the target instance, minimizing the impact on existing connections.

[0119] Elastic threshold: The system dynamically adjusts the trigger threshold of load balancing to tolerate greater load imbalance under high pressure to reduce the overhead caused by frequent adjustments.

[0120] Anomaly detection: The system can identify and isolate abnormal load patterns, preventing unnecessary global balancing caused by a single abnormal instance.

[0121] The load balancing method described in this embodiment is closely related to the previous embodiment. It uses the health status monitoring data in embodiment 3 as an important input for load evaluation, combines the instance selection optimization algorithm in embodiment 4 to perform actual load adjustment, and works in conjunction with the mapping lifecycle management in embodiment 5 to ensure that the load balancing operation does not destroy the long-term connection stability.

[0122] It should be emphasized that although this embodiment describes a specific load balancing method in detail, the protection scope of the present invention is not limited thereto. Those skilled in the art can adjust and expand the method according to specific application scenarios and technological advances. For example, a more complex machine learning model can be introduced to optimize load prediction, or a balancing strategy in a specific field can be designed to meet special application requirements. These changes and improvements should be considered to fall within the scope of protection of the present invention.

[0123] The load balancing method proposed in this embodiment is a key link in achieving high-performance and high-reliability Serverless proxy services. It cleverly solves the contradiction between connection stability and resource utilization, and provides a flexible and efficient operating basis for the entire system. By working closely with other embodiments, this method significantly improves the overall performance and adaptability of the system, and effectively responds to various challenges in the Serverless environment.

[0124] Example 8, comprehensive application example: describes the application of the method and system in actual scenarios.

[0125] This embodiment elaborates on the comprehensive application of the Serverless proxy node affinity scheduling method and system based on target features in actual application scenarios. Through a specific web crawler application case, it shows how the present invention can effectively solve the IP stability problem in the Serverless environment, while achieving efficient resource utilization and load balancing.

[0126] Figure 8 The application architecture of this method in the web crawler system is shown. As shown in the figure, the whole system includes three main parts: crawler client, Serverless proxy service and target website. Serverless proxy service is the core of this invention. It acts as an intermediary between the crawler client and the target website and is responsible for processing and forwarding requests.

[0127] In this application scenario, the crawler client needs to frequently access the target website, but the target website has strict restrictions on the frequency of requests from the same IP. Traditional fixed IP proxies are easily blocked by the target website, and simple dynamic IP proxies may cause session state loss due to frequent IP changes, affecting crawling efficiency. The present invention cleverly solves this problem through intelligent affinity scheduling.

[0128] The workflow is as follows: 1. The crawler client initiates a request. Each request contains the target URL and other necessary HTTP header information. 2. The request first enters the feature extraction module. This module uses the method described in Example 2 to extract the domain name and path pattern from the URL, extract key fields from the HTTP header, and generate a unique target feature identifier. For example, for the request "https: / / example.com / products / 1234", the feature identifier that may be generated is "example.com_products_*". 3. The mapping management module receives the feature identifier and queries the current mapping table. If a valid mapping exists, the corresponding proxy instance is directly returned; otherwise, the instance selection process is triggered. 4. The instance selection process is performed by the scheduling decision module. It comprehensively considers factors such as the load of the currently available instances, geographical location, historical performance, etc., and selects the optimal proxy instance. The multi-factor scoring algorithm described in Example 4 is used here. 5. The status monitoring module continuously monitors the health status of all active proxy instances. If it detects that the instance performance has degraded or failed, it will immediately notify the scheduling decision module to make adjustments. 6. The load balancing module achieves overall load balancing of the system by dynamically adjusting the instance selection weight while ensuring request affinity. The "soft balancing" strategy described in Example 7 is adopted here. 7. The selected proxy instance processes the request, forwards it to the target website, and then returns the response to the crawler client. 8. The mapping lifecycle management module regularly checks and updates the mapping table, and dynamically adjusts the TTL according to the method described in Example 5 to ensure the timeliness of the mapping and the flexibility of the system.

[0129] A key innovation of this method is the adaptive request allocation strategy. The system dynamically adjusts the request frequency and pattern of a single proxy instance by learning the anti-crawling strategy of the target website. For example, if the target website is found to be particularly sensitive to a large number of requests from the same IP in a short period of time, the system will automatically increase the number of proxy instances and reduce the request frequency of each instance. This strategy can be expressed as:

[0130] Among them, F i is the request frequency assigned to the i-th instance, R total is the total request rate, N is the number of instances, S i is the performance score of instance i, F max is the maximum safe request frequency for a single instance.

[0131] In order to further improve the efficiency and reliability of the system, this method also uses the following optimization techniques:

[0132] Smart retry: When a request fails, the system analyzes the cause of the failure and decides whether to continue to retry using the current instance or switch to a new instance. This greatly improves the success rate of requests.

[0133] Session persistence: For crawler tasks that need to maintain session status, the system will prioritize routing requests for the same session to the same proxy instance to ensure state continuity.

[0134] Automatic scaling: The system automatically adjusts the number of proxy instances based on the overall load, optimizing resource utilization while ensuring performance.

[0135] Anomaly detection: The system can identify and isolate abnormal crawler behaviors to prevent a single misconfigured crawler task from affecting the stability of the overall system.

[0136] It should be emphasized that although this embodiment takes a web crawler as an example, the application scope of the present invention is far from limited to this. The same method and system can be applied to various scenarios such as API proxy, cross-border access acceleration, load balancing, etc. that require stable IP and efficient use of Serverless resources. Those skilled in the art can make appropriate adjustments and optimizations to the system according to specific application requirements, such as designing special feature extraction algorithms for specific types of applications, or introducing more complex machine learning models to optimize scheduling strategies. These changes and improvements should be regarded as falling within the scope of protection of the present invention.

[0137] This embodiment comprehensively demonstrates the comprehensive application of the methods and techniques described in all the above embodiments through a specific application case. It not only proves the effectiveness of the present invention in solving practical problems, but also demonstrates the flexibility and scalability of the system. Through intelligent affinity scheduling and dynamic load balancing, the present invention provides a comprehensive, efficient and reliable solution for proxy services in a Serverless environment, opening up a new direction for the development of related technologies.

Claims

1. A Serverless proxy node affinity scheduling method based on target features, characterized in that: The following steps are involved: (a) receiving a proxy request; (b) extracting target features from the proxy request and generating a target feature identifier; (c) querying a mapping table to determine an agent instance associated with the target feature identifier; (d) if there is an associated proxy instance and the instance is in a healthy state, routing the proxy request to the proxy instance; (e) If the associated proxy instance does not exist or the associated proxy instance is in an unhealthy state, a new proxy instance is selected, the mapping table is updated, and the proxy request is routed to the new proxy instance.

2. The method according to claim 1, characterized in that The target features include one or more of the following: domain name, URL pattern, and request header features of the target service.

3. The method according to claim 1, characterized in that The following steps are also included: (a) periodically checking the health status of the proxy instances in the mapping table; (b) When it is detected that the proxy instance is in an unhealthy state, remove the relevant mapping of the proxy instance from the mapping table.

4. The method according to claim 1, characterized in that: The steps to select a new proxy instance include: (a) Get a list of available proxy instances; (b) Selecting the optimal proxy instance from the list of available proxy instances according to a preset optimization strategy.

5. The method according to claim 4, characterized in that The preset optimization strategy considers one or more of the following factors: current load, geographic location, and historical performance of the proxy instance.

6. The method according to claim 1, characterized in that The following steps are also included: (a) Setting a time to live (TTL) for each mapping entry in the mapping table; (b) When the lifetime of a mapping entry expires, the mapping entry is re-evaluated and possibly updated.

7. A computer program product comprising a computer program stored on a non-transitory computer-readable storage medium, characterized in that When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

8. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

9. A Serverless proxy node affinity scheduling system based on target features, characterized in that: include: (a) a feature extraction module, used to extract target features from proxy requests and generate target feature identifiers; (b) a mapping management module, used to maintain the mapping relationship between the target feature identifier and the agent instance; (c) a scheduling decision module, used to select a suitable agent instance according to the target feature identifier; (d) Status monitoring module, used to monitor the health status of the proxy instance.

10. The system according to claim 9, characterized in that It also includes a load balancing module, which is used to achieve balanced distribution of requests while ensuring affinity.