A method, apparatus and medium for evaluating cloud platform host parameters
By using a visitor pattern architecture to evaluate cloud host parameters, this approach solves the problem of low efficiency in cloud platform host parameter evaluation in existing technologies, and enables efficient evaluation and expansion of parameters for different types of cloud hosts without changing the source code.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- JINAN INSPUR DATA TECH CO LTD
- Filing Date
- 2022-06-30
- Publication Date
- 2026-06-30
Smart Images

Figure CN115061822B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of cloud computing, and in particular to a method, apparatus and medium for evaluating cloud platform host parameters. Background Technology
[0002] In the era of cloud computing, an increasing number of business systems are deployed on cloud virtual machines, and cloud management platforms are playing an increasingly important role. The services offered by cloud management platforms are becoming more comprehensive, and their functions are becoming more numerous. This presents increasing challenges for cloud management platform developers. Among the feedback from many users, some issues are not actually problems with the cloud platform itself. For example, a user selects a large image, but the system disk is configured too small. The cloud platform can just barely create the cloud host, but during use, the system disk becomes insufficient, requiring expansion. Therefore, cloud platforms need to develop a system that evaluates cloud host parameters and provides suggestions based on the results.
[0003] The traditional approach involves making a series of judgments based on the virtual machine's parameters, such as chip type, operating system, and virtualization type. Then, for each specific type, the cloud host's central processing unit (CPU), memory, disk, and network are evaluated to determine their suitability. The evaluation parameters differ for each type, making the code logic extremely complex. Adding a new cloud host type or evaluation item is not a simple task; it requires modifying the existing code, significantly reducing the efficiency of cloud host parameter evaluation.
[0004] Therefore, how to conveniently evaluate cloud platform host parameters and improve the efficiency of cloud host parameter evaluation is a technical problem that urgently needs to be solved by those skilled in the art. Summary of the Invention
[0005] The purpose of this application is to provide a method, apparatus, and medium for evaluating cloud platform host parameters, so as to improve the efficiency of evaluating cloud host parameters.
[0006] To address the aforementioned technical problems, this application provides a method for evaluating cloud platform host parameters, comprising:
[0007] Obtain the type of cloud server to be evaluated;
[0008] Obtain the corresponding evaluation parameters based on the cloud host type;
[0009] The evaluation parameters are evaluated using a visitor-pattern architecture; wherein the visitor-pattern architecture includes pre-registered cloud host type, evaluation parameters, and evaluation logic corresponding to the evaluation parameters.
[0010] Output the evaluation results.
[0011] Preferably, the evaluation of the evaluation parameters using the visitor pattern architecture includes:
[0012] Construct a stack data structure based on the evaluation parameters;
[0013] Starting with the first evaluation parameter in the stack data structure, each evaluation parameter is evaluated sequentially using the visitor pattern architecture.
[0014] Preferably, the output evaluation results include:
[0015] The evaluation results corresponding to each of the evaluation parameters are stored in the database;
[0016] Determine whether the number of evaluation parameters in the stack data structure is 0;
[0017] If so, then each evaluation result is extracted from the database;
[0018] If not, then return to the step of evaluating each of the evaluation parameters sequentially using the visitor pattern architecture, starting with the first evaluation parameter in the stack data structure.
[0019] Preferably, after evaluating each of the evaluation parameters sequentially using the visitor pattern architecture, starting from the first evaluation parameter in the stack data structure, the method further includes:
[0020] Starting from the beginning of evaluating the first evaluation parameter in the stack data structure, determine whether the number of evaluation parameters in the stack data structure is 0 within a preset time period;
[0021] If so, proceed to the step of outputting the evaluation result;
[0022] If not, return to the step of obtaining the type of cloud host to be evaluated.
[0023] Preferably, the cloud host types to be evaluated are multiple, and before evaluating the evaluation parameters using the visitor-pattern architecture, the following steps are also included:
[0024] The evaluation parameters of each cloud host to be evaluated are converted into parameters in a preset format.
[0025] Preferably, after the output evaluation result, the following is also included:
[0026] The evaluation results are then labeled.
[0027] Preferably, after the output evaluation result, the following is also included:
[0028] The corresponding evaluation parameters are changed based on the evaluation results.
[0029] To address the aforementioned technical problems, this application also provides an apparatus for evaluating cloud platform host parameters, comprising:
[0030] The first acquisition module is used to acquire the type of cloud host to be evaluated;
[0031] The second acquisition module is used to acquire the corresponding evaluation parameters according to the cloud host type;
[0032] An evaluation module is used to evaluate the evaluation parameters using a visitor-mode architecture; wherein the visitor-mode architecture includes pre-registered cloud host types, evaluation parameters, and evaluation logic corresponding to the evaluation parameters.
[0033] The output module is used to output the evaluation results.
[0034] To address the aforementioned technical problems, this application also provides an apparatus for evaluating cloud platform host parameters, comprising:
[0035] Memory, used to store computer programs;
[0036] A processor is used to implement the steps of the above-described method for evaluating cloud platform host parameters when executing the computer program.
[0037] To address the aforementioned technical problems, this application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the aforementioned cloud platform host parameter evaluation method.
[0038] The method for evaluating cloud platform host parameters provided in this application includes: obtaining the type of cloud host to be evaluated; obtaining the corresponding evaluation parameters according to the cloud host type; evaluating the evaluation parameters using a visitor pattern architecture; wherein the visitor pattern architecture includes pre-registered cloud host types, evaluation parameters, and evaluation logic corresponding to the evaluation parameters; and outputting the evaluation results. Since the visitor pattern provides a unified `accept` method for each virtualization type (cloud host type) and each evaluation item (evaluation parameter) implements a `visit` method for each virtualization type, this method, by using a visitor pattern architecture to evaluate cloud host parameters, can evaluate parameters of different types of cloud hosts without changing the source code, thus improving the efficiency of cloud host parameter evaluation.
[0039] In addition, this application also provides an apparatus for evaluating cloud platform host parameters and a computer-readable storage medium, which have the same or corresponding technical features as the cloud platform host parameter evaluation method mentioned above, and have the same effect. Attached Figure Description
[0040] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0041] Figure 1 This is a schematic diagram illustrating traditional methods for evaluating cloud server parameters.
[0042] Figure 2 A flowchart illustrating a method for evaluating cloud platform host parameters provided in this application embodiment;
[0043] Figure 3 A structural diagram of a cloud platform host parameter evaluation apparatus provided in an embodiment of this application;
[0044] Figure 4 A structural diagram of an apparatus for evaluating cloud platform host parameters provided in another embodiment of this application;
[0045] Figure 5 A schematic diagram illustrating a cloud platform host parameter evaluation method provided in an embodiment of this application;
[0046] Figure 6 This is an overall flowchart of a cloud platform host parameter evaluation method provided in this embodiment. Detailed Implementation
[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0048] In the era of cloud computing, more and more business systems are deployed on cloud virtual machines, and cloud management platforms are playing an increasingly important role. The services offered by cloud management platforms are becoming more comprehensive, and their functions are becoming more numerous. This presents increasing challenges for cloud management platform developers. Among the feedback from many users, some problems are not actually "cloud platform" issues. For example, a user selects a large image, but the system disk is configured too small. The cloud platform can just barely create a cloud host, but during use, the system disk becomes insufficient, requiring expansion. Another example is that some virtual machines virtualized from domestic servers require larger CPUs and memory to run smoothly. Users are not entirely clear about the appropriateness of their selected configurations when creating cloud hosts. The cloud platform can successfully create a cloud host, but the resulting host is unusable. This necessitates the development of a system for cloud platforms to evaluate cloud host parameters and provide suggestions. The traditional approach involves making a series of judgments based on the virtual machine's parameters—what type of chip, operating system, and virtualization type—and then evaluating the appropriateness of the cloud host's CPU, memory, disk, and network for each specific type. The evaluation parameters differ for each type, making the code logic extremely complex. Figure 1 This is a schematic diagram illustrating traditional methods for evaluating cloud server parameters. (Example:) Figure 1 As shown, the virtualization type is the cloud host type, such as OpenStack, VMware, and KVW; the chip type is determined, such as Intel or Phytium; and the evaluation items include CPU evaluation and hard disk evaluation. After evaluating each item, the evaluation result is output. In traditional cloud host parameter evaluation methods, adding a new cloud host type or evaluation item is not a simple matter and requires modification of the original code. Therefore, this application first abstracts different cloud host types and evaluation items into an interface, and all cloud host types and evaluation items implement the corresponding interface, solving the problem of difficult expansion. Then, an evaluator is designed using the visitor pattern, which different types of cloud hosts can access to provide evaluation results, solving the problem of complex code structure and evaluating cloud platform host parameters in a simple way.
[0049] The core of this application is to provide a method, apparatus, and medium for evaluating cloud platform host parameters, which can improve the efficiency of cloud host parameter evaluation.
[0050] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments. Figure 2 A flowchart illustrating a method for evaluating cloud platform host parameters provided in this application embodiment is shown below. Figure 2 As shown, the method includes:
[0051] S10: Obtain the type of cloud host to be evaluated.
[0052] Different cloud host types and evaluation items are abstracted into a single upper-level interface for different cloud host types and evaluation items to implement. Cloud host types include OpenStack, x86 architecture cloud hosts, VMware virtualization types, Phytium cloud hosts, etc.
[0053] S11: Obtain the corresponding evaluation parameters based on the cloud host type.
[0054] Different cloud server types may require different evaluation parameters, so the corresponding evaluation parameters should be obtained based on the cloud server type. Evaluation parameters, also known as evaluation items, include CPU evaluation, hard disk evaluation, and network evaluation, etc.
[0055] S12: The evaluation parameters are evaluated using a visitor pattern architecture; wherein, the visitor pattern architecture includes pre-registered cloud host types, evaluation parameters, and evaluation logic corresponding to the evaluation parameters.
[0056] S13: Output the evaluation results.
[0057] The basic idea of the Visitor pattern is that a software system has a relatively stable object structure composed of many objects. Each class of these objects has an `accept` method to accept visits from visitor objects. The visitor is an interface with a `visit` method. This method handles different types of elements in the visited object structure differently. During a single visit to the object structure, the entire object structure is traversed, and the `accept` method is applied to each element. Within each element's `accept` method, the visitor's `visit` method is called, allowing the visitor to process each element of the object structure. Different visitor classes can be designed for different object structures to perform different operations, achieving differentiated treatment. In this embodiment, each virtualization type implementation class has a unified `accept` method that calls the evaluation interface's `visit` method. Each evaluation item implementation class implements a `visit` method specific to each virtualization type, implementing the specific evaluation logic. Implement a unified validator class, `paramsCheckor`, using the visitor pattern architecture. Here, you can add the cloud host to be validated and the evaluation type, and implement a unified `check` method to perform the cloud host evaluation logic. After evaluating the parameters, output the evaluation result.
[0058] The cloud platform host parameter evaluation method provided in this embodiment includes: obtaining the cloud host type to be evaluated; obtaining the corresponding evaluation parameters according to the cloud host type; evaluating the evaluation parameters using a visitor pattern architecture; wherein the visitor pattern architecture includes pre-registered cloud host types, evaluation parameters, and evaluation logic corresponding to the evaluation parameters; and outputting the evaluation results. Since there is a unified accept method for virtualization types (cloud host types) in the visitor pattern, and each evaluation item (evaluation parameter) has a visit method implemented for each virtualization type, this method, by using a visitor pattern architecture to evaluate cloud host parameters, can evaluate various parameters of different types of cloud hosts without changing the source code.
[0059] To address the issue of requiring code modifications to execute when adding new evaluation items, a preferred implementation is to use a visitor pattern architecture to evaluate the evaluation parameters, including:
[0060] Construct a stack data structure based on the evaluation parameters;
[0061] Starting with the first evaluation parameter in the stack data structure, the visitor pattern architecture is used to evaluate each parameter sequentially.
[0062] The `paramsCheckor` class is designed using the decorator pattern, allowing repeated calls to the `check` method for evaluation. Therefore, the evaluation items in `paramsCheckor` are structured as a stack. In each iteration, an evaluation item is removed from the stack and evaluated until the stack is empty. A stack, as a data structure, is a special linear list where insertion and deletion operations are only allowed at one end. It stores data according to the Last-In-First-Out (LIFO) principle; the first item entered is pushed onto the bottom of the stack, and the last item is at the top. When data needs to be read, it is popped from the top, with the last item being read first. If the evaluation items include CPU evaluation, disk evaluation, and network evaluation, these parameters are structured as a stack, and the visitor pattern is used to evaluate these three parameters sequentially.
[0063] The embodiment provides a stack data structure for the evaluation parameters. Each time the loop runs, an evaluation item is taken out of this stack for evaluation. This allows the check method to be called repeatedly to achieve repeated evaluation, solving the problem that adding new evaluation items requires code modification before execution.
[0064] In practice, to improve the evaluation speed, a preferred implementation method is to output the evaluation results including:
[0065] Store the evaluation results corresponding to each evaluation parameter in the database;
[0066] Determine if the number of evaluation parameters in the stack data structure is 0;
[0067] If so, extract the evaluation results from the database;
[0068] If not, return to the steps of evaluating each parameter sequentially using the visitor pattern architecture, starting from the first evaluation parameter in the stack data structure.
[0069] If the evaluation result of the current evaluation parameter is abnormal, the current evaluation parameter may be modified before evaluating the next evaluation parameter. When there are many evaluation parameters corresponding to a cloud host, multiple evaluation parameters may be abnormal. In this case, if the evaluation parameters with abnormal results are modified sequentially, it may take a long time to complete the evaluation of all evaluation parameters. Therefore, in this embodiment, after all evaluation parameters have been evaluated, the abnormal evaluation parameters are modified uniformly. Specifically, the determination of whether all evaluation parameters have been evaluated can be based on the number of evaluation parameters in the stack data structure. If the number of evaluation parameters in the stack data structure is 0, it means that all evaluation parameters have been evaluated. After each evaluation parameter is evaluated, the corresponding evaluation result is stored in the database until all evaluation parameters have been evaluated, and then the stored evaluation results are retrieved from the database.
[0070] The method of outputting evaluation results provided in this embodiment can improve the efficiency of evaluating cloud platform host parameters.
[0071] During the evaluation of cloud platform host parameters, it may take a considerable amount of time before the evaluation is completed. Therefore, to alleviate the long wait for users to receive the evaluation results, a preferred implementation method is to evaluate each parameter sequentially using a visitor pattern architecture, starting from the first evaluation parameter in the stack data structure. This process also includes:
[0072] Starting from the first evaluation parameter in the stack data structure, determine whether the number of evaluation parameters in the stack data structure is 0 within a preset time.
[0073] If so, proceed to the step of outputting the evaluation results;
[0074] If not, return to the step of obtaining the type of cloud server to be evaluated.
[0075] The specific value of the preset time is not limited and can be determined based on the actual situation. To set a more reasonable preset time, it can be determined based on the number of evaluation parameters and the evaluation method for each parameter. When the number of evaluation parameters in the stack data structure is 0 within the preset time, it means that all evaluation parameters have been evaluated and the evaluation result can be output. When the number of evaluation parameters in the stack data structure is not 0 within the preset time, it means that the evaluation of all evaluation parameters has not been completed within the preset time, and there may be an anomaly in the evaluation process. Therefore, return to the step of obtaining the cloud host type to be evaluated and start evaluating the cloud host parameters again.
[0076] The method provided in this embodiment, which returns to the step of obtaining the type of cloud host to be evaluated if the evaluation of cloud host parameters is not completed within a preset time, can promptly handle abnormalities in the evaluation process and avoid users waiting for evaluation results for a long time.
[0077] In implementation, the formats of evaluation parameters for different cloud servers may differ. Therefore, in order to use a unified evaluation method to evaluate the parameters of different cloud servers, a preferred implementation method is to evaluate multiple types of cloud servers. Before evaluating the evaluation parameters using the visitor pattern architecture, the following steps are also included:
[0078] Convert the evaluation parameters of each cloud host to be evaluated into parameters in a preset format.
[0079] There are no restrictions on the preset format; it should be determined based on the actual situation. When implementing cloud server parameter evaluation, the cloud server parameters are first converted into parameters in a preset format, then the preset format parameters are added to the checker class, and finally the estimate method is called to perform the evaluation and return the result.
[0080] This embodiment provides a method to convert the evaluation parameters of each cloud host to be evaluated into parameters in a preset format, so that the parameters of the cloud hosts to be evaluated can be evaluated in a unified manner.
[0081] In practice, to provide a clear understanding of the evaluation results, a preferred implementation method includes, after outputting the evaluation results, the following:
[0082] The evaluation results are labeled.
[0083] There are no restrictions on how the evaluation results are labeled; the method should be determined based on the actual situation. For example, when there are multiple cloud servers, the same label can be used to display the evaluation results for each cloud server parameter; cloud server parameters with abnormal evaluation results can be highlighted; the same label can be used to display the evaluation results for the same cloud server parameter on different cloud servers; alternatively, only cloud server parameters with abnormal evaluation results can be labeled. After outputting the evaluation results, the corresponding evaluation parameters can be modified based on the results to allow for more reasonable configuration of the cloud server parameters. For example, if the evaluation results show that the memory capacity is set too low, a larger memory capacity can be configured.
[0084] This embodiment provides a method to mark the evaluation results after the data evaluation, so that users can directly understand the evaluation results of the cloud host parameters based on the marks; by changing the corresponding evaluation parameters according to the evaluation results, the cloud host parameters can be configured more reasonably.
[0085] In the above embodiments, the method for evaluating cloud platform host parameters has been described in detail. This application also provides embodiments corresponding to the apparatus for evaluating cloud platform host parameters. It should be noted that this application describes the embodiments of the apparatus from two perspectives: one is based on functional modules, and the other is based on hardware.
[0086] Figure 3 A structural diagram of a cloud platform host parameter evaluation apparatus provided in one embodiment of this application. This embodiment, based on functional modules, includes:
[0087] The first acquisition module 10 is used to acquire the type of cloud host to be evaluated;
[0088] The second acquisition module 11 is used to acquire the corresponding evaluation parameters according to the cloud host type;
[0089] Evaluation module 12 is used to evaluate the evaluation parameters using a visitor-mode architecture; wherein the visitor-mode architecture includes pre-registered cloud host types, evaluation parameters, and evaluation logic corresponding to the evaluation parameters.
[0090] Output module 13 is used to output the evaluation results.
[0091] Since the embodiments of the apparatus and the embodiments of the method correspond to each other, please refer to the description of the embodiments of the method for the embodiments of the apparatus, which will not be repeated here.
[0092] The cloud platform host parameter evaluation apparatus provided in this embodiment obtains the cloud host type to be evaluated through a first acquisition module; obtains the corresponding evaluation parameters according to the cloud host type through a second acquisition module; evaluates the evaluation parameters using a visitor-mode architecture through an evaluation module; wherein the visitor-mode architecture includes pre-registered cloud host types, evaluation parameters, and evaluation logic corresponding to the evaluation parameters; and outputs the evaluation results through an output module. Since there is a unified accept method for virtualization types (cloud host types) in the visitor mode, and each evaluation item (evaluation parameter) has a visit method implemented for each virtualization type, this apparatus, by using a visitor-mode architecture to evaluate cloud host parameters, can evaluate various parameters of different types of cloud hosts without changing the source code.
[0093] Figure 4 This is a structural diagram of a cloud platform host parameter evaluation apparatus provided in another embodiment of this application. This embodiment is based on a hardware perspective, such as... Figure 4 As shown, the device for evaluating cloud platform host parameters includes:
[0094] Memory 20 is used to store computer programs;
[0095] The processor 21 is used to execute computer programs to implement the steps of the cloud platform host parameter evaluation method mentioned in the above embodiments.
[0096] The device for evaluating cloud platform host parameters provided in this embodiment may include, but is not limited to, smartphones, tablets, laptops, or desktop computers.
[0097] The processor 21 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 21 may be implemented using at least one of the following hardware forms: Digital Signal Processor (DSP), Field-Programmable Gate Array (FPGA), or Programmable Logic Array (PLA). The processor 21 may also include a main processor and a coprocessor. The main processor, also known as the CPU, is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 21 may integrate a Graphics Processing Unit (GPU), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 21 may also include an Artificial Intelligence (AI) processor, which is used to handle computational operations related to machine learning.
[0098] The memory 20 may include one or more computer-readable storage media, which may be non-transitory. The memory 20 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 20 is used to store at least the following computer program 201, which, after being loaded and executed by the processor 21, is capable of implementing the relevant steps of the cloud platform host parameter evaluation method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 20 may also include an operating system 202 and data 203, and the storage method may be temporary or permanent storage. The operating system 202 may include Windows, Unix, Linux, etc. The data 203 may include, but is not limited to, the data involved in the aforementioned cloud platform host parameter evaluation method.
[0099] In some embodiments, the apparatus for evaluating cloud platform host parameters may further include a display screen 22, an input / output interface 23, a communication interface 24, a power supply 25, and a communication bus 26.
[0100] Those skilled in the art will understand that Figure 4 The structure shown does not constitute a limitation on the apparatus for evaluating cloud platform host parameters and may include more or fewer components than shown.
[0101] The cloud platform host parameter evaluation apparatus provided in this application includes a memory and a processor. When the processor executes the program stored in the memory, it can implement the following method: cloud platform host parameter evaluation method, with the same effect as above.
[0102] Finally, this application also provides an embodiment corresponding to a computer-readable storage medium. The computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps described in the above method embodiments.
[0103] It is understood that if the methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0104] The computer-readable storage medium provided in this application includes the cloud platform host parameter evaluation method mentioned above, and has the same effect.
[0105] To enable those skilled in the art to better understand the technical solution of this application, the following description is provided in conjunction with the appendix. Figure 5 and appendix Figure 6 This application will now provide a more detailed description of the above. Figure 5 This is a schematic diagram illustrating a cloud platform host parameter evaluation method provided in an embodiment of this application. Figure 5 As shown, the virtual machine types evaluated are kvmLinuxVm and openstack, which can be denoted as vmType1 vm and vmType2 vm, respectively. The evaluation parameters include CPU and disk. The parameters are validated for each virtual machine type. The CPU evaluation results and disk evaluation results of vmType1vm and vmType2vm are output respectively.
[0106] Figure 6 This is an overall flowchart of a cloud platform host parameter evaluation method provided in this embodiment. Figure 6 As shown, the method includes:
[0107] S14: Obtain the corresponding evaluation item based on the type;
[0108] S15: Register parameters with the checkor according to addVmParams;
[0109] S16: Call the addEstimates method to register the evaluation items with the checker;
[0110] S17: Call the accept method of checkor, passing in the first item in the evaluation item queue. If the evaluation item queue is empty, return the corresponding score and information directly.
[0111] S18: Output the evaluation results and provide suggestions for changing the parameters.
[0112] Therefore, this method first abstracts different cloud host types and evaluation items into an interface, and all cloud host types and evaluation items implement the corresponding interface, solving the problem of difficult expansion. An evaluator is designed using the visitor pattern, allowing different types of cloud hosts to access the evaluator and receive evaluation results, thus solving the problem of complex code structure. This evaluator is also developed based on decorators, allowing it to call itself multiple times for continuous evaluation. Internally, a list of evaluators is maintained using a stack data structure, performing evaluations sequentially in a loop, solving the problem of needing to modify code to execute new evaluation items. It can also be understood as decoupling multiple cloud host types and evaluation items. The visitor pattern architecture allows for custom evaluation items for different types of cloud hosts without changing the source code. When executing multiple evaluation items, the innovative use of the decorator pattern for recursive execution ultimately yields the evaluation result, making it convenient for users. The biggest advantage of this architecture is its scalability; adding cloud host types or evaluation items does not require modifying the original code, only adding the corresponding implementation class.
[0113] The foregoing has provided a detailed description of a method, apparatus, and medium for evaluating cloud platform host parameters provided in this application. The various embodiments in the specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section. It should be noted that those skilled in the art can make several improvements and modifications to this application without departing from the principles of this application, and these improvements and modifications also fall within the protection scope of the claims of this application.
[0114] It should also be noted that, in this specification, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.
Claims
1. A method for evaluating cloud platform host parameters, characterized in that, include: Obtain the type of cloud server to be evaluated; Obtain the corresponding evaluation parameters according to the cloud host type; wherein, the evaluation parameters are used to characterize the evaluation items, including at least CPU evaluation parameters, hard disk evaluation parameters and network evaluation parameters; different cloud host types and evaluation items are abstracted into a high-level interface for different cloud host types and evaluation items to implement; an evaluator is designed using the visitor pattern, which can be accessed by different types of cloud hosts to provide evaluation results; The evaluation parameters are evaluated using a visitor-pattern architecture; wherein the visitor-pattern architecture includes pre-registered cloud host type, evaluation parameters, and evaluation logic corresponding to the evaluation parameters. Output the evaluation results; In the visitor pattern, there is a unified accept method for each cloud host type, and each evaluation parameter has a visit method implemented for each virtualization type. This allows the cloud host parameter evaluation using the visitor pattern architecture to evaluate the parameters of different types of cloud hosts without changing the source code, thus improving the efficiency of cloud host parameter evaluation. The evaluation of the evaluation parameters using the visitor pattern architecture includes: Construct a stack data structure based on the evaluation parameters; Starting with the first evaluation parameter in the stack data structure, the visitor pattern architecture is used to evaluate each evaluation parameter sequentially. The paramsCheckor class is designed as a decorator pattern, and repeated evaluation is achieved by repeatedly calling the check method. By making the evaluation items in the paramsCheckor class into a stack data structure, one evaluation item is taken out from the stack data structure for evaluation in each loop until there are no evaluation items in the queue. The output evaluation results include: The evaluation results corresponding to each of the evaluation parameters are stored in the database; Determine whether the number of evaluation parameters in the stack data structure is 0; If so, then each evaluation result is extracted from the database; If not, then return to the step of evaluating each of the evaluation parameters sequentially using the visitor pattern architecture, starting from the first evaluation parameter in the stack data structure; After evaluating each of the evaluation parameters sequentially using the visitor pattern architecture, starting with the first evaluation parameter in the stack data structure, the method further includes: Starting from the beginning of evaluating the first evaluation parameter in the stack data structure, determine whether the number of evaluation parameters in the stack data structure is 0 within a preset time period; If so, proceed to the step of outputting the evaluation result; If not, return to the step of obtaining the type of cloud host to be evaluated; The cloud host types to be evaluated are multiple, and before evaluating the evaluation parameters using the visitor-pattern architecture, the following is also included: The evaluation parameters of each cloud host to be evaluated are converted into parameters in a preset format. After converting the cloud host parameters into preset format parameters, the preset format parameters are added to the checker class. Finally, the estimate method is called to perform the evaluation and return the result.
2. The method for evaluating cloud platform host parameters according to claim 1, characterized in that, Following the output evaluation results, the following is also included: The evaluation results are then labeled.
3. The method for evaluating cloud platform host parameters according to claim 1 or 2, characterized in that, Following the output evaluation results, the following is also included: The corresponding evaluation parameters are changed based on the evaluation results.
4. A device for evaluating cloud platform host parameters, characterized in that, include: The first acquisition module is used to acquire the type of cloud host to be evaluated; The second acquisition module is used to acquire the corresponding evaluation parameters according to the cloud host type; wherein, the evaluation parameters are used to characterize the evaluation items, including at least CPU evaluation parameters, hard disk evaluation parameters and network evaluation parameters; different cloud host types and evaluation items are abstracted into a high-level interface for different cloud host types and evaluation items to implement; an evaluator is designed using the visitor pattern, which can be accessed by different types of cloud hosts to provide evaluation results; An evaluation module is used to evaluate the evaluation parameters using a visitor-mode architecture; wherein the visitor-mode architecture includes pre-registered cloud host types, evaluation parameters, and evaluation logic corresponding to the evaluation parameters. The output module is used to output the evaluation results. In the visitor pattern, there is a unified accept method for each cloud host type, and each evaluation parameter has a visit method implemented for each virtualization type. This allows the cloud host parameter evaluation using the visitor pattern architecture to evaluate the parameters of different types of cloud hosts without changing the source code, thereby improving the efficiency of cloud host parameter evaluation. The evaluation module is specifically used for: Construct a stack data structure based on the evaluation parameters; Starting with the first evaluation parameter in the stack data structure, the visitor pattern architecture is used to evaluate each evaluation parameter sequentially. The paramsCheckor class is designed as a decorator pattern, and repeated evaluation is achieved by repeatedly calling the check method. By making the evaluation items in the paramsCheckor class into a stack data structure, one evaluation item is taken out from the stack data structure for evaluation in each loop until there are no evaluation items in the queue. The output module is specifically used for: The evaluation results corresponding to each of the evaluation parameters are stored in the database; Determine whether the number of evaluation parameters in the stack data structure is 0; If so, then each evaluation result is extracted from the database; If not, then return to the step of evaluating each of the evaluation parameters sequentially using the visitor pattern architecture, starting from the first evaluation parameter in the stack data structure; Also includes: Starting from the beginning of evaluating the first evaluation parameter in the stack data structure, determine whether the number of evaluation parameters in the stack data structure is 0 within a preset time period; If so, the output module is triggered; If not, then the first acquisition module is triggered; The cloud host types to be evaluated are multiple, and before evaluating the evaluation parameters using the visitor-pattern architecture, the following is also included: The evaluation parameters of each cloud host to be evaluated are converted into parameters in a preset format. After converting the cloud host parameters into preset format parameters, the preset format parameters are added to the checker class. Finally, the estimate method is called to perform the evaluation and return the result.
5. An apparatus for evaluating cloud platform host parameters, characterized in that, include: Memory, used to store computer programs; A processor, configured to implement the steps of the method for evaluating cloud platform host parameters as described in any one of claims 1 to 3 when executing the computer program.
6. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the cloud platform host parameter evaluation method as described in any one of claims 1 to 3.