A method and system for building a multi-scenario training and drill application based on the K8S platform

By analyzing and allocating load response parameters on the K8S platform, load balancing in the field of power system simulation technology is achieved, the problems of resource waste and performance losses are solved, and the reliability and efficiency of the system are improved.

CN118502969BActive Publication Date: 2024-11-19BEIJING KEDONG ELECTRIC POWER CONTROL SYST CO LTD +1
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410957460.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-07-17
Publication Date
2024-11-19
Estimated Expiration
2044-07-17

AI Technical Summary

Technical Problem

In the prior art, the field of power system simulation technology lacks a reasonable load balancing method for complex digital twin grids and multi-scenario application needs, resulting in resource waste and performance loss.

Method used

By analyzing the resources occupied by different scenario functions on the K8S platform, extracting load response parameters, allocating 3Dserver load, training drill load and WebSocketServer load, and building corresponding access paths to achieve load balancing in multi-scenario operation mode.

Benefits of technology

It achieves more accurate load balancing, reduces hardware resource waste, shortens construction and deployment cycles, and improves system performance and reliability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118502969B_ABST
    Figure CN118502969B_ABST
Patent Text Reader

Abstract

A method and system for building a multi-scenario training and drill application based on a K8S platform, the method comprising the following steps: Step 1, respectively extracting load response parameters in the multi-scenario training and drill application from a client, wherein the load response parameters include at least scenario type, concurrent number, and simulation scale; Step 2, separately allocating loads for different scenarios based on the load response parameters, wherein the load allocation further comprises respectively allocating 3Dserver load, training and drill load, and WebSocketServer load to each scenario; Step 3, respectively constructing access paths for workloads for different load types in each scenario, and deploying container ports corresponding to the access paths for the workloads.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of power system simulation, and more specifically, to a method and system for building a multi-scenario training and drill application based on a K8S platform. Background Art

[0002] Multi-scenario training and drills are technologies that provide a variety of training and drill scenarios and training support environments for substation operation and maintenance, monitoring, and operation and maintenance personnel. They can meet the needs of students' self-study, examinations, and multi-level collaborative drill applications, improve the level of operation and maintenance personnel's understanding of the primary equipment, secondary equipment, and auxiliary equipment of the power grid, lower the threshold for grassroots personnel to quickly master the necessary professional skills for substation operation and maintenance, and improve the on-site operation and emergency response capabilities of front-line employees. Therefore, the demand for multi-scenario training and drill systems in substation operation and maintenance, monitoring, and operation and maintenance industries is rapidly increasing, and the operation and maintenance and equipment costs in system operation are also continuing to grow.

[0003] Traditional application deployment methods install applications through plug-ins or scripts. On the one hand, in daily system operation, most servers have low loads, resulting in a serious waste of hardware resources; on the other hand, when building each system, multiple steps such as operating system installation, software platform implementation, business system software deployment, and functional testing are required, resulting in a long construction cycle. To solve the above problems, a virtual machine cloud platform was introduced to deploy the business on the virtual machine on the cloud platform, thereby achieving the purpose of improving hardware resource utilization and rapid release of business systems. The existing training and drill application deployment uses a virtual machine cloud platform to deploy applications on virtual machines on the cloud platform, but the virtual machine cloud platform is still heavy, and compared with physical servers, it has some loss in running speed, and still has the following defects.

[0004] In order to manage resources in a unified manner, the cloud platform still needs to deploy an independent dedicated operating system on the physical server. Then, virtual machines are released on it and the operating system is installed for the virtual machines. The cloud platform itself will take up a lot of hardware resources. Generally, a single virtual machine still takes up several GB to tens of GB of space, and resources are still wasted on the operating system of the virtual machine. The cloud platform adds a virtual hardware layer to the virtual machine, resulting in performance loss when the application is running.

[0005] K8S stands for kubernetes, which is a portable container orchestration management tool for container services. Currently, K8S has dominated the cloud business process, promoted the popularization and implementation of popular technologies such as microservice architecture, and is developing in full swing. The advent of K8S has proposed a new set of leading distributed architecture solutions based on container technology, which is a major breakthrough and innovation in the development of the entire container technology field. From the architectural design level, the most concerned system availability and scalability can be well solved in combination with K8S, and the microservice architecture and K8S can also be reasonably matched. From the deployment and operation level, K8S provides a good solution for service deployment, service monitoring, application expansion and fault handling. In general, K8S has good service discovery and scheduling capabilities, and can achieve multiple capabilities such as load balancing, service self-healing, service elastic expansion, horizontal expansion and storage volume mounting.

[0006] However, in the existing technology, the deployment of K8S is usually only roughly implemented according to business needs. Even if the Ingress resource contains more complex load balancing rules, it can meet the load balancing functions and requirements of specific systems or suppliers. However, in the field of power system simulation technology, there is no technology that can provide a reasonable load balancing method for complex digital twin power grids and application requirements in multiple scenarios.

[0007] Therefore, there is an urgent need for a new method and system for building multi-scenario training and drill applications based on the K8S platform. Summary of the invention

[0008] In order to solve the deficiencies in the prior art, the present invention provides a method and system for building a multi-scenario training and drill application based on the K8S platform. The method analyzes the resources occupied by each function in different scenarios, and realizes load balancing of training and drill applications in multi-scenario operation modes on the K8S platform.

[0009] The present invention adopts the following technical solution.

