Application management method and device, storage medium and electronic device
By creating virtual servers within containers and utilizing an API gateway to distribute access requests, the complexity of backend application development processes is resolved, thereby improving application development efficiency.
Patent Information
- Application Number
- CN202210278130.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-03-21
- Publication Date
- 2026-02-24
- Estimated Expiration
- 2042-03-21
AI Technical Summary
In the process of developing backend applications, the development process is complex, resulting in low application development efficiency, and existing technologies have not been able to effectively solve this problem.
Create virtual servers in the target container that correspond to the business logic code of the target application, and distribute access requests to the virtual servers or service layers through the API gateway. This simplifies the programming of general services for developers, allowing them to program only some services in the backend.
It simplifies the development process of large-scale backend applications, improves application development efficiency, and saves manpower and time costs.
Smart Images

Figure CN116827925B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of computer network technology, and more specifically, to an application management method and apparatus, a storage medium, and an electronic device. Background Technology
[0002] In internet application scenarios, the ability to support large-scale online users in the backend is crucial. This typically requires capabilities in backend development, distributed architecture design, and cloud computing resource deployment, placing high demands on developers. In particular, during backend application development, developers need to design code for the target application's general services, core service modules, resource configurations, and backend architecture, making the development process complex and time-consuming, resulting in low application development efficiency.
[0003] There is currently no effective solution to the above problems. Summary of the Invention
[0004] This invention provides an application management method and apparatus, storage medium and electronic device to at least solve the technical problem of low efficiency that occurs during application development.
[0005] According to one aspect of the present invention, an application management method is provided, comprising: when the application of a target application is published to a target container, creating a virtual server in the target container corresponding to the business logic code of the target application, wherein the application includes the business logic code of the target application, and the virtual server is used to provide a first set of services to clients of the target application; configuring a second set of services on a preset service layer for the application, wherein the services in the second set of services are services provided to clients of the target application; configuring an application programming interface (API) gateway for the application, wherein the API gateway is used to distribute access requests sent by clients of the target application to the virtual server or the service layer in the target container according to the services requested by the clients of the target application; obtaining a target access request sent by the clients of the target application on the API gateway, wherein the target access request carries a target field corresponding to the target service requested for access; if the target service is determined to be a service in the first set of services based on the target field, distributing the target access request to the virtual server in the target container; and if the target service is determined to be a service in the second set of services based on the target field, distributing the target access request to the service layer.
[0006] Optionally, the above method further includes: when the target access request is distributed to a virtual server in the target container, executing the service logic corresponding to the target service through the virtual server to obtain a first execution result; when the target access request is distributed to the service layer, executing the service logic corresponding to the target service through the service layer to obtain a second execution result.
[0007] Optionally, the above method further includes: when the application of the target application is published to the target container, configuring a preset set of target resources on the resource layer for the application, wherein the resources in the set of target resources are resources that can be used by the virtual server; when the target access request sent by the client of the target application obtained on the API gateway is distributed to the virtual server in the target container, executing the service logic corresponding to the target service through the virtual server, and when the target resource in the set of target resources needs to be used when executing the service logic corresponding to the target service, performing the corresponding target operation on the target resource, wherein the target access request is used to request access to the target service in the first service set.
[0008] Optionally, when the target resource in the target resource set is required to perform the service logic corresponding to the target service, the target operation performed on the target resource includes at least one of the following: if the target resource set includes target resources required to create the target database, create the target database using the target resources, wherein the target database is the database required to be created when performing the service logic corresponding to the target service; if the target resource set includes target resources required to store the first data and the target resources include a first storage space, store the first data in the first storage space; if the target resource set includes target resources required to access the second data and the target resources include a second storage space for storing the second data, access the second data stored in the second storage space.
[0009] Optionally, the above method further includes: configuring a target event trigger for a virtual server when the application of the target application is published to the target container, wherein the target event trigger is used to trigger a target event to the virtual server after the target service corresponding to the target event trigger in the second service set has been executed, and the virtual server is used to perform a target operation in response to the target event.
[0010] Optionally, after configuring the target event trigger for the virtual server, the method further includes: obtaining the target access request sent by the client of the target application on the API gateway, wherein the target access request is used to request access to the target service; if the target service is a service in the second service set, distributing the target access request to the service layer; after the service logic corresponding to the target service is executed through the service layer and the execution is completed, triggering the target event to the virtual server, and responding to the target event, executing the target operation through the virtual server.
[0011] Optionally, the above method further includes: configuring an internal gateway for the virtual server when the application of the target application is published into the target container, wherein the internal gateway is used to allow the virtual server to access services in the second set of services.
[0012] Optionally, after configuring an internal gateway for the virtual server, the method further includes: when the target access request sent by the client of the target application obtained on the API gateway is distributed to the virtual server in the target container, the service logic corresponding to the target service is executed through the virtual server; when the service logic corresponding to the target service needs to access the services in the second service set, the access operation is performed on the services in the second service set, wherein the target access request is used to request access to the target service in the first service set.
[0013] Optionally, the above method further includes: configuring a scaling strategy for the virtual server when the application of the target application is published to the target container, wherein the scaling strategy is used to dynamically adjust the computing resources and / or storage resources used by the virtual server according to the access volume of the virtual server.
[0014] According to another aspect of the present invention, an application management apparatus is also provided, comprising: a first processing unit, configured to create a virtual server corresponding to the business logic code of the target application in the target container when the application of the target application is published to the target container, wherein the application includes the business logic code of the target application, and the virtual server is used to provide a first service set for the client of the target application; a first configuration unit, configured to configure a second service set on a preset service layer for the application, wherein the services in the second service set are services provided for the client of the target application; and a second processing unit, configured to configure an application programming interface (API) gateway for the application, wherein the API gateway is used for root... The system comprises four parts: a first processing unit and a second processing unit. The first processing unit distributes the access request sent by the client of the target application to a virtual server or service layer within the target container, based on the requested service. The second processing unit is configured to: 1) obtain the target access request sent by the client of the target application on the API gateway, wherein the target access request carries a target field corresponding to the requested target service. The third processing unit is configured to: 2) distribute the target access request to a virtual server within the target container if the target service is determined to be a service in the first service set based on the target field. The fourth processing unit is configured to: 3) distribute the target access request to a service layer if the target service is determined to be a service in the second service set based on the target field.
[0015] Optionally, the management device for the above application further includes: a fifth processing unit, configured to execute the service logic corresponding to the target service through the virtual server when the target access request is distributed to the virtual server in the target container, and obtain a first execution result; and a sixth processing unit, configured to execute the service logic corresponding to the target service through the service layer when the target access request is distributed to the service layer, and obtain a second execution result.
[0016] Optionally, the management device for the above application further includes: a second configuration unit, configured to configure a preset set of target resources on the resource layer for the application when the application of the target application is published to the target container, wherein the resources in the target resource set are resources that can be used by the virtual server; and a seventh processing unit, configured to, when the target access request sent by the client of the target application obtained on the API gateway is distributed to the virtual server in the target container, execute the service logic corresponding to the target service through the virtual server, and when the target resources in the target resource set need to be used when executing the service logic corresponding to the target service, execute the corresponding target operation on the target resource through the internal gateway, wherein the target access request is used to request access to the target service in the first service set.
[0017] According to another aspect of the present invention, a computer-readable storage medium is also provided, wherein a computer program is stored in the computer program, wherein the computer program is configured to execute the management method of the above-described application program at runtime.
[0018] According to another aspect of the present invention, a computer program product is also provided, including a computer program / instructions that, when executed by a processor, implement the steps of the above-described method.
[0019] According to another aspect of the present invention, an electronic device is also provided, including a memory and a processor, wherein the memory stores a computer program and the processor is configured to execute a management method of the application program through the computer program.
[0020] In this embodiment of the invention, when the target application is published to a target container, a virtual server corresponding to the business logic code of the target application is created in the target container. Then, the backend services of the target application are categorized into services in a first service set and services in a second service set. The API gateway determines whether the service requested by the access request belongs to the first or second service set based on the target field corresponding to the requested service carried in the access request sent by the client of the target application. Based on the determination result, the access request is distributed to the virtual server or service layer. In other words, by adopting the technical solution in this embodiment of the invention, developers only need to program some of the backend services of the target application, while other backend services are directly encapsulated into general services and provided to developers. This avoids developers having to program general services, simplifies the development process of large-scale backend applications, and achieves the technical effect of improving application development efficiency. Attached Figure Description
[0021] The accompanying drawings, which are included to provide a further understanding of the invention and form part of this application, illustrate exemplary embodiments of the invention and, together with their description, serve to explain the invention and do not constitute an undue limitation thereof. In the drawings:
[0022] Figure 1 This is a schematic diagram illustrating an application scenario of an optional application management method according to an embodiment of the present invention;
[0023] Figure 2 This is a flowchart of an optional application management method according to an embodiment of the present invention;
[0024] Figure 3 This is an overall schematic diagram of an optional application management method according to an embodiment of the present invention;
[0025] Figure 4 This is a schematic diagram of an optional online shopping application management method according to an embodiment of the present invention;
[0026] Figure 5 This is a schematic diagram of an optional game application management method according to an embodiment of the present invention;
[0027] Figure 6 This is a flowchart of another optional application management method according to an embodiment of the present invention;
[0028] Figure 7 This is a flowchart of an optional client access service layer according to an embodiment of the present invention;
[0029] Figure 8 This is a flowchart of an optional client access to a virtual server according to an embodiment of the present invention;
[0030] Figure 9 This is a flowchart of an optional application event triggering according to an embodiment of the present invention;
[0031] Figure 10 These are flowcharts of application development in related technologies and flowcharts of an optional application development method in an embodiment of the present invention.
[0032] Figure 11 This is an overall schematic diagram of another optional application management method according to an embodiment of the present invention;
[0033] Figure 12 This is a schematic diagram of the structure of an optional application management device according to an embodiment of the present invention;
[0034] Figure 13 This is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present invention. Detailed Implementation
[0035] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort should fall within the scope of protection of the present invention.
[0036] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0037] According to one aspect of the present invention, an application management method is provided. As an optional implementation, the above-described application management method may be applied to, but is not limited to, applications such as... Figure 1 The application scenarios shown are as follows. In, for example... Figure 1 In the application scenario shown, the target terminal 102 can communicate with the backend device 106 via network 104, but is not limited to this. The backend device 106 can perform operations on the database 108, such as write or read data operations. The terminal device 102 may include, but is not limited to, a human-computer interaction screen, a processor, and a memory. The human-computer interaction screen may be, but is not limited to, an interface on the terminal device 102 for selecting or submitting the application of the target application to be released (e.g., a page for selecting the code corresponding to an online shopping application). The processor may be, but is not limited to, responding to the human-computer interaction operations, executing corresponding operations, or generating corresponding instructions and sending the generated instructions to the backend device 106. The memory is used to store relevant processing data, such as the business logic code of the target application, the custom interfaces of the target application, and the user data of the target application's client.
[0038] As an optional approach, the following steps in the application management method can be executed on the backend device 106 (which can be a terminal with data access and storage): Step S102, when the target application is published to the target container, create a virtual server in the target container corresponding to the business logic code of the target application; Step S104, configure a second service set on a preset service layer for the application, wherein the services in the second service set are services provided to the client of the target application; Step S106, configure an application programming interface (API) gateway for the application; Step S108, configure an application programming interface (API) gateway for the application, wherein the API gateway is used for root... Based on the service requested by the client of the target application, the access request sent by the client of the target application is distributed to the virtual server or service layer in the target container; Step S110: Obtain the target access request sent by the client of the target application on the API gateway, wherein the target access request carries a target field corresponding to the target service requested for access; Step S112: If it is determined from the target field that the target service is a service in the first service set, the target access request is distributed to the virtual server in the target container; Step S114: If it is determined from the target field that the target service is a service in the second service set, the target access request is distributed to the service layer.
[0039] By using the above method, developers only need to program some of the backend services of the target application, while the other backend services are directly encapsulated into general services and provided to developers. This avoids developers having to program the general services, simplifies the development process of large-scale backend applications, and achieves the technical effect of improving the development efficiency of applications.
[0040] As an optional example, this embodiment does not limit the execution subject of the above steps S102 to S112. Some or all of the above steps S102 to S112 can be executed on a device associated with the background device 106, such as a distributed server or server cluster connected to the background device.
[0041] According to one aspect of the present invention, an application management method is provided. Figure 2 This is a flowchart of an application management method according to an embodiment of the present invention, the process including the following steps:
[0042] Step S202: When the application of the target application is published to the target container, a virtual server corresponding to the business logic code of the target application is created in the target container. The application includes the business logic code of the target application, and the virtual server is used to provide a first set of services to the clients of the target application.
[0043] As an optional example, the target container described above can be, but is not limited to, an environment that runs applications independently of an operating system; or a technology for sharing computer resources and isolating operations, which has the advantages of small storage space occupation and fast startup. The technical solutions in the embodiments of the present invention can be, but are not limited to, based on container technology to realize the development and management of applications. The target container will be further described below with specific examples.
[0044] As an optional example, the target application mentioned above may include, but is not limited to, at least one of the following: a web application (e.g., a web application), a mobile application (APP), a game APP, etc. For each of the aforementioned applications, the business functions (also called services, such as user login in a shopping APP, game mode selection in a game APP, etc.) they possess will also differ. By running the business logic code written by the developer, the service logic corresponding to the target service can be executed, thereby realizing the user's target operation in the target application.
[0045] As an optional example, the above business logic can be, but is not limited to, the rules and processes that an entity should follow in order to provide services to another entity. For example, when shopping online using a shopping app, the following business logic can be set through the logic code written by the developer: an order can only be placed after the user has successfully logged in; after successful payment, the seller is notified to ship the goods, etc.
[0046] As an alternative example, the virtual server described above can, but is not limited to, divide a main server into multiple sub-servers. These sub-servers can be hosted on the same physical server via software architecture, and each virtual server can provide all the functions of the main server, such as web page creation, data transmission, and storage space.
[0047] Obviously, it is understandable that in this embodiment, the services provided by the target application to its clients differ depending on the application scenario. For example, as... Figure 4 As shown, for shopping apps, user login verification (F5) and user transaction information storage (F7) are common services, while adding to cart (F2) and order payment (F4) are core services. Therefore, the core services of a shopping app (such as...) Figure 4The set consisting of F1-F4 in the above is denoted as the first service set, and the above virtual server is used to provide the first service set to the client of the target application.
[0048] Step S204: Configure a second service set on a preset service layer for the application, wherein the services in the second service set are services provided for the client of the target application;
[0049] As an optional example, for Figure 4 The set consisting of login verification F5, user message storage F6, and user transaction information storage F7 is denoted as the second service set. Services in the second service set can be provided, but are not limited to, through methods such as... Figure 3 The developer platform 308 shown provides developers with interfaces for invocation, allowing them to use services in the second service set without writing code for those services. During application development, developers do not need to write code for the business logic corresponding to the services in the second service set, simplifying the development process and saving development time.
[0050] Step S206: Configure the application interface API gateway for the application. The API gateway is used to distribute the access requests sent by the client of the target application to the virtual server or service layer in the target container according to the service requested by the access request sent by the client of the target application.
[0051] As an optional example, such as Figure 3 and Figure 4 As shown, API gateway 306 is used to receive access requests Q sent from clients and dynamically distribute them to service layer 302 or virtual server 400 according to different access requests.
[0052] As an optional implementation, the specific process of a client accessing a backend application includes, but is not limited to, the following: The client first authenticates itself through the authentication service in the service layer 302. If authentication is successful, a token is obtained. This token must be carried as an identification identifier in every subsequent API request, so that the service layer 302 or the virtual server 400 can execute the service logic corresponding to the target service.
[0053] Step S208: Obtain the target access request sent by the client of the target application on the API gateway, wherein the target access request carries a target field corresponding to the target service requested for access.
[0054] Step S210: If the target service is determined to be a service in the first service set based on the target field, the target access request is distributed to the virtual server in the target container.
[0055] Step S212: If the target service is determined to be a service in the second service set based on the target field, the target access request is distributed to the service layer.
[0056] It should be noted that the above steps S208 to S212 are as an optional implementation method, further explaining how to distribute access requests to virtual server 400 or service layer 302 through API gateway.
[0057] Specifically, such as Figure 5 As shown, when client 402 accesses a service in virtual server 400 or service layer 302 through API gateway 306, client 402 sends an access request Q to API gateway. Each access request Q has a fixed protocol header, which contains a key field (which can also be understood as a target field). In other words, each access request Q sent by the client carries a target field corresponding to the target service requested for access.
[0058] For example, when the service requested by access request Q (i.e. the target service) is login verification F5, the current access request Q carries the target field Target path=2 corresponding to login verification service F5. Based on the obtained target field Target path=2, API gateway 306 can determine that login verification service F5 belongs to the service in the second service set, and the API gateway will automatically distribute access request Q to service layer 302.
[0059] When the service requested by access request Q (i.e. the target service) is skin switching service F3, the current access request Q carries the target field Target path=1 corresponding to skin switching service F3. Based on the obtained target field Target path=1, API gateway 306 can determine that skin switching service F3 belongs to the service in the first service set, and API gateway will automatically distribute access request Q to virtual server 400.
[0060] It is understood that, in this embodiment, the format of the target field includes, but is not limited to, Target path=1 or Target path=2. In other application scenarios, other formats can be defined as needed. For example, type_name=C indicates that the target service is a service in the first service set; type_name=S indicates that the target service is a service in the second service set.
[0061] In this embodiment, the following is in conjunction with the appendix Figure 3 The application management method is described in further detail.
[0062] As an optional example, the core components involved in the application development process include, but are not limited to, the IaaS Layer (300), the Service Layer (302), the Container (304), the API Gateway (306), and the Dev Portal. The descriptions of each component are as follows:
[0063] (1) Resource layer 300
[0064] The resource layer 300 includes, but is not limited to, resources such as database, cache, storage, and message queue. These resources can be used by the service layer 302 and can also be accessed by the container layer 304. To simplify the use by developers, they can be automatically allocated with one click on the developer platform 308.
[0065] (2) Service Layer 302
[0066] In this embodiment, service layer 302 can also be understood as a general service layer, including but not limited to authentication service, user data service, and user-generated content (UGC) service. Developers can use these services with simple configuration without having to develop them themselves. Since general services cannot meet all application scenarios, container 304 can extend these services. The authentication service is used for client login authentication, the user data service is used to store user data, and the user-generated content service is used to manage user-generated processing information. Different general services can be provided for different application scenarios.
[0067] (3) Container 304
[0068] Used to run virtual servers developed by developers, for example, Figure 3 The virtual servers shown are 1, 2, ..., N. These backend services will be deployed to container 304 with a single click via developer platform 308 and run automatically. Furthermore, container 304 will automatically scale the virtual servers according to client traffic, without requiring manual control from operations personnel.
[0069] Furthermore, the virtual server can directly access services in the service layer 302 through the inner gateway 312 to control backend business logic. The event channel 310 can also send callbacks of some key events to the virtual server, which can then control critical processes. For example, events such as successful user login or user data update can trigger personalized control logic on the virtual server.
[0070] It should be noted that for the virtual servers in a container with a 304 error, each virtual server corresponds to a set of code. By running the code corresponding to each virtual server, different services can be provided to the target application. The specific implementation process includes at least one of the following:
[0071] 1) A virtual server can provide multiple services.
[0072] For specific details, please refer to Figure 3 and 4 As shown, Figure 4 The virtual server 400 can provide multiple services in the first service set, such as: F1 to F4, or F3 and F4;
[0073] 2) Multiple virtual servers provide one service
[0074] For example, through Figure 3 Virtual servers 1 and 2 can provide one of the services in the first service set, such as the product search service in a shopping app, or the service of adding items to the shopping cart (F2).
[0075] Furthermore, it is understandable that Figure 4 The virtual server 400 can provide multiple services (such as F1 to F4) as an example only, and the number of services is not limited. For example, a virtual server can also provide 3 services, 5 services, etc. Furthermore, in this embodiment, the number of virtual servers in container 304 is not limited.
[0076] (4) API Gateway 306
[0077] API Gateway 306 is used to receive access requests Q sent from clients and dynamically distribute them to the service layer 302 or the virtual server 400 according to different access requests.
[0078] (5) Developer Platform 308
[0079] This platform is used by developers to build, deploy, and test virtual servers, and allows for the configuration and management of service layer 302 and resource layer 300. Developer platform 308 includes, but is not limited to, the following functions:
[0080] a) Management: Used by administrators to manage projects, including permissions, configuration, status, etc.
[0081] b) Creation: When developers submit backend code to the developer platform 308, it will be automatically created and entered into the mirror repository. When releasing, it can be released with one click based on the version number.
[0082] c) Configuration: Developers can modify the configuration of the projects they manage, as well as the configuration of the services they use;
[0083] d) Continuous Operations: Provides developers with pipelines and toolchains for continuous integration, continuous deployment, and continuous testing of virtual servers, which can significantly improve the testing and deployment efficiency of target applications;
[0084] e) Deployment: Developers can deploy virtual servers according to project needs, and support capabilities such as canary deployment and pre-deployment.
[0085] In this embodiment, by means of, Figure 3 As shown in Developer 308, some backend functionalities of the target application are encapsulated into a general service and automatically configured on Service Layer 302. For the core services of the target application (e.g., services that implement personalized business logic within the application, relative to other applications), the developer's code is edited and published in the virtual server of container 304. When a client's access request requests the service requested by the target application, API Gateway 306 determines whether the service belongs to the general service in Service Layer 302 or the core service in container 304, and then distributes the client's access request to the virtual server in container 304 or Service Layer 302.
[0086] By adopting the above technical solution provided in the embodiments of this application, developers only need to edit the business logic code of the core services in the backend services of the target application. The general services of the target application can be directly configured on the service layer and provided to the developers, avoiding the need for developers to design programs for general services, simplifying the development process of large-scale backend applications, and achieving the technical effect of saving manpower and time costs and improving the development efficiency of applications.
[0087] Obviously, the application management method in this embodiment is... Figure 3 This is just one example. In real-world applications, automatic configuration extends beyond services; it can also be applied to resources within the API gateway 306 and resource layer 300. For instance, during the execution of service logic corresponding to a target service, resources in resource layer 300 can be accessed via API calls; or, data interaction between API gateway 306 and the service layer or container 304 can be achieved through API data invocation.
[0088] The following is combined Figure 4 and Figure 5 The specific embodiments described herein further illustrate the management method of the aforementioned application.
[0089] Example 1
[0090] like Figure 4 As shown, assuming the target application is a shopping app, the backend services in this shopping app mainly include user login verification (F5), product specification selection (F1), adding to cart (F2), and user transaction information storage (F7).
[0091] The shopping app was published to such Figure 3 In the case of container 304 shown, a virtual server 400 is created within container 304. This virtual server 400 can provide services F1 to F4 from the first service set to the client of the shopping app. Simultaneously, through methods such as... Figure 3 The developer platform 308 shown configures the general services of the shopping app to the aforementioned shopping app application. These general services are denoted as the second service set, including services F5 to F7. Therefore, the management method for this shopping app includes, but is not limited to, the following steps:
[0092] S41, Client 402 sends an access request Q to API Gateway 306, such as a user login verification request;
[0093] S42, API gateway 306 determines the service type of the service requested by access request Q;
[0094] S43, based on the API gateway's judgment result, distributes the access request Q to the virtual server 400 or the service layer 302.
[0095] Specifically, when the determination result is that the service requested by access request Q is login verification F5 in the second service set, the API gateway will distribute access request Q to service layer 302.
[0096] When the determination result is that the service requested by access request Q is the selected product specification F1 in the first service set, the API gateway will distribute access request Q to virtual server 400.
[0097] Example (II)
[0098] like Figure 5 As shown, assuming the target application is a game app, the backend services in this game app mainly include game battle (F1), game reward selection (F2), skin switching (F3), login verification (F5), and game data storage (F6).
[0099] The game app was published to such Figure 3 In the case of container 304 shown, a virtual server 400 is created within container 304. This virtual server 400 can provide services F1 to F4 from the first service set to the client of the game app. Simultaneously, through methods such as... Figure 3 The developer platform 308 shown configures general services for the game app, where the configured general services are denoted as the second service set, for example, including... Figure 4 The services shown are F5 to F7. Therefore, the management methods for this game app include, but are not limited to, the following steps:
[0100] S51, Client 402 sends an access request Q to API Gateway 306, such as a skin switching request;
[0101] S42, API gateway 306 determines the service type of the service requested by access request Q;
[0102] S43, based on the API gateway's judgment result, distributes the access request Q to the virtual server 400 or the service layer 302.
[0103] Specifically, when the judgment result is that the service requested by access request Q is skin switching F3 in the first service set, the API gateway will distribute access request Q to virtual server 400.
[0104] When the determination result is that the service requested by access request Q is the game data storage F6 in the second service set, the API gateway will distribute access request Q to service layer 302.
[0105] It is understood that the first service set and the second service set in the above embodiments (I) and (II) are merely examples and do not limit the service content or the number of services in the first service set or the second service set.
[0106] It should be noted that in both Embodiment (I) and Embodiment (II) above, the API gateway can be used to determine the service type requested by the access request sent by client 402, and then distribute the access request to virtual server 400 or service layer 302 according to the determination result. After virtual server 400 or service layer 302 executes the service logic corresponding to the target service (the service requested by access request Q), it returns an access response R to client 402 through the API gateway (which can also be understood as the result obtained after executing the service logic corresponding to the target service, such as: user account verification successful or verification failed).
[0107] Through the embodiments provided in this application, during the application development process, by automatically configuring the API gateway on the developer platform, when the API gateway receives an access request sent by the client of the target application, it can automatically distribute the access request to the virtual server or service layer in the container according to the target field carried in the access request sent by the client of the target application. This avoids the developer from configuring the API gateway through code design, simplifies the application development process, and achieves the technical effect of improving the development efficiency of the application.
[0108] As an optional implementation, after distributing access requests to virtual servers or service layers via an API gateway, the management method for the aforementioned applications also includes:
[0109] When the target access request is distributed to a virtual server in the target container, the service logic corresponding to the target service is executed through the virtual server to obtain the first execution result.
[0110] When the target access request is distributed to the service layer, the service logic corresponding to the target service is executed by the service layer to obtain the second execution result.
[0111] In this embodiment, the target application's client 402 can access the service layer 302 and the virtual server 400 through the API gateway 306, but is not limited to that access. For the specific access process, please refer to... Figure 7 and Figure 8 The timing diagram in the image.
[0112] (1) Client 402 accesses service layer 302
[0113] Specifically, such as Figure 7 As shown, it includes the following steps;
[0114] S702, Client 402 sends a target access request to API Gateway 306;
[0115] S704, Distribute the target access request to service layer 302;
[0116] API gateway 306 determines the service requested by the target access request (i.e., the target service) based on the target field carried in the target access request. If the result of the determination is that the target service belongs to the service in the second service set, the target access request is distributed to service layer 302.
[0117] For details on how an API gateway determines the type of a target service based on target fields, please refer to the above explanation. Figure 5 The description of the embodiments shown will not be repeated here.
[0118] S706, execute the service logic corresponding to the target service;
[0119] For example, when the target service is Figure 4 When storing user transaction information (F7) in the system, the service logic corresponding to storing user transaction information (F7) is executed in the service layer. Specifically, this may include, but is not limited to, storing the details page of the user's payment order in the service layer.
[0120] It should be noted that during the execution of the service logic corresponding to the user transaction information storage F7 in the service layer, the following sub-steps can also be executed:
[0121] S706-1, calls database / cached storage space / storage space / message queue;
[0122] As an optional example, during the storage of the details page of a user's payment order, the user's account and payment password need to be verified. Only if the verification is successful can the storage of the user's payment order details page be completed. Therefore, service layer 302 needs to call the user's account and payment password pre-stored in the database of resource layer 300, and verify the user's account and payment password associated with the details page of the user's payment order in service layer 302 based on the called user's account and payment password.
[0123] As another optional example, during the process of verifying the user account and payment password associated with the details page of the user's payment order in service layer 302, if the user changes the payment password, and if the current payment password is confirmed to be correct, the payment password associated with the details page of the user's payment order in service layer 302 is saved to resource layer 300 for the next verification process.
[0124] Obviously, in this embodiment, during the process of the service layer 302 executing the service logic corresponding to the target service, the service layer 302 can also interact with the resource layer 300, such as reading from the resource layer 300 or writing to the resource layer 300.
[0125] S708-S710, send the execution result to client 402;
[0126] The execution results mentioned above include, but are not limited to, information obtained after executing the service logic corresponding to the target service, such as: Figure 4 As shown, this indicates whether the user login verification was successful or failed, or whether the user's transaction information has been stored or not.
[0127] It should be noted that the execution of steps S708-S710 is not necessary. For example, in certain specific scenarios, the verification result will only be sent to the client if the user login verification is successful; and the storage failure information will only be sent to the client if the user's transaction information has not been stored.
[0128] (2) Client 402 accessing virtual server 400
[0129] Specifically, such as Figure 8 As shown, it includes the following steps;
[0130] S802, Client 402 sends a target access request to API Gateway 306;
[0131] S804 distributes the target access request to virtual server 400;
[0132] API gateway 306 determines the service requested by the target access request (i.e., the target service) based on the target field carried in the target access request. If the result of the determination is that the target service belongs to the service in the first service set, the target access request is distributed to virtual server 400.
[0133] For the specific process of the API gateway determining the type of the target service based on the target field, please refer to the description in the above embodiments, which will not be repeated here.
[0134] S806, execute the service logic corresponding to the target service;
[0135] For example, when the target service is Figure 5 When the skin is switched using F3, the virtual server 400 executes the service logic corresponding to skin switching F3. Specifically, this can include, but is not limited to, changing the skin color.
[0136] It should be noted that during the process of executing the service logic corresponding to skin switching F3 on the virtual server 400, the following sub-steps can also be executed:
[0137] S806-1, calls database / cached storage space / storage space / message queue;
[0138] As an optional example, during the process of switching a player's skin, it is necessary to access the skin list in resource layer 300 and select the target skin the player wants to switch to based on the user's selection.
[0139] S806-2, calling services in the service layer;
[0140] As an optional example, such as Figure 5As shown, during the skin switching process, the current skin can only be switched to the target skin when the player's accumulated score in the game app reaches 100 points or more. At this time, the virtual server 400 needs to call service F6 (game data storage) in service layer 2 302 to determine whether to switch the player's skin based on the game score in service F6.
[0141] Obviously, in this embodiment, during the process of the virtual server 400 executing the service logic corresponding to the target service, the virtual server 400 can not only interact with the resource layer 300, but also with the service layer 302. This allows for the setting of personalized execution rules as needed during the execution of the target application's business logic, thereby improving the flexibility of the service layer 302 or the virtual server 400 in executing business logic.
[0142] S808-S810, send the execution result to the client;
[0143] The execution results mentioned above include, but are not limited to, information obtained after executing the service logic corresponding to the target service, such as: Figure 5 As shown, it indicates whether the skin switching was successful or failed, and whether the game rewards have been issued or not.
[0144] Similar to the above embodiments, the execution of steps S808-S810 is not necessary. For example, in certain specific scenarios, the information that the skin has been successfully switched will only be sent to the client if the skin switch is successful; and the information that the game reward has not been issued will only be sent to the client if the reward has not been issued.
[0145] Through the above embodiments provided in this application, during the execution of the service logic corresponding to the target service, the virtual server or service layer not only interacts with the resource layer, but also interacts with the virtual server; after the execution of the service logic corresponding to the target service, data interaction between the virtual server or service layer and the client can also be realized, so that personalized execution rules can be set as needed when executing the business logic of the target service, which improves the flexibility of the service layer 302 or the virtual server 400 in executing business logic.
[0146] Based on the analysis of the above embodiments, during the execution of the business logic of the target service by the virtual server, data retrieval or storage is involved. That is, the virtual server can only complete the execution of the business logic of the target service by utilizing different resources. The resources used by the virtual server will be described in detail below with reference to specific embodiments.
[0147] As an optional implementation, the resources used by the virtual server include:
[0148] When the application of the target application is published to the target container, a set of target resources on the preset resource layer is configured for the application, wherein the resources in the target resource set are resources that are allowed to be used by the virtual server;
[0149] When the target access request sent by the client of the target application obtained on the API gateway is distributed to the virtual server in the target container, the service logic corresponding to the target service is executed through the virtual server. When the target resource in the target resource set is required when executing the service logic corresponding to the target service, the target operation is performed on the target resource. The target access request is used to request access to the target service in the first service set.
[0150] In this embodiment, when the application of the target application is published to the target container, a target resource set is configured for the application, and the virtual server 400 or service layer 302 can use the resources in the target resource set to execute the business logic of the target service.
[0151] As an optional example, the ways to configure the target resource set for an application include, but are not limited to, the following two cases:
[0152] The first scenario: Configure the target resource set for the application on the preset resource layer 300.
[0153] Specifically, such as Figure 3 As shown, the virtual server in service layer 302 or container 304 can directly call the resources in the target resource set pre-configured for the application in resource layer 300 during the execution of the business logic of the target service.
[0154] The second scenario: Configure a target resource set for the application on the preset resource layer 300. The resources in the target resource set are resources that can be used by the service layer 302. Configure third-party resources for the virtual server in the container 304. The third-party resources are storage resources other than the resources in the resource layer 300.
[0155] Specifically, such as Figure 6 As shown, during the execution of the business logic of the target service, service layer 302 can directly call resources from the target resource set pre-configured for the application in resource layer 300. During the execution of the business logic of the target service, the virtual server in container 304 calls third-party resources, for example, when executing... Figure 5 When the business logic for skin switching in service F3 is shown, in order to facilitate the call to candidate skins in the skin list, all skins in the game are cached in a database on a remote client. Therefore, the storage space in the database of the remote client is a third-party resource.
[0156] It is easy to understand that when the target access request sent by the client of the target application obtained on the API gateway 306 is distributed to the virtual server 400 in the target container 304, the virtual server can use the target resources or third-party resources in the above-mentioned target resource set and perform the corresponding target operation on the target resources or third-party resources.
[0157] Through the above embodiments provided in this application, the resources used by the virtual server can be resources pre-configured on the resource layer, or third-party resources other than those on the resource layer. In practical applications, the resources used by the virtual server can be flexibly configured as needed, thereby improving the flexibility of resource configuration.
[0158] As an optional implementation, when the execution of the service logic corresponding to the target service requires the use of target resources in the target resource set, the corresponding target operation is performed on the target resource, including at least one of the following:
[0159] If the target resource set includes the target resources required to create the target database, the target database is created using the target resources. The target database is the database that needs to be created when executing the service logic corresponding to the target service.
[0160] If the target resource set includes the target resources required to store the first data, and the target resources include the first storage space, then the first data is stored in the first storage space.
[0161] If the target resource set includes the target resources required to access the second data, and the target resources include a second storage space for storing the second data, then access the second data stored in the second storage space.
[0162] In this embodiment, the creation of the target database using the target resources mentioned above includes, but is not limited to, the database that needs to be created when the virtual server 400 executes the service logic corresponding to the target service. For example, when executing... Figure 4 When the service logic corresponding to service F1 (select product specifications) is shown, multiple data tables are created based on the models and specifications of various products in the shopping APP according to a certain rule, and then a database about product information is created based on the multiple data tables.
[0163] The aforementioned first and second data include, but are not limited to, data related to... Figure 4 and Figure 5 Data related to services in the first service set, for example, with Figure 4 The order payment details page related to Service F4 (Order Payment) and... Figure 5The service F3 (skin switching) includes a list of skins. However, since the target resources required to store the first and second data are different, the first data can be stored in the first storage space, and the second data can be stored in the second storage space.
[0164] It is easy to understand that the above example of performing the corresponding target operation on the target resource is just an example and is not intended to limit the scope of the example.
[0165] Based on the analysis of the above embodiments, it can be seen that for the service requested by the client of the target application, the API gateway can distribute it to the service layer 302 or the virtual server 400 according to the target field in the access request. During the execution of the service logic of the target service by the virtual server 400, resources in the resource layer 300 and services in the service layer 302 can be directly called through the interfaces pre-configured by the developer platform 308. Therefore, in order to realize personalized services for the client of the target application, other forms of interaction between the virtual server 400 and the service layer 302 can also be implemented using target event triggers. Specifically, these include:
[0166] When the application of the target application is deployed to the target container, a target event trigger is configured for the virtual server. The target event trigger is used to trigger a target event to the virtual server after the target service corresponding to the target event trigger in the second service set has been executed. The virtual server is used to perform the target operation in response to the target event.
[0167] Specifically, such as Figure 3 As shown, when the target application is deployed to the target container 304, a corresponding target event trigger is configured on the developer platform 308 for the virtual server in the target container 304 (the triggering function of the target event trigger is implemented through the event channel 310). After the service layer 302 completes the execution of the target service corresponding to the target event trigger in the second service set, the target event can be triggered to the virtual server in the target container 304. The virtual server in the target container 304 responds to the target event, executes the target operation corresponding to the target event, and feeds back the processing result of the target operation to the client 302.
[0168] As an optional example, after configuring a target event trigger for the virtual server in the target container 304, the above method also includes:
[0169] On the API gateway, obtain the target access request sent by the client of the target application, where the target access request is used to request access to the target service;
[0170] If the target service is a service in the second service set, the target access request will be distributed to the service layer.
[0171] After the service logic corresponding to the target service is executed through the service layer and the execution is completed, the target event is triggered to the virtual server, and the target operation is executed through the virtual server in response to the target event.
[0172] The following is a specific embodiment, combined with Figure 9 Let's further explain the target trigger mentioned above.
[0173] Suppose the target application wants to implement the function of automatically issuing rewards upon login. The specific implementation process is as follows:
[0174] S902, Client 402 sends a target access request;
[0175] For example, the client sends a user login verification access request to API gateway 306;
[0176] S904, Distribute the target access request to service layer 302;
[0177] Specifically, API Gateway 306 determines, based on the target field in the login verification request, whether the service requested by the access request belongs to the first service set or the second service set.
[0178] If the determination result is the authentication service in the second service set on service layer 302, API gateway 306 will distribute the login verification access request to service layer 302.
[0179] S906, execute the service logic corresponding to the target service;
[0180] The target service includes, but is not limited to, "user login verification" in this embodiment. In other application scenarios, it may also be other services in the second service set.
[0181] It should be noted that during the execution of the service logic corresponding to the target service in service layer 302, service layer 302 also performs the following sub-steps:
[0182] S908-S910, return the execution result to the client 402;
[0183] For example, service layer 302 executes the service logic corresponding to "user login verification", and if the execution result is "verification successful", it sends the execution result to client 402;
[0184] S912-S914, Service Layer 302 triggers the target event and notifies the virtual server 400 of the target event;
[0185] For example, if the execution result is "verification successful", the service layer 302 triggers the target event (such as automatically issuing red envelopes) and sends the target event (such as automatically issuing red envelopes) to the virtual server 400 through the event channel 310.
[0186] S916, Virtual Server 400 performs target operation;
[0187] For example, after receiving the "automatically send red envelopes" notification triggered by service layer 302, virtual server 400 will execute the target operation, namely the "automatically send red envelopes" operation.
[0188] It should be noted that during the execution of the above target operation by the virtual server (400 error), the following sub-steps may also be executed:
[0189] S916-1, accessing the database / cache storage space / storage space / message queue, etc. on resource layer 300. For example, during the automatic distribution of red envelopes by virtual server 400, data such as the distribution time and amount of the red envelopes are saved to resource layer 300, or historical data of red envelope distributions pre-stored in the database are retrieved from resource layer 300.
[0190] S918-S920 return the execution result of the target operation to the client (402).
[0191] It is understandable that in certain specific scenarios, the above steps S918-S920 are not necessary processing procedures. For example, the execution result of "successfully distributed" is only returned to client 402 when the virtual server 400 successfully distributes the red envelope. For execution results of unsuccessful distribution, no result is returned to client 402.
[0192] Using the embodiments provided in this application, by configuring a target event trigger for the virtual server 400 on the developer platform 308, the client 402 can trigger a target event under certain specific conditions when accessing the target application, and notify the virtual server 400 in real time. The virtual server 400 will then execute the target operation corresponding to the target event. In other words, through the aforementioned target event trigger, data interaction between the service layer 302 and the virtual server 400 can be realized, thereby achieving personalized services for the target application and improving the applicability of the target application.
[0193] In the above embodiments, data interaction between client 402 and service layer 302, and between client 402 and virtual server 400, all require API gateway 306. Data interaction between virtual server 400 and service layer 302, however, is achieved through... Figure 3 This is achieved through the internal gateway 312 shown.
[0194] As an optional example, the above method also includes:
[0195] When the application of the target application is published into the target container, an internal gateway is configured for the virtual server, wherein the internal gateway is used to allow the virtual server to access services in the second service set.
[0196] like Figure 3 As shown, in this embodiment, an internal gateway 312 is configured for the virtual server. Through the internal gateway 312, the virtual server 400 can access the services on the service layer 302, that is, the services in the second service set. It should be noted that the services in the second service set may include, but are not limited to, user-generated content services, user data services, authentication services, etc.
[0197] Clearly, it is understandable that, through the internal gateway 312, the virtual server 400 can access not only the services in the second service set, but also other services outside the second service set. For example, services encapsulated on components other than the service layer 302 via the developer platform 308.
[0198] As an optional example, after configuring an internal gateway for the virtual server described above, the method also includes:
[0199] When the target access request sent by the client of the target application obtained on the API gateway is distributed to the virtual server in the target container, the service logic corresponding to the target service is executed through the virtual server. When the service logic corresponding to the target service needs to access the services in the second service set, the access operation is performed on the services in the second service set through the internal gateway. The target access request is used to request access to the target service in the first service set.
[0200] In this embodiment, when the API gateway 306 determines, based on the target field in the target access request, that the target access request is for accessing a target service in the first service set, the virtual server 400 will execute the service logic corresponding to the target service. However, during the execution of the service logic corresponding to the target service, if access to a service in the second service set is required, the virtual server 400 will perform an access operation on the service in the second service set through the internal gateway 312.
[0201] As an optional example, when the target access request requests access to a service such as Figure 5When performing service F3 (skin switching), assuming that the virtual server 400 can only switch the current skin to the target skin if the player's accumulated score reaches 100 points or more, then the virtual server 400 needs to call service F6 (game data storage) in service layer 302 through internal gateway 312. Based on the game score in service F6, it determines whether to execute the target operation of switching the player's skin.
[0202] Obviously, in this embodiment, during the process of the virtual server 400 executing the service logic corresponding to the target service, the virtual server 400 can also directly access the service on the service layer 302 through the internal gateway 312, which simplifies the process of the virtual server 400 executing the target service logic, improves the flexibility of the virtual server 400 in executing business logic, and achieves the technical effect of improving the development efficiency of the target application.
[0203] Furthermore, in related technologies, since the backend services of the target application are entirely implemented by the developers themselves, and most of the business logic is on the client side, the scalability of the backend services (e.g., the ability to scale up the server in the event of a sudden increase in traffic) is poor.
[0204] To address the aforementioned issues, this application embodiment configures a scaling strategy for the virtual server 400, including:
[0205] When the target application is deployed to the target container, a scaling policy is configured for the virtual server. The scaling policy is used to dynamically adjust the computing and / or storage resources used by the virtual server based on the access volume of the virtual server.
[0206] In this embodiment, when the target application is published to the target container 304, a virtual server corresponding to the business logic code referenced by the target is created in the target container 304. The number of virtual servers is not limited, and the relationship between the virtual servers and the services they provide includes at least one of the following:
[0207] (1) Each virtual server can provide multiple services
[0208] For example, the above Figure 4 One of the virtual servers 400 can provide four services F1 to F4 from the first service set (select product specifications, add to cart, confirm order, order payment), or, as mentioned above. Figure 5 One of the virtual servers 400 can provide four services F1 to F4 in the second service set (game battle, game rewards, skin switching, equipment switching);
[0209] (2) Multiple virtual servers jointly provide a service
[0210] For example, in a specific scenario, the above Figure 3 Virtual Server 1 and Virtual Server 2 provide game battle services within the game app.
[0211] It's easy to understand that when multiple virtual servers share a service, there's no limit to the number of virtual servers; for example, two or three virtual servers can share a service.
[0212] Furthermore, in this embodiment, the main implementation process of automatically scaling up and down the virtual server 400 based on container technology includes: after submitting the business logic code corresponding to the target service executed by the virtual server 400 on the developer platform 308, automatically creating an image, automatically configuring the scaling up and down strategy for the virtual server 400 on the developer platform 308, and sending the scaling up and down strategy to the distributed container 304.
[0213] It should be noted that the scaling strategy automatically configured for the aforementioned virtual server 400 can be, but is not limited to, the memory or CPU of the virtual server 400. When configuring scaling strategies for memory or CPU separately, developers can, but are not limited to, select one of multiple scaling strategy templates on the developer platform 308. The scaling strategy is used to dynamically adjust the computing and / or storage resources used by the virtual server 400 based on its access volume.
[0214] Through the embodiments provided in this application, container 304 automatically adjusts the computing and / or storage resources used by virtual server 400 according to the access volume of virtual server 400, realizing automatic scaling of virtual server 400, avoiding manual control operations by operation and maintenance personnel, simplifying the maintenance process of target application, saving operation and maintenance time of target application, and improving the management effect of application.
[0215] To better understand the technical solution of this application, the following explanation is further provided by comparing the development process of the target application in this application with the development process of the target application in related technologies.
[0216] Specifically, such as Figure 10 As shown in (b), the process of developing the target application using the technical solution of this application includes steps S1020 to S1028, including product function design, formulation of technical solution, implementation of business logic code, submission of business logic code, and release of target application.
[0217] And such Figure 10As shown in (a), the development process of the target application in the related technology includes steps S1002 to S1018, such as product function design and technical solution formulation in steps S1002 to S1004, implementation of business logic code in step S1008, and release of the target application in step S1016.
[0218] By comparison Figure 10 (a) and Figure 10 As can be seen from the development process in (b), compared to the development processes in related technologies, the development process for the target application using the embodiments of this application reduces the processes of target application architecture design, local build and packaging, cloud hardware resource procurement and management, network management configuration and operation and maintenance, etc. The reduced processes can be achieved, but are not limited to, through automatic configuration of the development platform 308 or one-click automatic allocation of the developer platform 308. Developers can directly call these processes by customizing or configuring the interfaces during the business logic code development process.
[0219] Through the above embodiments provided in this application, and by adopting the development process of the target application of this application, developers can focus only on the development of the business logic code of the target application, without having to pay attention to the underlying architecture, resource deployment and operation and maintenance of the target application, thereby saving development time, simplifying the development and operation and maintenance process, and achieving the technical effect of improving the development efficiency of the target application.
[0220] To more clearly understand the above embodiments, the following will be combined with... Figure 11 The overall flowchart shown illustrates the specific execution steps of the application management method in the above embodiments as follows:
[0221] S1102, through developer platform 308, the target application's application is published to container 304;
[0222] S1104-1~S1104-2, configure the first service set on the virtual server 400 in container 304 and the resources used when executing the services in the first service set for the application; at the same time, configure the second service set on the preset service layer 302 and the resources used when executing the services in the second service set for the application.
[0223] S1106, Send an access request, such as a login verification request or a player skin switching request in the above embodiments;
[0224] S1108-1~S1108-2 distributes access requests to service layer 302 or virtual server 400;
[0225] Specifically, by obtaining the target field corresponding to the target service requested in the target access request sent by the client on the API gateway, it is determined whether the target service is a service in the first service set or a service in the second service set.
[0226] If the target service is determined to be a service in the first service set based on the target field, the target access request is distributed to virtual server 400; if the target service is determined to be a service in the second service set based on the target field, the target access request is distributed to service layer 302.
[0227] (i) When the target access request is distributed to service layer 302, the actions performed by service layer 302 include, but are not limited to, one of the following:
[0228] (1) Execute step S1110-1, directly execute the service logic corresponding to the target service, for example, execute the service logic corresponding to user login verification;
[0229] (2) Execute steps S1110-1 and S1112-1. In the process of executing the service logic corresponding to the target service, it is also necessary to call the database / cache storage space / message queue in the resource layer 300.
[0230] (3) Execute steps S1110-1, S1112-1, and S1114-1. During the execution of the service logic corresponding to the target service, it is also necessary to call the database / cache storage space / message queue, etc. in the resource layer 300, and trigger the target event after the service logic corresponding to the target service is completed. For example, in... Figure 9 In the example of automatic reward distribution upon login shown, the "automatic reward distribution" function can be triggered when the service logic corresponding to "user login verification" is executed at the service layer and the execution result is "verification successful".
[0231] S1114-2, through event channel 310, notifies the virtual server 400 of the target event;
[0232] (ii) When distributing a target access request to a virtual server 400, the actions performed by the service layer 400 include, but are not limited to, one of the following:
[0233] (1) Execute step S1110-2, directly execute the service logic corresponding to the target service, for example, execute the service logic corresponding to switching player skins;
[0234] (2) Execute steps S1110-2 and S1112-2. In the process of executing the service logic corresponding to the target service, it is also necessary to call the database / cache storage space / message queue in the resource layer 300.
[0235] (3) Execute steps S1110-2, S1112-2, and S1116. During the execution of the service logic corresponding to the target service, it is necessary to call the database / cache storage space / message queue, etc. in the resource layer 300, and also to execute the target operation corresponding to the target event. For example, still using... Figure 9 Taking the example of automatic reward distribution upon login, after the virtual server completes the service logic corresponding to "switching player skins" and receives the "verification successful" execution result sent by the service layer, the virtual server executes the function of "automatically distributing rewards," such as automatically distributing red envelopes.
[0236] It should be noted that during the execution of step S1312 by the virtual server, it may also access the target service in the second service set in service layer 302 by executing steps S1118-1 to S1118-2. For example, during the execution of the service logic corresponding to "switching player skin" by the virtual server, the user's historical accumulated points are obtained by accessing the "historical game data" in the "game data storage" service in the second service set, and the user's skin is switched based on the obtained historical accumulated points.
[0237] Execute steps S1120-1~S1120-2 and S1122-1~S1122-2, and return an access response. For example, if a service in the first service set is executed, return "Player skin switched"; if a service in the second service set is executed, return "Login verification successful", etc.
[0238] By adopting the technical solution in the embodiments of the present invention, the developer only needs to program some of the backend services of the target application, while the other services in the backend service are directly encapsulated into general services and provided to the developer. This avoids the developer from programming the general services, simplifies the development process of large-scale backend applications, and achieves the technical effect of improving the development efficiency of applications.
[0239] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the present invention is not limited to the described order of actions, because according to the present invention, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to the present invention.
[0240] According to another aspect of the present invention, a management device for implementing the above-described application is also provided. For example... Figure 12 As shown, the device includes:
[0241] The first processing unit 1202 is configured to create a virtual server in the target container corresponding to the business logic code of the target application when the application of the target application is published to the target container, wherein the application includes the business logic code of the target application, and the virtual server is used to provide a first set of services to the clients of the target application.
[0242] As an optional example, the target application mentioned above may include, but is not limited to, at least one of the following: a web application (e.g., a web application), a mobile application (APP), a game APP, etc. For each of the aforementioned applications, the business functions (also called services, such as user login in a shopping APP, game mode selection in a game APP, etc.) they possess will also differ. By running the business logic code written by the developer, the service logic corresponding to the target service can be executed, thereby realizing the user's target operation in the target application.
[0243] As an optional example, the above business logic can be, but is not limited to, the rules and processes that an entity should follow in order to provide services to another entity. For example, when shopping online using a shopping app, the following business logic can be set through the logic code written by the developer: an order can only be placed after the user has successfully logged in; the seller will ship the goods after payment is successful, etc.
[0244] As an alternative example, the virtual server described above can, but is not limited to, divide a main server into multiple sub-servers. These sub-servers can be hosted on the same physical server via software architecture, and each virtual server can provide all the functions of the main server, such as web page creation, data transmission, and storage space.
[0245] Obviously, it is understandable that in this embodiment, the services provided by the target application to its clients differ depending on the application scenario. For example, as... Figure 4 As shown, for shopping apps, user login verification (F5) and user transaction information storage (F7) are common services, while adding to cart (F2) and order payment (F4) are core services. Therefore, the core services of a shopping app (such as...) Figure 4 The set consisting of F1-F4 in the above is denoted as the first service set, and the above virtual server is used to provide the first service set to the client of the target application.
[0246] The first configuration unit 1204 is used to configure a second service set on a preset service layer for the application, wherein the services in the second service set are services provided to the client of the target application;
[0247] As an optional example, for Figure 4 The set consisting of login verification F5, user message storage F6, and user transaction information storage F7 is denoted as the second service set. Services in the second service set can be provided, but are not limited to, through methods such as... Figure 3 The developer platform 308 shown provides developers with an interface for invocation. During application development, developers do not need to write code for the business logic corresponding to the services in the second service set, simplifying the development process of the target application, saving development time, and reducing labor costs.
[0248] The second processing unit 1206 is used to configure an application interface API gateway for the application. The API gateway is used to distribute the access requests sent by the client of the target application to the virtual server or service layer in the target container according to the service requested by the access request sent by the client of the target application.
[0249] As an optional example, such as Figure 3 and Figure 4 As shown, API gateway 306 is used to receive access requests Q sent from clients and dynamically distribute them to service layer 302 or virtual server 400 according to different access requests.
[0250] As an optional implementation, the specific process of a client accessing a backend application includes, but is not limited to, the following: The client first authenticates itself through the authentication service in the service layer 302. If authentication is successful, a token is obtained. This token must be carried as an identification identifier in every subsequent API request, so that the service layer 302 or the virtual server 400 can execute the service logic corresponding to the target service.
[0251] The acquisition unit 1208 is used to acquire the target access request sent by the client of the target application on the API gateway, wherein the target access request carries a target field corresponding to the target service requested for access.
[0252] The third processing unit 1210 is used to distribute the target access request to the virtual server in the target container when it is determined from the target field that the target service is a service in the first service set.
[0253] The fourth processing unit 1212, if it determines that the target service is a service in the second service set based on the target field, distributes the target access request to the service layer.
[0254] It should be noted that the above-mentioned acquisition unit 1208, third processing unit 1210 and fourth processing unit 1212 are optional implementation methods used to implement how to distribute access requests to virtual server 400 or service layer 302 through API gateway.
[0255] In this embodiment, the services of the target application are divided into services in a first service set and services in a second service set according to the service category. The second service set (general services) is configured for the application of the target application through the developer platform. This avoids the developer from writing code for the general services of the target application, simplifies the development process of the target application, and achieves the technical effect of improving the development efficiency of the application.
[0256] Optionally, the above-mentioned device further includes:
[0257] The fifth processing unit is used to execute the service logic corresponding to the target service through the virtual server when the target access request is distributed to the virtual server in the target container, and obtain the first execution result.
[0258] The sixth processing unit is used to execute the service logic corresponding to the target service through the service layer when the target access request is distributed to the service layer, and obtain the second execution result.
[0259] Optionally, the above-mentioned device further includes:
[0260] The second configuration unit is used to configure a set of target resources on a preset resource layer for the application when the application of the target application is published to the target container, wherein the resources in the target resource set are resources that are allowed to be used by the virtual server.
[0261] The seventh processing unit is used to distribute the target access request sent by the client of the target application obtained on the API gateway to the virtual server in the target container, and to execute the service logic corresponding to the target service through the virtual server. When the execution of the service logic corresponding to the target service requires the use of the target resource in the target resource set, the unit performs the corresponding target operation on the target resource. The target access request is used to request access to the target service in the first service set.
[0262] Optionally, when the execution of the service logic corresponding to the target service requires the use of target resources in the target resource set, the corresponding target operation is performed on the target resource, including at least one of the following:
[0263] The first processing module is used to create a target database using the target resources when the target resource set includes the target resources required to create the target database. The target database is the database that needs to be created when executing the service logic corresponding to the target service.
[0264] The first storage module is used to store the first data in the first storage space when the target resource set includes the target resources required to store the first data and the target resources include the first storage space.
[0265] The second storage module is used to access the second data stored in the second storage space when the target resource set includes the target resources required to access the second data and the target resources include a second storage space for storing the second data.
[0266] Optionally, the above-mentioned device further includes;
[0267] The second processing module is used to configure a target event trigger for the virtual server when the application of the target application is published to the target container. The target event trigger is used to trigger a target event to the virtual server after the target service corresponding to the target event trigger in the second service set is completed. The virtual server is used to perform the target operation in response to the target event.
[0268] Optionally, after configuring the target event trigger for the virtual server, the apparatus further includes:
[0269] The acquisition module is used to acquire target access requests sent by the client of the target application on the API gateway. The target access request is used to request access to the target service.
[0270] The distribution module is used to distribute the target access request to the service layer when the target service is a service in the second service set.
[0271] The third processing module is used to trigger a target event to the virtual server after the service logic corresponding to the target service is executed through the service layer and the execution is completed, and to respond to the target event by executing the target operation through the virtual server.
[0272] Optionally, the above-mentioned device further includes:
[0273] The fourth processing module is used to configure an internal gateway for the virtual server when the target application's application is deployed into the target container. The internal gateway is used to allow the virtual server to access services in the second service set.
[0274] Optionally, after configuring an internal gateway for the aforementioned virtual server, the apparatus further includes:
[0275] The fifth processing module is used to distribute the target access request sent by the client of the target application obtained on the API gateway to the virtual server in the target container, and to execute the service logic corresponding to the target service through the virtual server. When the execution of the service logic corresponding to the target service requires access to the services in the second service set, the module performs access operations on the services in the second service set. The target access request is used to request access to the target service in the first service set.
[0276] Optionally, the above-mentioned device further includes:
[0277] The sixth processing module is used to configure scaling policies for virtual servers when the application of the target application is deployed to the target container. The scaling policies are used to dynamically adjust the computing and / or storage resources used by the virtual server according to the access volume of the virtual server.
[0278] The road element acquisition device in this embodiment can be used to create a virtual server corresponding to the business logic code of the target application in the target container when the target application is published to the target container. Then, the backend services of the target application are categorized into services in a first service set and services in a second service set. The API gateway determines whether the service requested by the client of the target application belongs to the first or second service set based on the received access request, and distributes the access request to the virtual server or service layer according to the determination result. In other words, by adopting the technical solution in this embodiment, developers only need to program some of the backend services of the target application, while other backend services are directly encapsulated into general services and provided to developers. This avoids developers having to program general services, simplifies the development process of large-scale backend applications, and achieves the technical effect of improving application development efficiency.
[0279] It should be noted that the embodiments of the application management device here can refer to the embodiments of the application management method described above, and will not be repeated here.
[0280] According to another aspect of the embodiments of this application, an electronic device for implementing the management method of the above-described application is also provided. This electronic device may be... Figure 13 The terminal device or the backend device shown. This embodiment uses the electronic device as an example of a backend device. Figure 12 As shown, the electronic device includes a memory 1302 and a processor 1304. The memory 1302 stores a computer program, and the processor 1304 is configured to execute the steps of any of the above method embodiments through the computer program.
[0281] Optionally, in this embodiment, the aforementioned electronic device may be located in at least one of a plurality of network devices in a computer network.
[0282] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0283] S1, when the application of the target application is published to the target container, a virtual server corresponding to the business logic code of the target application is created in the target container. The application includes the business logic code of the target application, and the virtual server is used to provide a first set of services for the clients of the target application.
[0284] S2, Configure a second set of services on a preset service layer for the application, wherein the services in the second set of services are services provided to the client of the target application;
[0285] S3 configures the application interface API gateway for the application. The API gateway is used to distribute the access requests sent by the client of the target application to the virtual server or service layer in the target container according to the service requested by the access request sent by the client of the target application.
[0286] S4. Obtain the target access request sent by the client of the target application on the API gateway. The target access request carries the target field corresponding to the target service requested for access.
[0287] S5, if the target service is determined to be a service in the first service set based on the target field, the target access request is distributed to the virtual server in the target container.
[0288] S6, if the target service is determined to be a service in the second service set based on the target field, the target access request is distributed to the service layer.
[0289] Alternatively, as those skilled in the art will understand, Figure 13 The structure shown is for illustrative purposes only. Electronic devices can also be smartphones (such as Android phones, iOS phones, etc.), tablets, PDAs, mobile internet devices (MIDs), PADs, and other target terminals. Figure 13 This does not limit the structure of the aforementioned electronic devices or electronic equipment. For example, electronic devices or electronic equipment may also include components that are more... Figure 13 The more or fewer components shown (such as network interfaces, etc.), or having the same Figure 13 The different configurations shown.
[0290] The memory 1302 can be used to store software programs and modules, such as the program instructions / modules corresponding to the application management method and apparatus in this embodiment. The processor 1304 executes various functional applications and data processing by running the software programs and modules stored in the memory 1302, thereby implementing the aforementioned application management method. The memory 1302 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 1302 may further include memory remotely located relative to the processor 1304, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Specifically, the memory 1302 may be used for, but is not limited to, business logic code of the target application, application programming interfaces of the target application, etc. As an example, such as... Figure 13 As shown, the memory 1302 may include, but is not limited to, the first processing unit 1202, configuration unit 1204, second processing unit 1206, acquisition unit 1208, third processing unit 1210, and fourth processing unit 1212 of the application management device. Furthermore, it may include, but is not limited to, other module units of the application management device, which will not be elaborated upon in this example.
[0291] Optionally, the transmission device 1306 described above is used to receive or send data via a network. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 1306 includes a Network Interface Controller (NIC), which can be connected to other network devices and a router via a network cable to communicate with the Internet or a local area network. In another example, the transmission device 1306 is a Radio Frequency (RF) module, used for wireless communication with the Internet.
[0292] In addition, the aforementioned electronic device also includes: a display 1308 for displaying the selection result of the business logic code of the aforementioned application; and a connection bus 1310 for connecting the various module components in the aforementioned electronic device.
[0293] In other embodiments, the target terminal or server can be a node in a distributed system, which can be a blockchain system. This blockchain system is formed by connecting multiple nodes through network communication. The nodes can form a peer-to-peer (P2P) network, and any type of computing device, such as a server or terminal, can become a node in the blockchain system by joining this peer-to-peer network.
[0294] According to one aspect of this application, a computer program product or computer program is provided, comprising computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the application management method provided in various optional implementations of the above-described server verification processing, wherein the computer program is configured to execute the steps in any of the above-described method embodiments at runtime.
[0295] Optionally, in this embodiment, the computer-readable storage medium described above may be configured to store a computer program for performing the following steps:
[0296] S1, when the application of the target application is published to the target container, a virtual server corresponding to the business logic code of the target application is created in the target container. The application includes the business logic code of the target application, and the virtual server is used to provide a first set of services for the clients of the target application.
[0297] S2, Configure a second set of services on a preset service layer for the application, wherein the services in the second set of services are services provided to the client of the target application;
[0298] S3 configures the application interface API gateway for the application. The API gateway is used to distribute the access requests sent by the client of the target application to the virtual server or service layer in the target container according to the service requested by the access request sent by the client of the target application.
[0299] S4. Obtain the target access request sent by the client of the target application on the API gateway. The target access request carries the target field corresponding to the target service requested for access.
[0300] S5, if the target service is determined to be a service in the first service set based on the target field, the target access request is distributed to the virtual server in the target container.
[0301] S6, if the target service is determined to be a service in the second service set based on the target field, the target access request is distributed to the service layer.
[0302] Optionally, in this embodiment, those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be implemented by a program instructing the hardware related to the target terminal. The program can be stored in a computer-readable storage medium, which may include: flash drive, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0303] The sequence numbers of the embodiments in this application are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0304] If the integrated units in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in the aforementioned computer-readable storage medium. Based on this understanding, the technical solution of the present invention, 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 includes several instructions to cause one or more computer devices (which may be personal computers, servers, or network devices, etc.) to execute all or part of the steps of the methods of the various embodiments of the present invention.
[0305] In the above embodiments of the present invention, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0306] In the several embodiments provided in this application, it should be understood that the disclosed client can be implemented in other ways. The device embodiments described above are merely illustrative; for example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces, or the indirect coupling or communication connection of units or modules may be electrical or other forms.
[0307] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0308] Furthermore, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0309] The above are merely preferred embodiments of the present invention. It should be noted that those skilled in the art can make various improvements and modifications without departing from the principle of the present invention, and these improvements and modifications should also be considered within the scope of protection of the present invention.
Claims
1. A management method of an application program, characterized by, The method comprises: In the case that an application program of a target application is published to a target container, a virtual server corresponding to the business logic code of the target application is created in the target container, wherein the application program comprises the business logic code of the target application, and the virtual server is used to provide a first service set for clients of the target application; A second service set on a preset service layer is configured for the application program, wherein the services in the second service set are services provided for clients of the target application; An application program interface (API) gateway is configured for the application program, wherein the API gateway is used to distribute access requests sent by clients of the target application to the virtual server in the target container or the service layer according to the target service requested by the access requests sent by the clients of the target application to be accessed; A target access request sent by a client of the target application is obtained on the API gateway, wherein the target access request carries a target field corresponding to a target service requested to be accessed; In the case that it is judged according to the target field that the target service is a service in the first service set, the target access request is distributed to the virtual server in the target container; In the case that it is judged according to the target field that the target service is a service in the second service set, the target access request is distributed to the service layer.
2. The method of claim 1, wherein, After the access request is distributed to the virtual server or the service layer through the API gateway, the method further comprises: In the case that the target access request is distributed to the virtual server in the target container, service logic corresponding to the target service is executed through the virtual server to obtain a first execution result; In the case that the target access request is distributed to the service layer, service logic corresponding to the target service is executed through the service layer to obtain a second execution result.
3. The method of claim 1, wherein, The method further comprises: In the case that the application program of the target application is published to the target container, a target resource set on a preset resource layer is configured for the application program, wherein the resources in the target resource set are resources allowed to be used by the virtual server; In the case that the target access request sent by the client of the target application obtained on the API gateway is distributed to the virtual server in the target container, the target resource in the target resource set is executed through the virtual server in the case that the target resource needs to be used when the service logic corresponding to the target service is executed, wherein the target access request is used to request to access the target service in the first service set.
4. The method of claim 3, wherein, The case that the target resource in the target resource set is executed in the case that the target resource needs to be used when the service logic corresponding to the target service is executed comprises at least one of the following: In a case where the target resource set includes the target resource required for creating a target database, the target database is created using the target resource, wherein the target database is a database required to be created when executing service logic corresponding to the target service; In a case where the target resource set includes the target resource required for storing first data, and the target resource includes a first storage space, the first data is stored in the first storage space; In a case where the target resource set includes the target resource required for accessing second data, and the target resource includes a second storage space storing the second data, the second data stored in the second storage space is accessed.
5. The method of claim 1, wherein, The method further includes: In a case where an application program of a target application is published into the target container, a target event trigger is configured for the virtual server, wherein the target event trigger is used to trigger a target event to the virtual server after execution of a target service corresponding to the target event trigger in the second service set is completed, and the virtual server is used to perform a target operation in response to the target event.
6. The method of claim 5, wherein, After the target event trigger is configured for the virtual server, the method further includes: A target access request sent by a client of the target application is obtained on the API gateway, wherein the target access request is used to request access to the target service; In a case where the target service is a service in the second service set, the target access request is distributed to the service layer; After service logic corresponding to the target service is executed by the service layer and the execution is completed, the target event is triggered to the virtual server, and the target operation is performed by the virtual server in response to the target event.
7. The method of claim 1, wherein, The method further includes: In a case where an application program of a target application is published into the target container, an internal gateway is configured for the virtual server, wherein the internal gateway is used to allow the virtual server to access services in the second service set.
8. The method of claim 7, wherein, After the internal gateway is configured for the virtual server, the method further includes: In a case where the target access request sent by the client of the target application obtained on the API gateway is distributed to the virtual server in the target container, service logic corresponding to the target service is executed by the virtual server, and in a case where access to services in the second service set is required when the service logic corresponding to the target service is executed, an access operation on the services in the second service set is performed by the internal gateway, wherein the target access request is used to request access to a target service in the first service set.
9. The method according to any one of claims 1 to 8, characterized in that, The method further includes: In a case where an application program of a target application is published into the target container, a scaling policy is configured for the virtual server, wherein the scaling policy is used to dynamically adjust computing resources and / or storage resources used by the virtual server according to an access amount of the virtual server.
10. An application management apparatus characterized by comprising: The method further includes: The first processing unit is configured to create a virtual server corresponding to the business logic code of the target application in a target container in a case where an application program of the target application is published to the target container, wherein the application program comprises the business logic code of the target application, and the virtual server is configured to provide a first service set for a client of the target application. The first configuration unit is configured to configure a second service set on a preset service layer for the application program, wherein the services in the second service set are services provided for the client of the target application. The second processing unit is configured to configure an application program interface (API) gateway for the application program, wherein the API gateway is configured to distribute an access request sent by the client of the target application to the virtual server in the target container or the service layer according to a service requested to be accessed by the access request sent by the client of the target application. The obtaining unit is configured to obtain a target access request sent by the client of the target application on the API gateway, wherein the target access request carries a target field corresponding to a target service requested to be accessed. The third processing unit is configured to distribute the target access request to the virtual server in the target container in a case where it is determined according to the target field that the target service is a service in the first service set. The fourth processing unit is configured to distribute the target access request to the service layer in a case where it is determined according to the target field that the target service is a service in the second service set.
11. The apparatus of claim 10, wherein, The apparatus further comprises: The fifth processing unit is configured to execute service logic corresponding to a target service through the virtual server to obtain a first execution result in a case where the target access request is distributed to the virtual server in the target container. The sixth processing unit is configured to execute service logic corresponding to a target service through the service layer to obtain a second execution result in a case where the target access request is distributed to the service layer.
12. The apparatus of claim 10, wherein, The apparatus further comprises: The second configuration unit is configured to configure a target resource set on a preset resource layer for the application program in a case where an application program of the target application is published to the target container, wherein the resources in the target resource set are resources allowed to be used by the virtual server. The seventh processing unit is configured to perform a target operation on a target resource in a case where the target access request sent by the client of the target application and obtained on the API gateway is distributed to the virtual server in the target container and a target resource in the target resource set needs to be used when service logic corresponding to the target service is executed, wherein the target access request is used to request to access the target service in the first service set.
13. A computer-readable storage medium including a stored program, wherein, The program runs to execute the method in any one of claims 1 to 9.
14. A computer program product comprising computer programs / instructions, characterized in that, The computer program / instruction is executed by the processor to implement the steps of the method in any one of claims 1 to 9.
15. An electronic device comprising a memory and a processor, characterized in that The memory stores a computer program, and the processor is configured to execute the method described in any one of claims 1 to 9 by using the computer program.
Citation Information
Patent Citations
Single set of credentials for accessing multiple computing resource services
CN110113360A
Task processing method, server, client and system
CN112540858A