Kubernetes-based large model reasoning optimization method, system and equipment
By building resource scheduling and batch processing agent components, and monitoring and dynamically adjusting batch length in real time, the problems of low resource utilization and high latency in large model inference on the Kubernetes platform are solved, achieving more efficient resource matching and load balancing, and improving service performance and stability.
Patent Information
- Application Number
- CN202610402239.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-03-30
- Publication Date
- 2026-05-12
AI Technical Summary
The existing Kubernetes platform cannot effectively perceive dynamic characteristics during large model inference, resulting in low GPU resource utilization, high inference latency and unstable throughput. Furthermore, static batch processing cannot meet the needs of real-time data processing, leading to low hardware utilization and increased latency.
We construct resource scheduling components and batch processing agent components to monitor resource status in real time. Through feature analysis and dynamic batch processing, we adjust the batch length and optimize the large model inference process by combining load balancing algorithms and elastic scaling mechanisms.
It improves GPU resource utilization, reduces latency and throughput fluctuations, enhances service responsiveness and stability, avoids resource idleness and overload, and optimizes overall system efficiency.
Smart Images

Figure CN122021936A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of cloud computing and artificial intelligence technologies, and in particular to a method, system, and device for optimizing large model inference based on Kubernetes. Background Technology
[0002] Kubernetes, or K8s for short, is a portable container orchestration and management tool designed for container services. Based on the powerful load balancing capabilities of the Kubernetes platform, many complex business application scenarios have emerged, typically requiring the simultaneous handling of multiple workload types, including batch processing and service deployment. The main drawback of static batch processing is its lack of flexibility. The fixed batch size cannot be dynamically adjusted according to data characteristics or hardware resources, leading to low hardware utilization and potential memory waste or shortages. Furthermore, static batch processing struggles to effectively handle variable-length or unevenly distributed data, potentially impacting the stability and performance of model training. In addition, fixed batch sizes cannot meet the demands of real-time data processing, potentially increasing latency or leaving resources idle, thus reducing the overall system efficiency and responsiveness.
[0003] However, as a native scheduler, K8s cannot effectively perceive the dynamic characteristics of large model inference, such as variable request lengths and uneven computation density, which can easily lead to low GPU (Graphics Processing Unit) resource utilization, resulting in high inference latency and unstable throughput of the inference service. Summary of the Invention
[0004] This application provides a large model inference optimization method, system, and device based on Kubernetes to solve the problem that existing large model inference optimization methods cannot perceive the characteristics of large model inference, resulting in low GPU resource utilization, high inference latency of inference services, and unstable throughput.
[0005] In a first aspect, this application provides a large-model inference optimization method based on Kubernetes, comprising: constructing a resource scheduling component for large models to monitor the real-time resource status at the current moment; constructing a batch processing proxy component for large models to perform feature analysis on the received inference request queue and determine the request characteristics corresponding to each inference request in the inference request queue; evaluating the real-time resource status based on the request characteristics and adjusting the batch size based on the evaluation results to generate the optimal batch length; dividing the inference requests in the inference request queue into batches according to the optimal batch length and packaging each batch of inference requests into batch data; and using the resource scheduling component to allocate the batch data to Pods in the K8s cluster for inference to obtain the large-model inference results.
[0006] In some possible embodiments of the first aspect, the real-time resource status includes available GPU memory and GPU computing utilization, and the request characteristics include sequence length and estimated computational load. The process of evaluating the real-time resource status based on the request characteristics and adjusting the batch size based on the evaluation results to generate the optimal batch length includes: analyzing the sequence length in each request characteristic to determine the number of long requests and the number of short requests; determining the number of requests and the waiting time in the inference request queue based on the number of long and short requests; calculating the target throughput and target latency of the current execution batch based on the number of requests and the waiting time; dynamically adjusting the batch size to determine the optimal batch length, with the target throughput reaching the maximum throughput as the objective and the target latency being less than the maximum latency as the constraint; and determining the optimal batch size as the optimal batch length based on the maximum throughput of the GPU and the GPU computing utilization.
[0007] In some possible embodiments of the first aspect, with the target throughput reaching the maximum throughput as the objective and the target latency being less than the maximum latency as the constraint, the batch size is dynamically adjusted to determine the optimal batch size as the optimal batch processing length. This includes: collecting the target throughput and target latency of the large model at the current moment, with the target throughput reaching the maximum throughput as the objective and the target latency being less than the maximum latency as the constraint, and adaptively adjusting the batch size; if the number of short requests is greater than a first preset threshold and the available GPU memory is greater than a preset memory, then the batch processing length of a large batch is determined as the optimal batch processing length; if the number of long requests is greater than a second preset threshold, then the batch processing length of a small batch is determined as the optimal batch processing length, where the first preset threshold is greater than the second preset threshold; if the number of short requests is not greater than the first preset threshold, or the number of long requests is not greater than the second preset threshold, then the batch processing length of a medium batch is determined as the optimal batch processing length; the batch processing lengths of large, medium, and small batches decrease sequentially from large to small.
[0008] In some possible embodiments of the first aspect, before packaging each batch of inference requests into batch data, the method further includes: if a preset priority level inference request is detected in any batch data, then the inference request with the preset priority level is sorted in the batch data by queue-jumping processing so that the inference request with the preset priority level can be processed first; wherein the priority corresponding to the inference request is carried in the request feature.
[0009] In some possible embodiments of the first aspect, the resource scheduling component is used to allocate batch data to Pods in the K8s cluster for inference, including: obtaining the resource requirements of each Pod, where each Pod resource requirement includes at least one of CPU, GPU, and memory; filtering the resource requirements of each Pod based on preset node filtering conditions to determine a candidate node list, where the preset node filtering conditions include node resource sufficiency, GPU model matching, and node label matching; calculating the node scores in the candidate node list and the comprehensive score of each node; comparing the comprehensive scores of each node and selecting the node with the highest comprehensive score to execute the Pod for inference.
[0010] In some possible embodiments of the first aspect, calculating the node scores in the candidate node list and the comprehensive score of each node includes: calculating the node score in each candidate node, wherein the node score includes the GPU performance score, historical performance score, real-time load score and affinity score; and weighting the GPU performance score, historical performance score, real-time load score and affinity score in each candidate node to obtain the comprehensive score of each node.
[0011] In some possible embodiments of the first aspect, it further includes: constructing a batch processing agent component for the large model using a high-performance compiled language, packaging the batch processing agent component into a Docker image, orchestrating the Docker image and the large model service in the same Pod to respond to inference requests; simultaneously, constructing a resource scheduling component that meets preset node filtering conditions and node comprehensive scores, compiling and linking the resource scheduling component into a binary file to generate a scheduling executable file, so that the node with the highest score executes the scheduling executable file for inference.
[0012] In some possible embodiments of the first aspect, the method further includes: determining business-level metrics based on the batch processing agent component, the business-level metrics including at least maximum throughput and maximum latency; querying the business-level metrics to determine a matching target load; if the target load is greater than a preset load, generating a scaling request and creating a new Pod. The batch data is then distributed to Pods in the Kubernetes cluster for inference to obtain large model inference results.
[0013] In a second aspect, this application provides a large model inference optimization system based on Kubernetes, comprising: a scheduling component building module for building a resource scheduling component for large models and monitoring the real-time resource status at the current moment; a proxy component building module for building a batch processing proxy component for large models, performing feature analysis on the received inference request queue, and determining the request characteristics corresponding to each inference request in the inference request queue; a batch processing module for evaluating the real-time resource status based on the request characteristics, and adjusting the batch size based on the evaluation results to generate the optimal batch processing length; a batch packaging module for batching the inference requests in the inference request queue according to the optimal batch processing length, and packaging each batch of inference requests into batch data; and a model inference module for using the resource scheduling component to allocate the batch data to Pods in the K8s cluster for inference, thereby obtaining the large model inference results.
[0014] In a third aspect, this application also provides an electronic device, including a processor, a memory, and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the Kubernetes-based large model inference optimization method described above.
[0015] The beneficial effects of this application are as follows: A resource scheduling component and a batch processing proxy component are constructed for large models. The batch processing proxy component performs feature analysis on the received inference request queue to determine the request characteristics corresponding to each inference request in the queue. Through a collaborative mechanism of real-time resource monitoring, dynamic batch processing, and precise scheduling, the resource waiting of static batch processing is transformed into resource matching of dynamic batch processing, avoiding GPU / computing power idleness caused by batch size and resource mismatch. Real-time resource status is evaluated based on request characteristics, and the batch size is adjusted based on the evaluation results to generate the optimal batch length. By maximizing the number of parallel inference requests within a batch and packaging batch data, single-request scheduling is reduced. Inference requests in the inference request queue are batched according to the optimal batch length, and each batch of inference requests is packaged into batch data. Combined with a load balancing algorithm, local node / Pod overload is avoided. The resource scheduling component distributes batch data to Pods in the K8s cluster for inference to obtain large model inference results. The resource scheduling component works in conjunction with the K8s elastic scaling mechanism to automatically adjust the number of inference Pods according to the traffic and resource load required for inference, preventing poor-performing GPUs from becoming system bottlenecks and improving service responsiveness and stability. Attached Figure Description
[0016] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0017] In the attached diagram:
[0018] Figure 1 A flowchart of a Kubernetes-based large model inference optimization method provided in one embodiment of this application; Figure 2 A flowchart of dynamic batch processing in a Kubernetes-based large model inference optimization method provided in an embodiment of this application; Figure 3 A resource-aware flowchart in a Kubernetes-based large model inference optimization method provided in an embodiment of this application; Figure 4 A collaborative workflow diagram of a Kubernetes-based large model inference optimization system provided in one embodiment of this application; Figure 5 This application provides a Kubernetes-based large model inference optimization system architecture diagram as an embodiment. Figure 6 A structural block diagram of a Kubernetes-based large model inference optimization system provided in one embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0020] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0021] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.
[0022] In related technologies, the following technical shortcomings exist for large model inference services deployed in Kubernetes clusters: First, when large models receive inference requests, the heterogeneous characteristics of the requests (e.g., differences in input length, generation length, priority, and computational complexity) can easily lead to mismatches with static batch processing strategies, resulting in low GPU / computing resource utilization, large fluctuations in request latency, and limited throughput. Second, inference resource scheduling and batch processing decisions are independent of each other, making it impossible to dynamically adapt the batch processing scale based on real-time resource status, leading to resource idleness or overload and uneven cluster load. Third, the lack of coordination between Pod resource allocation and inference batch processing in the Kubernetes cluster makes it impossible to accurately match batch data to available Pods, resulting in low inference execution efficiency and poor service stability.
[0023] To address the aforementioned issues, this application provides a method, system, and device for optimizing large-model inference based on Kubernetes. Please refer to [link / reference]. Figure 1 The flowchart of a large model inference optimization method based on Kubernetes provided in an embodiment of this application is shown below, including: Step S110: Construct a resource scheduling component for the large model and monitor the real-time resource status at the current moment; For example, the resource scheduling component is deployed as an independent service in the Kubernetes cluster control plane, establishing communication links through the Kubernetes API Server (cluster service application programming interface), node monitoring agent, and GPU (graphics processing unit) / AI (artificial intelligence) chip monitoring plugin. Real-time resource data is collected at the cluster, node, and Pod (container group or smallest scheduling unit) levels according to a preset period. This real-time resource data includes, but is not limited to, at least one of the following: CPU utilization, memory usage, GPU memory / computing power utilization, network bandwidth, storage I / O, the running status (ready, busy, abnormal) of model inference instances (Pods), and remaining capacity to handle inference requests. For example, this application uses available GPU memory and GPU computing utilization as examples to determine the real-time resource status. The multi-source heterogeneous resource data is cleaned and normalized to generate a unified format of real-time resource status. The standardized real-time resource status is then synchronized to the batch processing agent component via event-driven or timed push methods.
[0024] Step S120: Construct a batch processing agent component for large models, perform feature analysis on the received inference request queue, and determine the request features corresponding to each inference request in the inference request queue. There is no specific order between steps S110 and S120. They can be executed according to this logic, or steps S120 can be executed first and then steps S110, or steps S110 and S120 can be executed simultaneously.
[0025] For example, the batch processing proxy component is deployed as a front-end gateway for the inference service on the business plane of the K8s cluster. It receives large model inference requests sent by clients (such as API gateways and business services), builds a FIFO (first-in-first-out) or priority request queue, parses each inference request in the queue, extracts the content features of the inference request, and quantifies and normalizes the extracted content features. For example, the requests are classified according to the request length, priority, latency tolerance, etc., such as short requests / long requests, real-time requests / batch requests, and the request features corresponding to each inference request are generated.
[0026] Step S130: Evaluate the real-time resource status based on the request characteristics, and adjust the batch size based on the evaluation results to generate the optimal batch length; Batch size refers to the number of samples, tasks, or data units processed in a single batch during scenarios such as model training / inference, data processing, and task scheduling. Batch length, on the other hand, refers to the maximum length sequence that a service can process in a single batch.
[0027] For example, a batch processing proxy component can be used to calculate the maximum number of batch requests that the current resources can handle, based on real-time available resources such as GPU memory and computing power, to avoid resource overflow or inference failure caused by excessively large batches. Another example is to calculate the throughput and latency balance value under different batch lengths based on request length, priority, and latency tolerance, prioritizing the aggregation of requests with similar characteristics, such as those of the same length and priority, to reduce resource waste caused by differences in request execution within a batch. Yet another example is to assess the impact of batch length on cluster load balancing by considering the load distribution of Kubernetes cluster nodes and Pods, avoiding local node overload. Dynamic programming or heuristic algorithms, such as greedy algorithms and simulated annealing, can be used to maximize throughput and achieve optimal latency and resource utilization as the objective function, traversing candidate batch lengths to find the optimal batch length; simultaneously, minimum / maximum batch length thresholds can be set to prevent excessive scheduling overhead due to excessively small batches or excessive latency due to excessively large batches. For example, monitor resource status and request queue changes in real time. If resource load fluctuations exceed the threshold, such as GPU utilization increasing from 70% to 90%, or request characteristic distribution changes abruptly, such as the proportion of long requests increasing from 20% to 60%, immediately re-execute the evaluation process and update the optimal batch length.
[0028] Step S140: Divide the inference requests in the inference request queue into batches according to the optimal batch length, and package each batch of inference requests into batch data; For example, based on the optimal batch length, requests are selected from the request queue according to a combination of rules based on priority, request length, and arrival order to form a batch request set. Alternatively, requests with high priority, short latency tolerance, and similar length are prioritized to improve batch execution efficiency. All inference requests within the batch are formatted and packaged, and the packaged batch data is added to the batch sending queue, awaiting allocation of inference resources by the resource scheduling component.
[0029] Step S150: Use the resource scheduling component to allocate batch data to Pods in the K8s cluster for inference and obtain large model inference results.
[0030] For example, the resource scheduling component receives batch data, combines real-time resource status with batch characteristics, and filters eligible inference Pods from the Kubernetes cluster, selecting the optimal target Pod based on a load balancing algorithm. The batch data is efficiently distributed to the inference service port of the target Pod via a Kubernetes Service or container network interface, simultaneously transmitting batch metadata and inference parameters. The large model inference engine (e.g., vLLM, TensorRT-LLM) in the target Pod receives the batch data, performs batch inference computation, and generates inference result text corresponding to each request. The inference engine returns the batch inference results to the resource scheduling component, which parses and splits the results, and sends the inference results back to the corresponding client according to the request ID, completing the entire inference process.
[0031] For example, a custom Kubernetes scheduler can be used, integrating dedicated scheduling strategies for large model inference (e.g., GPU affinity, model instance affinity) to replace the default scheduler and improve scheduling accuracy. Another example is combining Kubernetes HPA (horizontal Pod auto-scaling) and VPA (vertical Pod auto-scaling) to automatically adjust the number and resource configuration of inference Pods based on inference batch traffic and resource load, achieving elastic resource provisioning.
[0032] By employing the above approach, a resource scheduling component and a batch processing proxy component are constructed for large models. The batch processing proxy component performs feature analysis on the received inference request queue to determine the request characteristics corresponding to each inference request in the queue. Through a collaborative mechanism of real-time resource monitoring, dynamic batch processing, and precise scheduling, the resource waiting of static batch processing is transformed into resource matching of dynamic batch processing, avoiding GPU / computing power idleness caused by batch size and resource mismatch. The real-time resource status is evaluated based on the request characteristics, and the batch size is adjusted based on the evaluation results to generate the optimal batch length. By maximizing the number of parallel inference requests within a batch and packaging batch data, the scheduling of single requests is reduced. The inference requests in the inference request queue are batched according to the optimal batch length, and each batch of inference requests is packaged into batch data. Combined with a load balancing algorithm, local node / Pod overload is avoided. The resource scheduling component distributes the batch data to Pods in the Kubernetes cluster for inference to obtain large model inference results. The resource scheduling component works in conjunction with the Kubernetes elastic scaling mechanism to automatically adjust the number of inference Pods according to the traffic and resource load required for inference, preventing poor-performing GPUs from becoming system bottlenecks and improving service responsiveness and stability.
[0033] Optionally, in some embodiments, the real-time resource status includes available GPU memory and GPU computing utilization, and the request features include sequence length and estimated computational load. This includes evaluating the real-time resource status based on request characteristics and adjusting the batch size based on the evaluation results to generate the optimal batch length, including: Analyze the sequence length in each request feature to determine the number of long requests and the number of short requests. Based on the number of long requests and the number of short requests, determine the number of requests and the waiting time in the inference request queue. The target throughput and target latency of the current execution batch are calculated based on the number of requests and the waiting time. The target throughput is set to reach the maximum throughput, and the target latency is set to be less than the maximum latency. The batch size is dynamically adjusted to determine the optimal batch length. The maximum throughput is determined by the available GPU memory and the GPU computing utilization.
[0034] For example, the input sequence of each request in the inference request queue is segmented, the number of tokens is counted, and the sequence length feature of each request is obtained. A preset sequence length threshold is set, and requests greater than the preset sequence length threshold are classified as long requests, while requests less than or equal to the preset sequence length threshold are classified as short requests. The number of long requests and the number of short requests are counted respectively, and the sum of the two determines the total number of requests in the inference request queue. At the same time, the enqueue timestamp of each request in the queue is counted, and the average waiting time and maximum waiting time of the queue at the current moment are calculated. The average waiting time, maximum waiting time, number of long requests, and number of short requests are used as queue status parameters. Based on the total number of requests and the queue waiting time, the number of requests to be processed per unit time is calculated. The sum of the maximum queue waiting time and the preset maximum inference time per batch is taken as the upper limit of the latency constraint for the current batch.
[0035] For example, the real-time available GPU memory is collected, and combined with the average memory consumption per request, the maximum number of batch requests supported by the memory is calculated. The real-time GPU computing utilization is collected, and based on the GPU's theoretical peak computing power and the computing power consumption per request, the maximum number of batch requests supported by the computing power is calculated; the minimum value between the maximum number of batch requests and the maximum number of requests per request is taken as the maximum throughput that the current GPU resources can handle.
[0036] For example, an optimization objective function is constructed, with constraints including achieving the maximum throughput as the objective and the target latency being less than the maximum latency. A binary search or greedy algorithm is used to iterate through candidate batch sizes, calculating the current throughput and current latency for each batch. The batch size that satisfies the constraints and has the largest current throughput is selected as the optimal batch length. If none of the candidate batches satisfy the latency constraint, the batch size is gradually reduced until it is satisfied; if all batches satisfy the constraint, the batch with the largest current throughput is selected.
[0037] The above methods determine the maximum throughput based on available GPU memory and computational utilization, dynamically match batch size, and avoid memory overflow and resource idleness. At the same time, by dividing the sequence length, memory fragmentation caused by the mixture of long and short requests is reduced. With the maximum throughput as the optimization target, the batch size is dynamically adjusted in combination with the number of requests and waiting time. With the target latency being less than the maximum latency as a hard constraint, latency exceeding the standard due to excessively large batches is avoided. Short requests are prioritized for processing by dividing the sequence length to reduce long request blocking. The optimal batch size is adapted to the real-time status of the queue to reduce queue waiting time.
[0038] Optionally, in some embodiments, with the target throughput reaching the maximum throughput as the objective and the target latency being less than the maximum latency as the constraint, dynamically adjusting the batch size to determine the optimal batch length includes: Collect the target throughput and target latency of the large model at the current moment, and adaptively adjust the batch size with the target throughput reaching the maximum throughput as the objective and the target latency being less than the maximum latency as the constraint. If the number of short requests exceeds the first preset threshold and the available GPU memory exceeds the preset memory, then the batch length of the large batch is determined as the optimal batch length. If the number of long requests exceeds the second preset threshold, then the batch length of small batches is determined as the optimal batch length, and the first preset threshold is greater than the second preset threshold. If the number of short requests is not greater than the first preset threshold, or the number of long requests is not greater than the second preset threshold, then the batch processing length of medium batches is determined as the optimal batch processing length; the batch processing lengths of large batches, medium batches, and small batches decrease sequentially from large to small.
[0039] For example, a batch processing proxy component collects the target throughput and target latency of the large model inference service in real time. The target throughput is the number of requests processed per unit time that the current inference request queue needs to achieve, and the target latency is the longest response time for a single request that the current inference service needs to meet. Simultaneously, real-time GPU operating parameters are collected, including available GPU memory and GPU computational utilization. Based on the Service Level Agreement (SLO) of the large model inference service and a maximum latency threshold, exceeding the maximum latency threshold is considered a service anomaly. Based on available GPU memory and computational utilization, the maximum throughput that the current GPU can handle is calculated as the target throughput. Based on the collected target throughput, target latency, and constraints, the batch processing length is initialized. A trial-and-error adjustment method is used to gradually adjust the batch size, monitoring the actual throughput and actual latency in real time to ensure that the actual throughput approaches the maximum throughput and that the actual latency is always less than the maximum latency. Changes in target throughput, target latency, and GPU resource status are continuously collected. If the actual throughput does not reach the maximum throughput and the actual latency does not exceed the limit, the batch size is gradually increased; if the actual latency approaches or reaches the maximum latency, the batch size is gradually decreased, achieving adaptive dynamic adjustment of the batch processing length.
[0040] If the number of short requests exceeds the first preset threshold, and the available GPU memory exceeds the preset memory, and considering the adaptive adjustment constraints (actual throughput does not reach the maximum throughput, and latency does not exceed the maximum latency threshold), then the current scenario is determined to be suitable for large batch processing, and the preset large batch processing length is determined as the optimal batch processing length. The large batch processing length is the preset maximum batch size, which must satisfy that the total number of tokens in a single batch does not exceed the upper limit of the available GPU memory. Similarly, referring to the above method, the batch processing lengths of small batches and medium batches are determined as the optimal batch processing lengths respectively.
[0041] By adaptively adjusting the batch size with the constraints of maximizing target throughput and keeping target latency within limits, the resource utilization or latency exceeding the limit caused by fixed batches can be avoided, ensuring a continuous balance between performance and stability for the inference service. When short requests are intensive and GPU memory is sufficient, large batches can be actively used to accommodate more inference tasks for parallel execution at a time, making full use of idle GPU memory and computing resources. Long requests have a large amount of computation and occupy resources for a long period of time. Using small batches can reduce the amount of tasks submitted at a time and reduce the execution time of a single round of inference.
[0042] Optionally, in some embodiments, before packaging each batch of inference requests into batch data, the method further includes: if a preset priority level inference request is detected in any batch data, then the inference request with the preset priority level is sorted in the batch data by queue-jumping processing so that the inference request with the preset priority level can be processed first; wherein the priority corresponding to the inference request is carried in the request feature.
[0043] For example, inference requests are received and cached in real time. The request characteristics of each request are extracted, and a priority identifier field is parsed. The priority is matched against preset priority levels (e.g., high, medium, and low) to determine if a matching high-priority request exists in the current batch of data. If a preset priority level inference request is detected in the batch, queue-jumping logic is triggered. All requests in the batch are reordered based on priority weights, with the preset priority request moved to the front of the batch processing queue and the low-priority request moved to the back, forming a new processing sequence. Requests are then distributed to the inference engine for execution according to the adjusted new sequence; the preset priority request receives priority allocation of computing resources, completes inference calculations, and returns results.
[0044] By using the above method, hierarchical scheduling is implemented based on request priority. By adjusting the queue, high-priority requests can skip the waiting queue of low-priority requests, reducing the waiting time of high-priority requests, avoiding resource waste or critical request blocking caused by fixed scheduling, and improving the stability of inference services.
[0045] Optionally, in some embodiments, a resource scheduling component is used to distribute batch data to Pods in the Kubernetes cluster for inference, including: Obtain the resource requirements of each Pod, which include at least one of CPU, GPU, and memory. The resource requirements of each Pod are filtered based on preset node filtering conditions to determine the candidate node list. The preset node filtering conditions include node resource sufficiency, GPU model matching, and node tag matching. Calculate the node scores in the candidate node list and the overall score of each node; Compare the overall scores of each node and select the node with the highest overall score to execute the Pod for inference.
[0046] For example, the resource requirement parameters of each Pod to be scheduled are collected in real time. The resource requirement of each Pod includes at least one of the following: CPU requirement, GPU requirement, and memory requirement. The real-time status information of all nodes in the cluster is obtained. The resource requirements of each Pod are matched one by one with the preset node filtering conditions to filter out the nodes that meet all the filtering conditions and form a candidate node list. Among them, node resource sufficiency means that the remaining CPU, GPU, and memory of the node are not less than the resource requirements of the corresponding Pod. GPU model matching means that the GPU model of the node is consistent with the GPU model required by the Pod inference task. Node label matching means that the preset label of the node is consistent with the label requirements of the Pod.
[0047] For example, for each node in the candidate node list, a score for each evaluation metric is calculated: the node resource sufficiency score is calculated based on the ratio of the difference between the node's remaining resources and the Pod's requirements; the larger the difference, the higher the score. The GPU model compatibility score is calculated based on the degree of fit between the node's GPU model and the Pod's required model; a perfect match receives full marks, while a partial match receives marks based on the compatibility ratio. The scores for each metric are multiplied by their corresponding weight coefficients and then summed to obtain the comprehensive score for each node. The comprehensive scores of all nodes in the candidate node list are sorted in descending order, and the node with the highest comprehensive score is selected as the target node. If multiple nodes have the same comprehensive score, the node resource sufficiency scores are further compared, and the node with the highest resource sufficiency score is selected. The Pod to be scheduled is assigned to the target node, the Pod inference task is started, and the resource occupancy status of the target node is updated to ensure the accuracy of subsequent scheduling.
[0048] By comprehensively collecting the resource requirements of Pods of various types, and combining multiple filtering conditions such as node resource sufficiency, GPU model matching, and node tag matching, and then comparing multi-dimensional scores and comprehensive scores, the node with the highest suitability is selected. By filtering node resource sufficiency and multi-dimensional scores, nodes with suitable resources and reasonable load are selected, avoiding the allocation of Pods to nodes with excessive resource redundancy (causing resource waste) or nodes with scarce resources (causing task lag). This can provide a stable running environment for Pod inference tasks and reduce task interruptions or delays caused by node failures or insufficient resources.
[0049] In some possible embodiments of the first aspect, calculating the node scores in the candidate node list and the overall score of each node includes: Calculate the node score for each candidate node, which includes GPU performance score, historical performance score, real-time load score, and affinity score; The GPU performance score, historical performance score, real-time load score, and affinity score of each candidate node are weighted and calculated to obtain the comprehensive score of each node.
[0050] For example, the GPU parameters of the collected nodes are compared with the GPU performance parameters required for the Pod inference task, and scores are quantified according to preset scoring rules. Performance data of the node's past performance on similar Pod inference tasks is extracted and scored according to preset weights; for example, higher task success rates, smaller performance fluctuations, and lower failure frequencies result in higher scores. The real-time running status of the nodes is collected, and the difference between the load rate of each resource and a preset load threshold is calculated; a larger difference results in a higher real-time load score. Network affinity is calculated based on the network latency between the node and the service nodes associated with the Pod; lower latency results in a higher score. For each candidate node, its GPU performance score, historical performance score, real-time load score, and affinity score are multiplied by their corresponding weight coefficients, and the products are summed to obtain the node's overall score.
[0051] By using the above methods, a scoring system is constructed based on four dimensions: GPU performance, historical performance, real-time load, and affinity, avoiding the limitations of single-dimensional scoring. Then, a weighted calculation is used to achieve a reasonable balance of multi-dimensional indicators. At the same time, through multi-dimensional scoring and weighted calculation, the node with the highest overall adaptability is selected to avoid resource waste caused by GPU performance redundancy, excessive load, or insufficient affinity.
[0052] Optionally, in some embodiments, it further includes: A batch processing agent component for large models is built using a high-performance compiled language. This batch processing agent component is packaged into a Docker image and orchestrated with the large model service in the same Pod to respond to inference requests. At the same time, a resource scheduling component that meets preset node filtering conditions and node comprehensive scores is built. This resource scheduling component is compiled and linked into a binary file to generate a scheduling executable file, which is then executed by the node with the highest score to perform inference.
[0053] For example, a high-performance compiled language (such as C++ or Rust) is selected as the development language, and a batch processing agent component is built to meet the batch processing requirements of large model inference. Multiple containers within the same Pod share network namespaces and storage resources, enabling low-latency local communication between containers and avoiding the latency and overhead caused by cross-Pod communication between the batch processing agent component and the large model service. The target file is linked with the required library files to eliminate dependencies and generate an independent binary scheduled executable file. The generated executable file is compressed and optimized to reduce its size, and compatibility testing is conducted to ensure that the executable file can be used in all nodes of the cluster. The system operates normally. The scheduling executable is deployed to the cluster management node. The scheduling executable reads the comprehensive score ranking results of the candidate nodes and determines the optimal node with the highest comprehensive score. The scheduling executable sends scheduling instructions to the container orchestration system to schedule the Pod with the batch processing agent component and the large model service to the optimal node. After the Pod starts on the optimal node, the batch processing agent component receives external inference requests, encapsulates them into batch processing tasks, and distributes them to the large model service. The large model service executes the inference task with the resource support of the optimal node. After the inference is completed, the batch processing agent component feeds back the results to the request initiator.
[0054] By using the above methods to encapsulate batch processing tasks, the frequency of request processing for large model services can be reduced; the batch processing agent component is packaged into a Docker image, which can encapsulate all the dependent environments required for the component to run, eliminating the differences between different deployment environments.
[0055] Optionally, in some embodiments, it further includes: Business-level metrics are determined based on batch processing agent components, and these metrics include at least maximum throughput and maximum latency. Query business-level metrics to determine the matching target load; If the target load exceeds the preset load, a scaling request is generated, and a new Pod is created.
[0056] For example, business-level metrics include maximum throughput and maximum latency. A pre-defined load matching algorithm is invoked, combined with load conversion rules corresponding to the business type, to quantify and convert the business metrics, determining the target load that matches the current business metrics. The load matching algorithm pre-defines the correspondence between different business metrics and loads; for example, maximum throughput is positively correlated with the target load, and maximum latency is negatively correlated with the target load. The specific value of the target load is obtained through weighted calculation. If the target load is detected to be greater than the pre-defined load (i.e., the system's maximum load), a scaling request is generated, and a new Pod is created.
[0057] In the above manner, accurate monitoring of business-level metrics is achieved through the batch processing proxy component. Similarly, the load demand is located through the load matching algorithm, and the dynamic replenishment of resources is achieved through expansion.
[0058] In some embodiments, please refer to Figure 2 , which is the dynamic batch processing flowchart in the large model inference optimization method based on Kubernetes provided by an embodiment of the present application, including: The dynamic adaptive batch processing proxy is deployed as an independent service before the model service Pod. Its working process is as follows: Request analysis and queue management: Receive inference requests, parse the content of the inference requests, calculate the sequence length (number of Tokens) by parsing the input text, and label the inference requests with timestamps, priorities, and estimated computational loads (estimated computational amounts). Add the inference requests to the priority queue.
[0059] Resource status monitoring: Interact with NVIDIA DCGM or similar tools on the node to monitor in a cycle with a period of 50 milliseconds, and obtain the real-time status of the target GPU in real time, including video memory usage and computing utilization, etc.
[0060] Analyze the queue status, including the number of inference requests, the distribution of long and short requests, and the waiting time. By calling the dynamic batch processing decision, run a lightweight decision engine. This engine is an optimization function; Maximize(Throughput, maximum throughput) s.t. Latency (delay) < SLA (service level agreement). In this way, the number of inference requests in the queue and the distribution of long and short requests can be determined. The real-time resources are the currently available GPU video memory.
[0061] Dynamically calculate a safe and efficient batch size; for example, when there are mostly short requests in the queue and the video memory is sufficient, a large batch will be formed; when there are extremely long requests, let it have a batch alone or combine it with a very small number of requests to avoid blocking subsequent requests.
[0062] By setting priorities for inference requests, detect high-priority requests. The high-priority inference requests can be processed immediately or inserted at the front of the next batch to ensure low latency for critical services; Select requests from the queue to form a batch. When it is verified that the total video memory requirement of the batch is less than the available video memory, send the batch to the model service Pod.
[0063] In some embodiments, please refer to Figure 3 , which is the resource awareness flowchart in the large model inference optimization method based on Kubernetes provided by an embodiment of the present application; The resource scheduling component extends the K8s scheduler by implementing a custom scheduler plugin: The nodes provide rich information, collecting more detailed Pod resource requirements, including CPU, memory, and GPU information, within the node agent, and reporting them regularly. The node filtering stage uses filtering conditions, including node resource sufficiency, GPU model matching, and node tag matching, to obtain a list of candidate nodes. Then, it calculates node scores from multiple dimensions and finally calculates the comprehensive score of each node, selecting the preferred node with the highest comprehensive score as the Pod binding node.
[0064] For example, in performance-aware scheduling, when scheduling a Pod, the scheduler not only checks whether the node has idle resources, but also queries the historical performance data (such as average tokens) of similar models that have run on that node, prioritizes scheduling new model instances to nodes with better historical performance, updates the performance knowledge base, and ends the scheduling.
[0065] Load balancing avoids scheduling multiple computationally intensive model instances to the same node, and fully considers the real-time GPU load of the node to achieve load balancing.
[0066] In some embodiments, please refer to Figure 5 A system architecture diagram for optimizing large model inference based on Kubernetes is provided in one embodiment of this application; detailed below: It consists of a dynamic adaptive batch processing agent (i.e., batch processing agent component), a resource-aware scheduler (resource scheduling component), an enhanced elastic scaling controller (i.e., batch processing module and batch packaging module), and a monitoring and indicator system (model inference module).
[0067] API gateways and load balancers are deployed at the access layer, while request queue management, resource status monitoring, dynamic batch processing engine, and priority scheduling are performed at the processing layer.
[0068] The dynamic adaptive batch processing proxy component is deployed as a sidecar or a standalone Pod and integrated into the model service front end. It is responsible for request reception, queue management, feature analysis, dynamic batch processing, and request forwarding. The resource-aware scheduler component, as an extension plugin of the K8s Scheduler, is responsible for intelligent node selection based on GPU and historical performance during Pod scheduling; it sets up node filtering plugins, scoring plugins, and binding plugins at the scheduling layer.
[0069] The monitoring and metrics collector component is responsible for collecting real-time and historical performance metrics from nodes, GPU devices, model service Pods, and batch processing agents, and providing data support for the two modules mentioned above; it also implements resource metrics, business metrics, custom metrics, HPA integration, and alarm manager at the monitoring layer; and it deploys GPU nodes at the resource layer.
[0070] The enhanced elastic scaling controller component drives the automatic scaling of the number of model service replicas based on business-level metrics provided by the batch agent.
[0071] The data flow is as follows: user request - batch processing agent - model service - return result, forming a complete data processing pipeline.
[0072] Controlling flow direction and monitoring the collection of metrics – driving HPA and scheduler decisions – enabling dynamic allocation of resources. The hierarchical structure, from top to bottom, consists of the access layer, processing layer, scheduling layer, resource layer, and monitoring layer, with each layer having clearly defined responsibilities.
[0073] In some embodiments, please refer to Figure 4 A collaborative workflow diagram of a Kubernetes-based large model inference optimization system provided in one embodiment of this application is described in detail below: 1) Environment preparation; Deploy a K8s cluster containing nodes with multiple GPU models, and install NVIDIA GPUOperator to manage GPU drivers and components.
[0074] 2) Deploy a monitoring system; deploy the Prometheus Stack (monitoring stack) and integrate the DCGM Exporter (data collector) to collect detailed metrics of the GPU.
[0075] 3) Implement and deploy a dynamic batch processing agent: The agent was developed using a high-performance language.
[0076] Create a Docker image and deploy it in the same Pod as the model service Pod using the Sidecar mode.
[0077] Configure communication between the agent and the local model service.
[0078] 4) Implement and configure the resource-aware scheduler: Develop a K8s Scheduler Plugin to implement custom filtering and scoring logic.
[0079] Compile the plugin into a custom Scheduler binary and deploy it in the cluster.
[0080] When creating a Pod for a model service, specify that this custom scheduler is used via the Scheduler Name field.
[0081] 5. Configure Enhanced HPA (Horizontal Pod Autoscale): Deploy the Prometheus Adapter to convert the average_queue_wait_time metric exposed by the batch agent into a custom metric that Kubernetes can recognize.
[0082] Configure HPA, for example, to start increasing the number of replicas when the average queue wait time exceeds 500ms.
[0083] In this embodiment, a complete large-scale model inference optimization system is constructed through the collaborative work of a dynamic adaptive batch processing agent, a resource-aware scheduler, and enhanced elastic scaling.
[0084] Dynamically adjust batch processing strategies based on request characteristics and resource status; schedule model instances to the most suitable nodes based on multi-dimensional scoring; achieve precise scaling by implementing elastic scaling that matches the load based on business metrics; and continuously optimize the system by accumulating experience through a performance knowledge base.
[0085] Table 1 - Comparison of Performance Optimization Effects
[0086] In this embodiment, a dynamic adaptive batch processing agent is deployed in the Kubernetes cluster for a large language model service. This agent receives inference requests from users and temporarily stores them in a queue. It also sends queue requests to the model service. By periodically monitoring the batch processing agent, it determines when to send dynamic batch processing results to the model service, sends inference computation to the resource scheduler, and then provides feedback to the user through the model service. The dynamic adaptive batch processing agent monitors the characteristics of each request in the request queue in real time, including the length of the input sequence and the estimated computational load. Simultaneously, it obtains the real-time resource status of the Pod hosting the model service through a resource-aware scheduler component, including GPU memory utilization, GPU compute unit utilization, and available memory. Based on the request characteristics and real-time resource status, it dynamically determines the optimal batch size using a preset optimization algorithm and combines a batch of requests before sending them to the model service Pod for inference. At the Kubernetes cluster scheduling layer, a resource-aware scheduler is provided. When selecting a node for a large model service Pod, it considers the node's historical inference performance metrics and current GPU load for optimal scheduling.
[0087] In addition, based on the recorded metrics sent by the user, the HPA controller receives and determines the business-level metrics, which include at least the maximum throughput and maximum latency. The scaling assessment is determined by querying the metrics, for example, querying the business-level metrics to determine the matching target load. If the target load is greater than the preset load, a scaling request is generated and a new Pod is created, which will not be elaborated here.
[0088] The above end-to-end optimization scheme significantly improves GPU resource utilization, reduces inference latency, and increases system throughput, providing a complete technical solution for the efficient deployment of large models on Kubernetes.
[0089] Please refer to Figure 6 This embodiment of the application also provides a structural block diagram of a large model inference optimization system based on Kubernetes, including: The scheduling component building module 610 is used to build resource scheduling components for large models and monitor the real-time resource status at the current moment. The proxy component building module 620 is used to build a batch processing proxy component for large models, perform feature analysis on the received inference request queue, and determine the request characteristics corresponding to each inference request in the inference request queue. The batch processing module 630 is used to evaluate the real-time resource status based on the request characteristics and adjust the batch size based on the evaluation results to generate the optimal batch length. The batch packaging module 640 is used to batch the inference requests in the inference request queue according to the optimal batch length, and package each batch of inference requests into batch data. The model inference module 650 uses the resource scheduling component to distribute batch data to Pods in the K8s cluster for inference, and obtains large model inference results.
[0090] It should be noted that the Kubernetes-based large model inference optimization system and the Kubernetes-based large model inference optimization method provided in the above embodiments belong to the same concept. The specific execution methods of each module have been described in detail in the method embodiments and will not be repeated here. In practical applications, the Kubernetes-based large model inference optimization method provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the system can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.
[0091] By employing the above approach, a resource scheduling component and a batch processing proxy component are constructed for large models. The batch processing proxy component performs feature analysis on the received inference request queue to determine the request characteristics corresponding to each inference request in the queue. Through a collaborative mechanism of real-time resource monitoring, dynamic batch processing, and precise scheduling, the resource waiting of static batch processing is transformed into resource matching of dynamic batch processing, avoiding GPU / computing power idleness caused by batch size and resource mismatch. The real-time resource status is evaluated based on the request characteristics, and the batch size is adjusted based on the evaluation results to generate the optimal batch length. By maximizing the number of parallel inference requests within a batch and packaging batch data, the scheduling of single requests is reduced. The inference requests in the inference request queue are batched according to the optimal batch length, and each batch of inference requests is packaged into batch data. Combined with a load balancing algorithm, local node / Pod overload is avoided. The resource scheduling component distributes the batch data to Pods in the Kubernetes cluster for inference to obtain large model inference results. The resource scheduling component works in conjunction with the Kubernetes elastic scaling mechanism to automatically adjust the number of inference Pods according to the traffic and resource load required for inference, preventing poor-performing GPUs from becoming system bottlenecks and improving service responsiveness and stability.
[0092] In some embodiments, an electronic device is also provided, which may be a server, and its internal structure diagram is shown below. Figure 7 As shown, the electronic device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile and / or volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The network interface is used to communicate with external clients via a network connection. The computer program is executed by the processor to implement the functions or steps of the server-side method described above.
[0093] In some embodiments, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the methods described above.
[0094] It should be noted that the functions or steps that can be implemented by the computer-readable storage medium or electronic device described above can be referred to the relevant descriptions on the server side and client side in the foregoing method embodiments. To avoid repetition, they will not be described one by one here.
[0095] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0096] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A large model inference optimization method based on Kubernetes, characterized in that, include: Construct a resource scheduling component for the large model to monitor the real-time resource status at the current moment; Construct a batch processing agent component for the large model, perform feature analysis on the received inference request queue, and determine the request features corresponding to each inference request in the inference request queue; The real-time resource status is evaluated based on the request characteristics, and the batch size is adjusted based on the evaluation results to generate the optimal batch length. The inference requests in the inference request queue are divided into batches according to the optimal batch length, and each batch of inference requests is packaged into batch data. The resource scheduling component is used to allocate the batch data to Pods in the K8s cluster for inference, thereby obtaining the large model inference results.
2. The large model inference optimization method based on Kubernetes according to claim 1, characterized in that, The real-time resource status includes available GPU memory and GPU computing utilization; the request features include sequence length and estimated computational load. The process of evaluating the real-time resource status based on the request characteristics and adjusting the batch size based on the evaluation results to generate the optimal batch length includes: Analyze the sequence length in each of the request features to determine the number of long requests and the number of short requests, and determine the number of requests and the waiting time in the inference request queue based on the number of long requests and the number of short requests; The target throughput and target latency of the current execution batch are calculated based on the number of requests and the waiting time. The target throughput is set to reach the maximum throughput, and the target latency is set to be less than the maximum latency. The batch size is dynamically adjusted to determine the optimal batch length. The maximum throughput is determined by the available GPU memory and the GPU computing utilization.
3. The large model inference optimization method based on Kubernetes according to claim 2, characterized in that, With the target throughput reaching the maximum throughput as the objective and the target latency being less than the maximum latency as the constraint, the optimal batch size is determined by dynamically adjusting the batch size to determine the optimal batch length, including: Collect the target throughput and target latency of the large model at the current moment, and adaptively adjust the batch size with the target throughput reaching the maximum throughput as the objective and the target latency being less than the maximum latency as the constraint. If the number of short requests is greater than a first preset threshold and the available GPU memory is greater than the preset memory, then the optimal batch processing length is determined to be a large batch. If the number of long requests is greater than the second preset threshold, then the batch processing length of small batches is determined to be the optimal batch processing length, and the first preset threshold is greater than the second preset threshold. If the number of short requests is not greater than a first preset threshold, or the number of long requests is not greater than a second preset threshold, then the batch processing length of a medium batch is determined as the optimal batch processing length; the batch processing lengths of the large batch, the medium batch, and the small batch decrease sequentially from large to small.
4. The large model inference optimization method based on Kubernetes according to claim 2, characterized in that, Before packaging each batch of inference requests into batch data, the method further includes: if a preset priority level inference request is detected in any batch data, the inference request with the preset priority level is sorted in the batch data by queueing, so that the inference request with the preset priority level can be processed first; wherein, the priority corresponding to the inference request is carried in the request feature.
5. The large model inference optimization method based on Kubernetes according to claim 1, characterized in that, The resource scheduling component is used to allocate the batch data to Pods in the Kubernetes cluster for inference, including: Obtain the resource requirements of each Pod, wherein the resource requirements of each Pod include at least one of CPU, GPU and memory; The resource requirements of each Pod are filtered based on preset node filtering conditions to determine a candidate node list. The preset node filtering conditions include node resource sufficiency, GPU model matching, and node tag matching. Calculate the node scores and the overall scores of each node in the candidate node list; Compare the overall scores of each node and select the node with the highest overall score to execute the Pod for inference.
6. The large model inference optimization method based on Kubernetes according to claim 5, characterized in that, Calculate the node scores and the overall scores of each node in the candidate node list, including: Calculate a node score for each candidate node, which includes GPU performance score, historical performance score, real-time load score, and affinity score; The GPU performance score, historical performance score, real-time load score, and affinity score of each candidate node are weighted and calculated to obtain the comprehensive score of each node.
7. The large model inference optimization method based on Kubernetes according to claim 5, characterized in that, Also includes: A batch processing agent component for the large model is constructed using a high-performance compiled language. The batch processing agent component is packaged into a Docker image, and the Docker image is orchestrated in the same Pod as the large model service to respond to inference requests. At the same time, a resource scheduling component that meets preset node filtering conditions and node comprehensive scores is constructed. The resource scheduling component is compiled and linked into a binary file to generate a scheduling executable file, so that the node with the highest score executes the scheduling executable file for inference.
8. The Kubernetes-based large model inference optimization method according to any one of claims 1 to 7, characterized in that, Also includes: Based on the batch processing agent component, business-level metrics are determined, including at least maximum throughput and maximum latency. Query the aforementioned business-level metrics to determine the matching target load; If the target load is greater than the preset load, a scaling request is generated and a new Pod is created.
9. A large model inference optimization system based on Kubernetes, characterized in that, include: The scheduling component building module is used to build a resource scheduling component for the large model and monitor the real-time resource status at the current moment. The proxy component building module is used to build a batch processing proxy component for the large model, perform feature analysis on the received inference request queue, and determine the request features corresponding to each inference request in the inference request queue. The batch processing module is used to evaluate the real-time resource status based on the request characteristics, and adjust the batch size based on the evaluation results to generate the optimal batch length. The batch packaging module is used to divide the inference requests in the inference request queue into batches according to the optimal batch length, and package each batch of inference requests into batch data. The model inference module uses the resource scheduling component to allocate the batch data to Pods in the K8s cluster for inference, and obtains the large model inference results.
10. An electronic device, characterized in that, It includes a processor, a memory, and a communication bus; the communication bus is used to connect the processor and the memory; the processor is used to execute a computer program stored in the memory to implement the Kubernetes-based large model inference optimization method as described in any one of claims 1 to 8.