[0010] The first aspect of the present invention relates to a method for building a multi-scenario training and drill application based on a K8S platform, the method comprising the following steps: Step 1, extracting load response parameters in the multi-scenario training and drill application from the client respectively, the load response parameters including at least scenario type, concurrent number, and simulation scale; Step 2, allocating loads separately for different scenarios based on the load response parameters, the load allocation also comprising allocating 3Dserver load, training and drill load, and WebSocketServer load to each scenario respectively; Step 3, constructing access paths for workloads for different load types in each scenario, and deploying container ports corresponding to the access paths of the workloads.

[0011] Preferably, the multi-scenario training and drill application includes three application scenarios, namely, a self-study scenario, an examination scenario, and a drill scenario.

[0012] Preferably, the self-study scenario includes at least three-dimensional primary scene simulation, three-dimensional secondary scene simulation, monitoring system simulation, signal simulation, and equipment PC simulation functions; the load distribution amount in the self-study scenario is positively correlated with the number of concurrent students participating in the self-study scenario at the same time.

[0013] Preferably, the amount of load distribution in the test scenario is positively correlated with the range of test task settings in the simulation case and has nothing to do with the number of trainees.

[0014] Preferably, the load distribution amount in the drill scenario is positively correlated with the size of the simulated power grid and the number of dispatch operations; wherein the size of the simulated power grid is determined based on the sum of the dispatch areas of all the actors in the drill scenario.

[0015] Preferably, allocating 3Dserver load, training and drill load and WebSocketServer load to each scene respectively also includes: allocating 3Dserver load, training and drill load and WebSocketServer load based on the functional type of each scene; and splitting one or more loads with higher load scales according to the load scales of the 3Dserver load, training and drill load and WebSocketServer load obtained from each scene allocation; the splitting is achieved based on the training and drill application functions carried by the one or more loads.

[0016] The second aspect of the present invention relates to a system for building a multi-scenario training and drill application based on the K8S platform, the system including an extraction module, an allocation module and a deployment module; wherein the extraction module is used to extract load response parameters in the multi-scenario training and drill application from the client respectively, and the load response parameters include at least scenario type, concurrent number, and simulation scale; the allocation module is used to allocate loads separately for different scenarios based on the load response parameters, and the load allocation also includes allocating 3Dserver load, training and drill load and WebSocketServer load to each scenario respectively; the deployment module is used to construct access paths for workloads for different load types in each scenario, and deploy container ports corresponding to the access paths of the workloads.

[0017] Preferably, in the allocation module, the multi-scenario training and drill application includes three application scenarios, namely, a self-study scenario, an examination scenario, and a drill scenario.

[0018] Preferably, in the allocation module, the self-study scenario includes at least three-dimensional primary scenario simulation, three-dimensional secondary scenario simulation, monitoring system simulation, signal simulation, and equipment PC simulation functions; the load distribution amount in the self-study scenario is positively correlated with the number of concurrent students participating in the self-study scenario at the same time; the load distribution amount in the examination scenario is positively correlated with the scope of the examination task setting in the simulation case, and has nothing to do with the number of students; the load distribution amount in the drill scenario is positively correlated with the scale of the simulated power grid and the number of scheduling operations; wherein, the scale of the simulated power grid is determined based on the sum of the scheduling areas of all the performers in the drill scenario.

[0019] Preferably, in the allocation module, 3Dserver load, training and drill load and WebSocketServer load are allocated based on the functional type of each scene; and one or more loads with higher load scales are split according to the load scales of the 3Dserver load, training and drill load and WebSocketServer load obtained from each scene allocation; the splitting is achieved based on the training and drill application functions carried by one or more loads.

[0020] The beneficial effect of the present invention is that, compared with the prior art, the present invention is a method and system for building a multi-scenario training and exercise application based on the K8S platform. The method analyzes the resources occupied by each function in different scenarios, and realizes the load balancing of the training and exercise application in the multi-scenario operation mode under the K8S platform. The present invention is effective and reliable, and fully considers the resource call requirements of different servers in multiple different scenarios, and granularizes the number of controls involved in each business function to predict the business resources required in different scenarios, thereby achieving more accurate load balancing.

[0021] The beneficial effects of the present invention also include:

[0022] 1. By designing cluster management nodes to be highly available, mobile, and scalable, the problem of low server load, resulting in serious waste of hardware resources, long construction and deployment cycle, and large space occupation is solved.

[0023] 2. Business services can realize automatic recovery of node failures, realize real-time service discovery, and provide interfaces for services to external networks, solving the problem of easy performance loss during program runtime. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] Figure 1 This is a schematic diagram of the steps of a method for building a multi-scenario training and drill application based on the K8S platform of the present invention. DETAILED DESCRIPTION

[0025] In order to make the purpose, technical scheme and advantages of the present invention clearer, the technical scheme of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. The embodiments described in the present invention are only embodiments of a part of the present invention, not all embodiments. Based on the spirit of the present invention, all other embodiments not recorded in the present invention obtained by ordinary technicians in this field according to the embodiments recorded in the present invention without making creative work should belong to the protection scope of the present invention.

[0026] Figure 1 The figure is a schematic diagram of the steps of a method for building a multi-scenario training and exercise application based on the K8S platform of the present invention. Figure 1 As shown, the present invention relates to a method for building a multi-scenario training and drill application based on a K8S platform, and the method comprises the following steps: step 1, respectively extracting load response parameters in the multi-scenario training and drill application from the client, wherein the load response parameters include at least scenario type, concurrent number, and simulation scale; step 2, separately allocating loads for different scenarios based on the load response parameters, and allocating loads further comprises respectively allocating 3Dserver loads, training and drill loads, and WebSocketServer loads to each scenario; step 3, respectively constructing access paths for workloads for different load types in each scenario, and deploying container ports corresponding to the access paths of the workloads.

[0027] The multi-scenario training and drill function provides a variety of training and drill scenarios and training support environments for substation operation and maintenance, monitoring, and operation and maintenance personnel, meeting the students' self-study, examination, and multi-level collaborative drill application needs, improving the operation and maintenance personnel's understanding of the primary equipment, secondary equipment, and auxiliary equipment of the power grid, lowering the threshold for grassroots personnel to quickly master the professional skills necessary for substation operation and maintenance, and improving the on-site operation and emergency response capabilities of front-line employees.

[0028] Multi-scenario training drills include three application scenarios: self-study scenarios, examination scenarios, and drill scenarios.

[0029] The self-study scenario includes three-dimensional primary scenario simulation, three-dimensional secondary scenario simulation, monitoring system simulation, signal simulation, equipment PC simulation and other functions, and has training management functions such as training start and stop, lesson plan management, sub-teaching plan management, event table, training message, etc. This scenario is suitable for students to practice independently. When entering the self-study scenario, the system automatically creates a set of independent and complete simulation instances for each student. The simulated power grids between students are independent, the data is isolated, and the operations do not affect each other. It supports multiple students to carry out training independently at the same time, and students can independently set faults and exceptions and carry out fault and exception handling drills. In the self-study scenario, after the students complete the operation, a student operation record is formed, and the training evaluation function is used to compare with the standard operation, automatically score and evaluate, give an evaluation report, and support exporting the evaluation report.

[0030] On the one hand, considering that the simulation processes such as 3D primary scene simulation, 3D secondary scene simulation, monitoring system simulation, signal simulation, and equipment PC simulation need to call the 3D engine to implement the simulation process, a large amount of load will be consumed accordingly.

[0031] On the other hand, for the self-study scenario, the above simulation process is only based on the information interaction between a certain student and the simulation system. Therefore, for a certain student, the load consumed when entering the self-study scenario is relatively constant. For the server, the load consumed by the self-study scenario is related to the number of students participating in self-study at the same time.

[0032] Therefore, the primary factor considered by the method of the present invention in the process of allocating loads for self-study scenarios is the number of concurrent students participating in the self-study scenarios at the same time. When the number of concurrent students is large, the number of three-dimensional primary scenarios, three-dimensional secondary scenarios, etc. that need to be generated for power grids in different regions will be relatively large. Unless multiple self-study students coincidentally call exactly the same scene, otherwise, when multiple students call multiple different three-dimensional primary and three-dimensional secondary scenes without duplication or mutual influence, the server needs to provide scene construction capabilities for different power grid areas and levels for multiple different students respectively. Correspondingly, the load consumption also varies with the number of concurrent students.

[0033] In addition, the test scenario includes test scenario creation, test scenario addition, deletion, modification and query, and instructor and student functions. This scenario is suitable for application scenarios such as skill appraisal and competition. When entering the test scenario, the system automatically creates a complete set of independent simulation instances for the instructor and each student. The simulated power grids between instructors and students and between students are independent, the data is isolated, and the operations do not affect each other, so that one instructor can control multiple students. It supports instructors to set faults for students in batches, control the progress of training exams, and support student fault handling.

[0034] The test scenario interface can add, modify, view and delete test tasks. After the test, you can collect test papers, add instructors and students, and manage test tasks. Instructors have the functions of starting and stopping the training system, canceling test tasks, managing lesson plans, managing sub-lesson plans, setting exceptions, setting faults, and setting defects. Students do not have the functions of starting and stopping the training system, canceling test tasks, managing lesson plans, managing sub-lesson plans, setting exceptions, setting faults, and setting defects. They have the functions of auxiliary system operation, switching operation, defect handling, and fault handling.

[0035] For the exam scenario, multiple students are similar to students in the self-study scenario, and they perform tasks independently in the three-dimensional scene. However, unlike students in the self-study scenario who can freely choose more different three-dimensional environments to interact, perform tasks, and realize the simulation process, students in the exam scenario are confined to a limited range. Generally speaking, according to the scope of the exam task setting in the simulation case, the method can pre-estimate the task execution and operation scope of multiple students. If the exam task is relatively simple, the load that needs to be called during the entire exam process is relatively low, while if the exam involves a wide range of simulation, the load that needs to be called during the exam process is relatively high.

[0036] For the present invention, the number of students does not have much impact on the load called by the examination scenario. For example, whether there are 10 students or 100 students taking the examination at the same time, the load capacity used by the method is roughly the same.

[0037] Third, the drill scenario includes the creation of drill tasks, the addition, deletion, modification and query of drill tasks, and the director and actor functions. This scenario is suitable for multi-professional and multi-role joint drill scenarios, and supports multi-level collaborative drills with superior dispatchers and subordinate substations. When entering the drill scenario, the system automatically creates a complete set of simulation instances for the director and the actors. The director and the actors share a simulated power grid. The director controls the progress of the drill, and the actors complete the drill handling process on their own human-machine interfaces. It is suitable for conducting peak summer and peak winter drills, major political activities, power supply security for important festivals, and daily routine anti-accident drills.

[0038] The drill scene interface can add, modify and delete drill tasks, and has the functions of adding directors, actors, and managing drill scenes. The director has the functions of starting and stopping the training system, canceling drill tasks, managing lesson plans, managing sub-lesson plans, setting exceptions, setting faults, and setting defects. The actor does not have the functions of starting and stopping the training system, canceling drill tasks, managing lesson plans, managing sub-lesson plans, setting exceptions, setting faults, and setting defects, but has the functions of auxiliary system operation, switching operation, defect handling, and fault handling.

[0039] Considering that in the drill scenario, it is necessary to realize the simulation collaboration of multiple actors in a shared simulated power grid. Therefore, in this scenario, after the dispatch operation process of a actor is obtained, the simulated power grid will respond to this operation process from a full scale and provide the state change after the full-scale equipment response. It is possible that when a actor's dispatch operation is executed, no abnormality occurs in the dispatch area of ​​the actor, but outside the dispatch area of ​​the actor, large-scale failures or risks will occur in the equipment in the dispatch areas of other actors.

[0040] At this time, the method will perform a simulation process of the entire network for each dispatcher's operation, and this process itself will consume a lot of resources. In the present invention, considering the needs of this exercise scenario, the resource consumption is not determined based on the number of dispatchers, but the use of load is determined based on the scale of the simulated power grid and the number of dispatch operations.

[0041] Specifically, in the above three different scenarios, it is necessary to build virtual scenes for training and drills according to the needs of the scenarios. Specifically, according to the digital twins of the substation equipment and the component anomaly library, virtual scenes for substation training and drills with different voltage levels, different wiring methods, different equipment types, and different configuration modes are quickly built. Among them, the functions that consume the most load mainly include three-dimensional primary scenes and three-dimensional secondary scenes. There are also many specific functions that can be realized in three-dimensional primary scenes and three-dimensional secondary scenes, such as operation mode, inspection mode, and so on. Each mode requires calling different resources for rendering and building different three-dimensional scenes. In this process, the method can approximately assume that the amount of load resources actually consumed by each function is roughly constant. The method can also estimate the load consumed by each single function through the call of historical loads.

[0042] For example, in the three-dimensional primary scene, there are functions such as operation mode, inspection mode, abnormal listing, abnormal setting, abnormal handling, auxiliary system, special operation, switching scene, selection tool, navigation map, etc. For example, in the operation mode, trainees and dispatchers can operate the pressure plate, reset button, switch handle, circuit breaker and other controls in the terminal box, control box, mechanism box and other boxes in the three-dimensional primary scene to meet the needs of operating the three-dimensional primary scene controls during switching operations and fault handling. In addition, in the inspection mode, the opening and closing positions of circuit breakers, disconnectors, earthing switches, signal lights, instruments, pressure plates, reset buttons, switch handles, circuit breakers and other controls in the three-dimensional primary scene are checked, and inspection records are formed to meet the needs of checking the three-dimensional primary scene controls during switching operations and fault handling.

[0043] Due to different scenarios, that is, the scale of the simulated power grid constructed for each student or multiple students and multiple dispatchers in the self-study scenario, examination scenario and drill scenario mentioned above is different, so for the simulated power grid, the number of each function contained therein is also different. For example, for a self-study scenario, the method can pre-set a typical self-study scenario. The number of each function in each self-study scenario is limited, which may include controls below the preset number. Each control consumes a certain degree of load in the process of realizing three-dimensional modeling and performing interactive operations. Therefore, the actual load consumption is related to the number of controls. In other words, the scale of the simulated power grid is positively correlated with the number of controls.

[0044] In addition, the load consumed by the simulated power grid during the calculation process is also related to the complexity of the simulated power grid. In addition, the differences in algorithms such as the impact of multiple control states on other devices or controls in the simulated power grid after modification will also affect the amount of resources consumed by the calculation.

[0045] However, the present invention can briefly analyze the load required by the method in a certain scenario based on the number of controls or similar content, and based on this, provide different load capacity allocations for different scenarios.

[0046] In view of the above analysis content, the present invention dynamically deploys resources and distributes loads by pre-analyzing or real-time tracking the possible operation mode and operation status of the system. On the one hand, different businesses require different load driving capabilities. For example, 3Dserver drivers or WebSocket drivers are pre-deployed on some servers, so that these servers can support the dynamic deployment of corresponding businesses. In order to obtain these situations, the method pre-queries and generates the resource types of each available server based on the K8S platform, and records the resource types and available load of these servers in the form of a resource data table. Each data in the resource data table includes the address of a server, a resource type that the server can provide, and the load that this resource type can provide. In one embodiment, the load of a certain resource type is dynamically changing and can change according to the remaining main functions of the server. Therefore, the data content in the resource data table is also dynamically updated.

[0047] On the other hand, the present invention should predict in advance the load required for each application scenario and the application mode in each application scenario in the multi-scenario training and exercise application. For example, different loads are predicted for different numbers of students in the self-study scenario; for different simulation cases in the examination scenario, the corresponding load is predicted for each case, and the total load is calculated for a certain examination scenario, and so on. This part of the data is stored in the form of a predicted load table.

[0048] The multi-scenario training and rehearsal application tracks the dynamic changes of application scenarios, the number of concurrent students, and the scheduling areas of the performers, and calls the predicted load table to query the current load demand of the application. If the current load demand of the application exceeds the current configured load of the application, the resource data table is updated in real time, and dynamic load calls are made through the resource data table.

[0049] In this way, in the self-study scenario, as the number of students increases or decreases, the application can continuously provide sufficient and appropriate dynamic load for the self-study scenario in a redundant manner. The way the application adjusts the load is to achieve dynamic adjustment by building a running environment on the K8S platform.

[0050] In summary, the overall design of the present invention is to build an operating environment on the K8S platform, formulate an automatic recovery strategy for Pod failures based on the operating environment, deploy service discovery functions based on Service and CoreDns components in the operating environment, realize mutual positioning between applications, provide external network connection interfaces, realize external network access, and deploy multi-scenario training and exercise system strategies, including workload creation and load balancing deployment. The present invention solves the problems of large performance loss, high construction cost, and slow application release in the prior art.

[0051] Specifically, K8S's network model integrates multiple technologies such as network namespace, virtual network devices, three-layer routing, NAT conversion, overlay network, load balancing, etc. With the guarantee of these technologies, a robust and flexible information network can be built.

[0052] In order to meet the high availability of the K8S platform and ensure the continuous operation of the platform management system, the overall 3+N design is adopted, that is, 3 hosts are used as management Master nodes, and the remaining hosts are used as Node working nodes. Container services can also be run on the management Master nodes. The three management nodes use Haproxy to implement four-layer load balancing to meet the access requirements of multiple nodes. At the same time, Keepalived is used to achieve high availability of services to ensure the uninterrupted operation of the K8S platform. In terms of network, the Flannel CNI network plug-in is used to implement the K8S network model. Flannel supports host-gw gateway mode and VxLan tunnel mode, and also supports a mixed mode of the two. At the same time, it can meet the high-efficiency transmission of hosts in the same network segment and data exchange of hosts across network segments.

[0053] In one embodiment, in the step of deploying management nodes and working nodes, at least 4 hosts can be deployed, 3 hosts are deployed as management nodes, and the remaining hosts are deployed as working nodes; Haproxy is deployed on the management node to achieve load balancing of the three nodes; Keepalived is deployed on the management node to achieve high availability.

[0054] Specifically, the method uses the Flannel CNI network plug-in to deploy the K8S network model, which includes the physical host network plane, the Service network plane, and the Pod network plane.

[0055] In one embodiment, the physical host network plane is: 192.168.0.0 / 24; the Service network plane is: 172.16.0.0 / 16; and the Pod network plane is: 172.17.0.0 / 16. In addition, the method uses the Service resource object in K8S to achieve mutual access and load balancing between business services. The CoreDns component in K8S is used to achieve service discovery between businesses and enhance flexibility.

[0056] In K8S, the management node is crucial. It is the core of container orchestration, business expansion, service HA, and network access. In engineering applications, it must be highly available. K8S itself already has high availability mechanisms for core components such as etcd, controller manager, and scheduler. It only needs to implement the high availability mechanism of apiserver to ensure that each node can call the management node's API uninterruptedly. First, deploy Haproxy on the three management nodes to achieve load balancing of the three nodes to cope with large-scale clusters. Haproxy can achieve four-layer and seven-layer load balancing, which is very suitable for use here. Secondly, deploy Keepalived to achieve high availability, and realize VIP drift when the listening port cannot be detected to ensure the sustainability of the service.

[0057] The steps to develop an automatic recovery strategy for Pod failures include: developing different restart strategies based on different application types; developing health check methods based on the status of running services in the Pod; judging the status of the Pod based on the health check method, and selecting the corresponding restart strategy based on the status of the Pod.

[0058] Specifically, the restart strategies include Always, OnFailure, and Never. Among them, the Always strategy is to always restart the container after the container is terminated; the OnFailure strategy is to restart the container only when the container exits abnormally; the Never strategy is to never restart the container when the container is terminated. The method selects different restart strategies according to different application types. Always is suitable for applications that need to run continuously, which is also required by most applications in information systems. OnFailure is suitable for short-term tasks, such as database backup.

[0059] After selecting the storage strategy, you can perform a health check on the services running in the Pod, and let the Pod decide whether it is in the running state based on the status of the service. If K8S detects that the Pod is not in the running state, it will perform operations on the Pod according to the restart strategy. The health check method supports 3 inspection methods, including httpGet detection, exec detection, and tcpSocket detection. httpGet detection sends an HTTP request and determines the status of the Pod by receiving the returned status code. The status code should be returned within the range of 200 to 400. If the returned code exceeds 400, it is determined to be an error status code. exec detection determines the status code by executing a shell command. If the status code is 0, it is determined to be a non-error state. tcpSocket detection transmits TCP data packets through a socket connection and determines whether the TCP port is open based on the returned data packets. Applications without port monitoring can choose to use exec for inspection, and applications with port monitoring can choose to use tcpSocket for inspection.

[0060] When the container is restarted, migrated, and other operations are performed in K8S, the IP address may change. The IP can be fixed through the Pod on the backend of the Service resource proxy. However, the IP address is difficult to remember, and in a production environment, the Service IP may need to be reconfigured. In order not to affect the normal operation of the business, it is necessary to use the service discovery function to allow applications to locate each other. K8S uses Coredns to implement the service discovery function. In one embodiment of the present invention, Coredns is deployed on the management node in a Service manner; and the number of Pod replicas is set to 2.

[0061] The Pod network plane and Service network plane in K8S are unknown to the external network and cannot be accessed. The external network can only access the host network plane. K8S can be accessed by the external network by mapping the Service port. The method of the present invention configures the two hosts in the host private network into a high-availability load balancing server to provide a proxy for each interface Service, and exposes the interface Service to the external network.

[0062] In addition, Keepalived is deployed on both hosts to achieve high availability, so that the IP address accessed by external systems remains unchanged; haproxy is deployed on both hosts to provide a load balancing service proxy to forward traffic accessing the internal interface service; the NodePort type is used for the Service, so that the hosts running the backend-related Pods all open the corresponding service mapping ports. External systems can access the internal network interface service by accessing the VIP of the load balancing server and the proxy port of related services.

[0063] In the process of system deployment in multiple scenarios, you can first add the image library credentials to the namespace, and add the image library address: harbor.zj.com.cn. Then, create a workload.

[0064] In another embodiment of the present invention, the workload includes a 3Dserver workload, a training and exercise workload, and a WebSocketServer workload. The 3Dserver workload includes a docker image, a container port, a network mode, a memory reservation and limit value, a CPU reservation and limit value, the docker image is an image uploaded to an image repository, the container ports are deployed as 18991, 8990, and 8991, the network mode uses a cluster IP, the memory reservation and limit value are set the same, and the CPU reservation is set to half of the limit value.

[0065] For 3Dserver, the method consumes different resources in different scenarios. In the self-study scenario, the load can be distributed according to the number of concurrent students, the scale of the scenario actually selected by each student, and the average scale of multiple different scenarios preset by the method. In the examination scenario, the method can distribute the load according to the scale of the current examination lesson plan preset by the instructor. In the drill scenario, the method can obtain the coverage of the simulated power grid for the identities of multiple different dispatchers; and then determine the scale and load distribution of the simulated power grid based on the coverage of the simulated power grid.

[0066] It should be noted that the main function of 3Dserver is to build a 3D model of the scene. In this case, the load of 3Dserver is determined by the scale of the simulated power grid. As mentioned above, the scale here can be simply understood as the number of controls in the simulated power grid. Based on the actual operation mode of the simulated power grid, or the load consumed by each function in the historical operation of the simulated power grid, the appropriate load that can be allocated now or in the future is estimated.

[0067] The training and drill workload includes docker images, container ports, network modes, memory reservations and limits, and CPU reservations and limits. The docker images are images uploaded to the image repository. The container port is deployed as 8080. The network mode uses cluster IP. The memory reservation is 1024 MiB and the limit is 2048 MiB. The CPU reservation is 1000 milli CPUs and the limit is 2000 milli CPUs.

[0068] The training and rehearsal work in the present invention includes the functions corresponding to the operations of scene creation, personnel addition and deletion, task cancellation, lesson plan management, scene modification, exception and defect setting, etc. in the three scenarios mentioned above. Therefore, the load resources consumed in this part of the process are relatively constant. Even if there are differences in the number of trainees or dispatchers to a certain extent, these differences can be ignored because this part of the function consumes less load.

[0069] However, it should be noted that since this part of the function is crucial in the implementation of each scenario and cannot be affected by other functions, the load of this part of the function can be built independently, and this part of the function will be responded to first during the implementation and operation of the system or platform.

[0070] The WebSocketServer workload includes the docker image, container port, network mode, memory reservation and limit values, CPU reservation and limit values. The docker image is the image uploaded to the image repository. The container port is deployed as 9090. The network mode uses the cluster IP. The memory reservation is 1024 MiB and the limit is 1024 MiB. The CPU reservation is 1000 milli CPUs and the limit is 1000 milli CPUs.

[0071] WebSocketServer mainly provides load capacity for the communication process between the server and each client. Therefore, considering the different operation modes of each scenario, WebSocketServer can also choose to plan different load capacities for different scenarios.

[0072] For example, for self-study scenarios, the method can allocate resources according to the degree of localization of the self-study scenarios. If each operation of the trainee needs to be submitted to the server for simulation, WebSocketServer needs to allocate more resources, and the amount of resources is determined according to the number of trainees. If the self-study scenario designs many localized response mechanisms, the trainee can relatively reduce the thread occupancy of WebSocket while generating the self-study scenario. In addition, for the examination scenario, the method can allocate resources according to the number of candidates. Since each candidate needs to submit his operation process. Therefore, the more candidates there are, the more resources are required. For the drill scenario, if multiple dispatchers are at different scheduling levels and there are more scheduling interaction processes between them, a large number of WebSocket communication processes are required, and more resources are allocated at this time. However, since the WebSocket process is mainly used for communication, the resource occupancy scale compared to 3Dserver can be ignored.

[0073] In summary, the method realizes load balancing deployment. Load balancing deployment includes 3Dserver load balancing deployment, training and exercise load balancing deployment, and WebSocketServer load balancing deployment.

[0074] Preferably, allocating 3Dserver load, training and drill load and WebSocketServer load to each scene respectively also includes: allocating 3Dserver load, training and drill load and WebSocketServer load based on the functional type of each scene; and splitting one or more loads with higher load scales according to the load scales of the 3Dserver load, training and drill load and WebSocketServer load obtained from the allocation to each scene; the splitting is achieved based on the training and drill application functions carried by the one or more loads.

[0075] In the present invention, considering that the training and drill load and the WebSocketServer load are relatively small in scale compared to the 3Dserver load, they can be ignored and no longer split. However, since the 3Dserver bears a large amount of power grid simulation and 3D rendering responsibilities, it needs to consume a large amount of load. Taking this factor into consideration, the present invention has once again split the multiple different functions undertaken under the 3Dserver load. The functions under the 3Dserver are listed, which may include not only the main interface of the training and drill, the main interface of the substation digital twin, the three-dimensional primary scene, and the three-dimensional secondary scene, but also other auxiliary equipment operation interfaces. Among them, the main interface of the substation digital twin carries equipment ledgers, maintenance plans, equipment defects, operation tickets, video monitoring and other functions, while the auxiliary equipment operation interface can perform robot patrols, video monitoring, security simulation, firefighting robots and other functions.

[0076] On this basis, the present invention pre-estimates the load consumed by the various functions carried on each main interface according to the load response parameters selected in the foregoing text, and then distributes the various functions and the functions of each main interface to different load access paths in a more balanced manner. Through such a secondary split, there will be no excessive impact between the various functions. For example, when a load is saturated, it will cause the corresponding access path and port to fail, but it will not have any impact on the load on other access paths and their ports. The application can still continue to perform other tasks and wait for the overloaded port to recover automatically.

[0077] In one embodiment, the deployment process of 3Dserver load balancing includes: customizing the domain name in the load balancing interface, and the access domain name is: jkzszls.zj.com.cn; adding the following workload access paths in sequence: / WebGL-HaiMen, / WebGL-HaiMen-PXYL, / 3DServer, / VisualHub, / Http- VisualHub, / WebGL-JunTian, ​​ / WebGL-JunTian-PXYL. Among them, the / WebGL-HaiMen path links to the multi-scenario training and drill main interface of a certain substation, the / WebGL-HaiMen-PXYL path links to the digital twin main interface, the / 3DServer links to the three-dimensional primary scene and the three-dimensional secondary scene, the / VisualHub and / Http-VisualHub paths link to the auxiliary equipment operation interfaces of the local and remote substations respectively, and the / WebGL-JunTian and / WebGL-JunTian-PXYL are the multi-scenario training and drill main interface and the digital twin main interface of a remote substation respectively. The container ports corresponding to the above path deployment are: 18991, 18991, 18991, 8990, 8991, 18991, 18991.

[0078] In another embodiment, the deployment process of training and drill load balancing includes: customizing the domain name in the load balancing interface, and the access domain name is: jkzszls.zj.com.cn; adding the access path of the workload: / pms3.0, which corresponds to the existing power business-related data carrier platform in the power system; deploying the corresponding container port is: 8080.

[0079] In yet another embodiment, a custom domain name is set in the load balancing interface, and the access domain name is: jkzszls.zj.com.cn; an access path for adding a workload is: / transfer; and the corresponding container port is: 9090.

[0080] So far, the present invention has completed the network design and system deployment of the multi-scenario training and drill system based on the K8S platform. Due to the many characteristics of K8S, such as portability, scalability, and self-repair, it has been widely used in more and more fields. The present invention combines the characteristics of the multi-scenario training and drill system, studies and explains the network design of the specific application of K8S in the system, and proposes solutions to technical difficulties such as high availability, self-repair, service discovery, and interface with external systems, which has guiding value for engineering applications.

[0081] The second aspect of the present invention relates to a system for building a multi-scenario training and drill application based on the K8S platform, the system including an extraction module, an allocation module and a deployment module; wherein the extraction module is used to extract load response parameters in the multi-scenario training and drill application from the client respectively, and the load response parameters include at least scenario type, concurrent number, and simulation scale; the allocation module is used to allocate loads separately for different scenarios based on the load response parameters, and the load allocation also includes allocating 3Dserver load, training and drill load and WebSocketServer load to each scenario respectively; the deployment module is used to construct access paths for workloads for different load types in each scenario, and deploy container ports corresponding to the access paths of the workloads.

[0082] Preferably, in the allocation module, the multi-scenario training and drill application includes three application scenarios, namely, a self-study scenario, an examination scenario, and a drill scenario.

[0083] Preferably, in the allocation module, the self-study scenario includes at least three-dimensional primary scenario simulation, three-dimensional secondary scenario simulation, monitoring system simulation, signal simulation, and equipment PC simulation functions; the load distribution amount in the self-study scenario is positively correlated with the number of concurrent students participating in the self-study scenario at the same time; the load distribution amount in the examination scenario is positively correlated with the scope of the examination task setting in the simulation case, and has nothing to do with the number of students; the load distribution amount in the drill scenario is positively correlated with the scale of the simulated power grid and the number of scheduling operations; wherein, the scale of the simulated power grid is determined based on the sum of the scheduling areas of all the performers in the drill scenario.

[0084] Preferably, in the allocation module, 3Dserver load, training and drill load and WebSocketServer load are allocated based on the functional type of each scene; and one or more loads with higher load scales are split according to the load scales of the 3Dserver load, training and drill load and WebSocketServer load obtained from each scene allocation; the splitting is achieved based on the training and drill application functions carried by one or more loads.

[0085] The beneficial effect of the present invention is that, compared with the prior art, the present invention is a method and system for building a multi-scenario training and exercise application based on the K8S platform. The method analyzes the resources occupied by each function in different scenarios, and realizes the load balancing of the training and exercise application in the multi-scenario operation mode under the K8S platform. The present invention is effective and reliable, and fully considers the resource call requirements of different servers in multiple different scenarios, and granularizes the number of controls involved in each business function to predict the business resources required in different scenarios, thereby achieving more accurate load balancing.

[0086] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents, and any modifications or equivalent replacements that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for building a multi-scenario training and drill application based on the K8S platform, characterized in that: The method comprises the following steps: Step 1, respectively extracting load response parameters in a multi-scenario training and exercise application from a client, wherein the load response parameters include at least scenario type, concurrent number, and simulation scale; Step 2, allocating loads for different scenarios based on the load response parameters, wherein the load allocation further includes allocating 3Dserver load, training and exercise load, and WebSocketServer load to each scenario respectively; The multi-scenario training and drill application includes three application scenarios, namely, self-study scenario, examination scenario and drill scenario; Self-study scenarios include at least 3D primary scene simulation, 3D secondary scene simulation, monitoring system simulation, signal simulation, and equipment PC simulation functions; The load distribution in the self-study scenario is positively correlated with the number of concurrent students participating in the self-study scenario at the same time; The amount of load distribution in the test scenario is positively correlated with the range of test task settings in the simulation case and has nothing to do with the number of students; The amount of load distribution in the exercise scenario is positively correlated with the size of the simulated power grid and the number of dispatch operations; Wherein, the scale of the simulated power grid is determined based on the sum of the dispatching areas of all the actors in the exercise scenario; Step 3: constructing access paths for workloads for different load types in each scenario, and deploying container ports corresponding to the access paths for the workloads; Step 4: pre-query and generate the resource type of each available server based on the K8S platform, and record the resource type and available load of each available server in the resource data table; Each piece of data in the resource data table includes the address of the server, a resource type provided by the server, and the available load of the resource type, and the resource data table is dynamically updated; Predicting the load required for each scenario and each load in advance, and storing the predicted load for each scenario and each load in a predicted load table; Track the dynamic changes of scenarios, concurrent numbers, and simulation scales in the multi-scenario training and drill system, and call the predicted load table to query the current load demand. If the current load demand exceeds the current configured load, update the resource data table in real time and use the resource data table for dynamic load calls.

2. According to the method for building a multi-scenario training and drill application based on the K8S platform described in claim 1, it is characterized by: The allocation of 3Dserver load, training and exercise load and WebSocketServer load to each scene also includes: Allocate 3Dserver load, training and exercise load, and WebSocketServer load based on the functional type of each scenario; and Split one or more loads whose load scales are higher than a threshold according to the load scales of the 3Dserver load, the training and exercise load, and the WebSocketServer load obtained by each scenario allocation; The splitting is achieved based on the training and exercise application functions carried by one or more loads.

3. A system for building multi-scenario training and drill applications based on the K8S platform, characterized by: The system includes an extraction module, an allocation module, a deployment module, and a calling module; wherein, The extraction module is used to extract load response parameters in the multi-scenario training and exercise application from the client, respectively, and the load response parameters include at least scenario type, concurrent number, and simulation scale; The allocation module is used to allocate loads separately for different scenarios based on the load response parameters, and the load allocation also includes allocating 3Dserver load, training and exercise load and WebSocketServer load to each scenario respectively; In the allocation module, the multi-scenario training and drill application includes three application scenarios, namely, a self-study scenario, an examination scenario, and a drill scenario; The self-learning scenario at least includes three-dimensional primary scene simulation, three-dimensional secondary scene simulation, monitoring system simulation, signal simulation, and equipment PC simulation functions; The load distribution in the self-study scenario is positively correlated with the number of concurrent students participating in the self-study scenario at the same time; The amount of load distribution in the test scenario is positively correlated with the range of test task settings in the simulation case and has nothing to do with the number of students; The amount of load distribution in the exercise scenario is positively correlated with the size of the simulated power grid and the number of dispatch operations; Wherein, the scale of the simulated power grid is determined based on the sum of the dispatching areas of all the actors in the exercise scenario; The deployment module is used to construct access paths for workloads according to different load types in each scenario, and deploy container ports corresponding to the access paths of the workloads; The calling module pre-queries and generates the resource type of each available server based on the K8S platform, and records the resource type and available load of each available server in the resource data table; Each piece of data in the resource data table includes the address of the server, a resource type provided by the server, and the available load of the resource type, and the resource data table is dynamically updated; Predicting the load required for each scenario and each load in advance, and storing the predicted load for each scenario and each load in a predicted load table; Track the dynamic changes of scenarios, concurrent numbers, and simulation scales in the multi-scenario training and drill system, and call the predicted load table to query the current load demand. If the current load demand exceeds the current configured load, update the resource data table in real time and use the resource data table for dynamic load calls.

4. According to claim 3, a system for building a multi-scenario training and drill application based on the K8S platform is characterized in that: In the allocation module, 3Dserver load, training exercise load and WebSocketServer load are allocated based on the functional type of each scene; and Split one or more loads whose load scales are higher than a threshold according to the load scales of the 3Dserver load, the training and exercise load, and the WebSocketServer load obtained by each scenario allocation; The splitting is achieved based on the training and exercise application functions carried by one or more loads.