Methods, apparatuses, devices, and media for managing services of an application
By storing and transmitting environment information in the database system's logs, the problem of environment information loss when microservices share a database is solved, thus improving application development and testing efficiency.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-15
- Publication Date
- 2026-03-27
AI Technical Summary
In multi-environment scenarios, when communication between microservices is complex and they share databases, environmental information is lost, leading to low efficiency in application development and testing.
By storing and transmitting environmental information in the database system's logs, and utilizing the database system's built-in logging functionality, the development of separate code for storing environmental information is avoided, thus achieving effective transmission of environmental information.
It improves the efficiency of application development and testing in multiple environments, and reduces resource consumption and management complexity.
Smart Images

Figure CN116582592B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Example implementations of the present disclosure generally relate to application management, and in particular, to a method, an apparatus, a device, and a computer-readable storage medium for managing services of an application. BACKGROUND
[0002] With the rapid development of Internet technology, more and more applications adopt micro-service technology. There can be complex communication between multiple services in an application, and different micro-services can be developed by different persons during the development and / or testing of the application. In order to improve the efficiency of the development and / or testing of the application, the application can be developed in a multi-environment scenario. At this time, different persons can develop and / or test their respective micro-services in different environments. When different environments involve a shared database, the environment information of different environments can be lost. At this time, it is desirable to maintain the environment information in a more efficient manner in order to improve the efficiency of managing the services in the application, and thus complete the development and testing of the application in a more efficient manner. SUMMARY
[0003] In a first aspect of the present disclosure, a method for managing services of an application is provided. Here, the application includes at least a first service and a second service downstream of the first service, and the first service and the second service are executed in the same environment. In the method, in response to receiving a first access request from the first service for modifying a data item in a database system, environment information of the first service is obtained, the environment information describing an execution environment of the first service. Based on the environment information and the first access request, a second access request is generated. The second access request is stored in a log of the database system for extracting the environment information from the log by the second service.
[0004] In a second aspect of the present disclosure, an apparatus for managing services of an application is provided. Here, the application includes at least a first service and a second service downstream of the first service, and the first service and the second service are executed in the same environment. The apparatus includes an obtaining module configured to, in response to receiving an access request from the first service for modifying a data item in a database system, obtain environment information of the first service, the environment information describing an execution environment of the first service; a generating module configured to generate a second access request based on the environment information and the first access request; and a storing module configured to store the second access request in a log of the database system for extracting the environment information from the log by the second service.
[0005] In a third aspect of the disclosure, an electronic device is provided. The electronic device includes at least one processing unit; and at least one memory coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, the instructions when executed by the at least one processing unit cause the electronic device to perform the method according to the first aspect of the disclosure.
[0006] In a fourth aspect of the disclosure, a computer-readable storage medium is provided, having stored thereon a computer program which, when executed by a processor, causes the processor to implement the method according to the first aspect of the disclosure.
[0007] It is to be understood that the details set forth herein are not intended to limit the key or critical features of the implementations of the disclosure, nor are they intended to limit the scope of the disclosure. Other features of the disclosure will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS
[0008] The above and other features, advantages and aspects of the implementations of the disclosure will become more apparent from the following detailed description in conjunction with the accompanying drawings. In the drawings, the same or like reference numerals designate the same or like elements, in which:
[0009] Figure 1 A block diagram illustrating an environment in which one example implementation according to the disclosure can be applied is shown;
[0010] Figure 2 A block diagram illustrating a service for managing applications according to some implementations of the disclosure is shown;
[0011] Figure 3 A block diagram illustrating different types of access requests according to some implementations of the disclosure is shown;
[0012] Figure 4 A block diagram illustrating insertion of environment information into a statement expressed in a structured query language according to some implementations of the disclosure is shown;
[0013] Figure 5 A block diagram illustrating use of a log message of a database system to notify a second service of environment information according to some implementations of the disclosure is shown;
[0014] Figure 6 A block diagram illustrating extraction and use of environment information according to some implementations of the disclosure is shown;
[0015] Figure 7 A block diagram illustrating management of services in applications in a multi-environment scenario according to some implementations of the disclosure is shown;
[0016] Figure 8A flowchart illustrating a method for managing services of an application according to some implementations of the present disclosure is shown;
[0017] Figure 9 A block diagram illustrating an apparatus for managing services of an application according to some implementations of the present disclosure is shown; and
[0018] Figure 10 A block diagram of an apparatus that can implement various implementations of the present disclosure is shown. DETAILED DESCRIPTION
[0019] Implementations of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings. While several implementations of the present disclosure are shown in the drawings, it is understood that the present disclosure can be embodied in various forms and should not be construed as limited to the implementations set forth herein; rather, these implementations are provided so that this disclosure will be thorough and complete, and fully convey the scope of the present disclosure. It is noted that the drawings provided are for illustrative purposes only and should not be construed as limiting the scope of the present disclosure.
[0020] In the description of implementations of the present disclosure, the term "includes" and its variants are to be read as open-ended terms that mean "includes, but is not limited to." The term "based on" is to be read as "based, at least in part, on." The term "one implementation" or "an implementation" is to be read as "at least one implementation." The term "some implementations" is to be read as "at least some implementations." Other explicit and implicit definitions can also be included below. As used herein, the term "model" can represent the association relationship between various data. For example, the above-mentioned association relationship can be obtained based on various technical solutions known at present and / or to be developed in the future.
[0021] It can be understood that the data involved in the technical solutions of the present disclosure (including but not limited to the data itself, the acquisition or use of the data) should comply with the requirements of relevant laws and regulations and relevant provisions.
[0022] It can be understood that before using the technical solutions disclosed by the embodiments of the present disclosure, the type of personal information involved in the present disclosure, the scope of use, the use scenario, etc. should be informed to the user and the authorization of the user should be obtained through appropriate means according to relevant laws and regulations.
[0023] For example, when responding to the active request of the user, prompt information is sent to the user to explicitly prompt the user that the operation requested to be performed will require the acquisition and use of the personal information of the user. Thus, the user can voluntarily choose whether to provide the personal information to the software or hardware such as electronic devices, application programs, servers or storage media, etc. that perform the operation of the technical solutions of the present disclosure according to the prompt information.
[0024] As an optional but non-limiting implementation manner, in response to receiving the active request of the user, the manner of sending the prompt information to the user can be, for example, a pop-up window manner, and the prompt information can be presented in the pop-up window in the form of text. In addition, the pop-up window can also carry a selection control for the user to select "agree" or "disagree" to provide the personal information to the electronic device.
[0025] It can be understood that the above notification and user authorization obtaining process is only illustrative and does not limit the implementation manners of the present disclosure, and other manners meeting relevant laws and regulations can also be applied to the implementation manners of the present disclosure.
[0026] The term "in response to" used herein represents a state in which a corresponding event occurs or a condition is met. It will be understood that the execution time of the subsequent action performed in response to the event or condition is not necessarily strongly associated with the time when the event occurs or the condition is met. For example, in some cases, the subsequent action can be performed immediately when the event occurs or the condition is met; in other cases, the subsequent action can be performed after a period of time after the event occurs or the condition is met.
[0027] Example Environment
[0028] With the rapid development of Internet technology, more and more applications are developed based on micro-service technology. The communication between micro-services is usually very complex, and if a single micro-service exists and is frequently released due to parallel development requirements, it will affect the calling of all related services. Therefore, in order to improve the stability of dependent services and the efficiency of collaborative development and / or testing, more and more application systems currently support the ability of multiple environments.
[0029] In order to improve the efficiency of application development and / or testing, an application can be developed in a multi-environment scenario. Referring to Figure 1 A summary of the multi-environment scenario is described, which Figure 1 A block diagram 100 of an environment in which one exemplary implementation according to the present disclosure can be applied is shown. As Figure 1 As shown, the application can be developed in a multi-environment scenario, at which time there can be a base environment 110, and further there can be other environments different from the base environment 110, such as swim lane environments 120 and 130. In the process of actually using multiple environments by the application, various configurations and data in multiple environments do not have the ability to be completely isolated, but there can be a case where the swim lane environments 120 and 130 share a database system with the base environment 110.
[0030] Typically, services can ensure data consistency by subscribing to database system log messages. For example, an upstream service might modify data items in the database system. A downstream service can then subscribe to the database system's log messages (e.g., binlog messages) to ensure it receives the latest data. In multi-environment scenarios, upstream and downstream services should ideally be in the same environment. However, when sharing a database system, the subscription process may lose information about the upstream service's environment.
[0031] like Figure 1 As shown, the application may include a first service 150 and a second service 160. The base database 114 can be shared between swimlane environment 120 and base environment 110. For example, participant 122 in swimlane environment 120 can access and modify the base database 114, and participant 112 in base environment 110 can also access and modify the base database 114. At this time, changes in the base database 114 can be recorded in log 116. As shown in box 118, in related technical solutions, environments are distinguished based on the database system, and log messages are sent. As shown in box 140, the downstream second service 160 can use this log message. However, since the log message cannot distinguish between swimlane environment 120 and base environment 110, this results in the loss of environment information, and the downstream second service 160 cannot distinguish between swimlane environment 120 and base environment 110. At this time, the log message can only be used by consumers 142 and 144 under base environment 110, and consumer 124 does not consume the log message.
[0032] In another related technical solution, a separate database system can be deployed in each environment. For example, swimlane database 134 can be deployed in swimlane environment 130, and modifications made by participant 132 to swimlane database 134 will be recorded in log 136 of swimlane database 134. In this case, different environments (e.g., base environment 110 and swimlane environment 130) can be distinguished based on different database systems at box 118, and consumer 138 in swimlane environment 130 can consume the corresponding messages (i.e., log messages for swimlane database 134). However, deploying a separate database system in each swimlane environment can lead to significant resource waste, requiring the maintenance of multiple database systems and greatly increasing various costs during development and / or testing. Therefore, it is desirable to manage services in the application more efficiently, thereby completing application development and testing more effectively.
[0033] Overview of the Management Service
[0034] To at least partially address the deficiencies in the prior art, according to one example implementation of the present disclosure, a method for managing services of an application is proposed. Generally, in a multi-environment scenario, if a data item in a database system is detected to be modified, relevant environment information (e.g., an environment identifier for representing a specific environment) of a service can be acquired, and the environment information can be passed between an upstream service and a downstream service via a log of the database system.
[0035] Referring to Figure 2 A summary of one example implementation of the present disclosure is described, Figure 2 A block diagram 200 for managing services of an application according to some implementations of the present disclosure is shown. As Figure 2 shown, the application 250 can include a first service 150 located upstream, and a second service 160 located downstream of the first service 150. Here, the application 250 can further include one or more other applications. The first service 150 and the second service 160 can be directly adjacent services, or can be two services away from each other. In a microservice scenario, the first service 150 and 160 here can be different microservices respectively providing different functionalities. Assuming the application 250 is a user management system, the first service 150 may, for example, be a microservice for registering user information, and the second service 160 may, for example, be a microservice for controlling user login, etc.
[0036] In a multi-environment scenario, the first service 150 and the second service 160 can run in a specific environment (e.g., represented by the environment information 212). At this time, in a case where the multi-environment scenario involves a shared database system 230, it is desirable that the first service 150 and the second service 160 access the database system 230 in the same environment indicated by the environment information 212. In the context of the present disclosure, the environment information 212 can be passed between the first service 150 and the second service 160 by means of a log 240 of the database system 230.
[0037] Specifically, if a first access request 210 for modifying a data item in the database system 230 is received from the first service 150, the environment information 212 of the first service 150 can be acquired, which can describe an execution environment of the first service 150. Further, a second access request 220 can be generated based on the environment information 212 and the first access request 150. At this time, the second access request 220 can carry the environment information 212, and the second access request 220 can be stored in the log 240 of the database system 230. In this way, the second service 160 can read the second access request 220 from the log 240, and further extract the environment information 212.
[0038] With the exemplary implementation of the present disclosure, the environment information can be stored by means of the log of the database system itself, and it is not necessary to separately occupy the storage space of the database system. Further, the environment information 212 can be delivered by the existing management manner of the database system 230 itself in relation to the log. In this way, the environment information of the services in the application can be managed in a simpler and more efficient manner, and further the efficiency of the application development and testing in the multi-environment scenario can be improved.
[0039] Pipe Detailed Process of the Management Service
[0040] Having seen Figure 2 Having described the outline according to one exemplary implementation of the present disclosure, in the following, more details for managing the services of the application will be described. According to one exemplary implementation of the present disclosure, the application 250 herein is executed in a multi-environment scenario, and the multi-environment scenario can include: a base environment, at least one swimlane environment different from the base environment. It will be understood that if the application is executed in a single environment, the database sharing problem in the multi-environment scenario does not occur. Thus, the technical solution of the present disclosure can be started only when it is detected that the application is executed in the multi-environment scenario. In this way, various additional overheads caused by unnecessary storage and transmission of the environment information 212 can be avoided.
[0041] According to one exemplary implementation of the present disclosure, in the multi-environment scenario, the environment information 212 needs to be delivered between the services only in the case that the data item in the database system 230 is modified. If the data item in the database system 230 is not modified, the environment information 212 does not need to be delivered. At this time, the technical solution according to one exemplary implementation of the present disclosure can be executed only in the case that it is detected that the first access request 210 to the database system 230 modifies the data item in the database system 230. In this way, various unnecessary additional overheads can be avoided.
[0042] According to one exemplary implementation of the present disclosure, the first access request 210 herein can be a statement written by using the structured query language (SQL). At this time, the type of the SQL statement of the first access request 210 can be detected, and further it can be determined whether to start the technical solution of the present disclosure. Figure 3 A block diagram 300 of different types of access requests according to some implementations of the present disclosure is shown. As Figure 3 shown, the insert request 310, the delete request 320 and the modify request 330 all change the data item in the database system 230, while the query request (for example, represented by using the keyword select) does not change the content in the database system 230.
[0043] At this time, the technical solution of the present disclosure can be initiated when it is detected that the first access request 210 is any one of the following: an insertion request, a deletion request, an update request. In this way, by detecting the type of the first access request 210, it can be determined in a simple and effective manner whether the environment information 212 needs to be passed in the scenario of a shared database system. Further, the environment information 212 can be utilized to modify the first access request 210 only when it is needed, thereby achieving the purpose of passing the environment information 212 to the downstream service. According to one exemplary implementation of the present disclosure, the insertion request, the deletion request, and the update request can be intercepted, and the environment information 212 can be added to these requests.
[0044] According to one exemplary implementation of the present disclosure, in order to make the second access request 220 carry the environment information 212, the environment information 212 can be inserted into the comment part of the first access request 210, thereby obtaining the second access request 220. Referring to Figure 4 More details about inserting the environment information 212 are described, which Figure 4 A block diagram 400 of inserting environment information into a statement expressed in a structured query language is shown according to some implementations of the present disclosure.
[0045] As Figure 4 shown, a statement 410 represents one specific example of the first access request 210 expressed in the SQL format, which can set the state of a data item satisfying "id = 1" in the database system 230 to 1. It will be understood that the statement 410 is merely an example of one access request for modifying a data item in the database system 230. Alternatively and / or additionally, the access request can include: a statement for modifying other data items, a statement for inserting a data item, a statement for deleting a data item, and the like.
[0046] The environment information 212 of the first service 210 can be obtained (for example, "K_ENV":"env1"). Here, "K_ENV" can be a keyword for identifying environment information, and "env1" can be an identifier of the environment information 212. The environment information 212 can represent that the first service 210 is executed in an environment with the identifier "env1". According to one exemplary implementation of the present disclosure, the environment information 212 can be obtained from the configuration information of the technician. It will be understood that, Figure 4 Only one specific example of the environment information 212 is shown schematically, and alternatively and / or additionally, another example of the environment information 212 can include "K_ENV":"env2", and the like.
[0047] According to one example implementation of the present disclosure, an annotation section 430 can be added to the first statement 410. It will be appreciated that in SQL statements, the beginning and end of the annotation section 430 can be indicated using symbols " / *" and "* / ", for example. In other words, the section between the beginning and end is the annotation section 430, and the content of the annotation section 430 is not parsed during execution of the SQL statement. Thus, adding the annotation section 430 does not affect the execution of the SQL statement. As Figure 4 shown, the annotation section 430 can be inserted at the end of the statement 410 (and / or other locations) to generate a statement 420 that includes the environment information 212. Further, this statement 420 can be written to the log 240 of the database system 230 to facilitate retrieval of the environment information 212 by the second service 160 via the log 240.
[0048] According to one example implementation of the present disclosure, a logging function of the database system 230 can be started to store and deliver the environment information 212 by means of the database system 230's own capabilities. Specifically, the logging function can be started by setting configuration parameters of the database system 230. In the database system 230, a row replication mode can be started by setting a parameter "row-based". At this time, in the binlog of the database system 230, which data item in the database system is modified is recorded, but context-related information of the corresponding SQL statement is not recorded. Further, in the database system 230, a row-based query log event mode can be started by setting a parameter "binlog_rows_query_log_events". At this time, the original access request SQL statement can be recorded in the binlog, for example, the SQL statement can be written to an event in the log. By setting the above two parameters, the statement 420 can be recorded in the log.
[0049] Figure 5 A block diagram 500 is shown that utilizes log messages of the database system 230 to inform the second service 160 of the environment information 212 according to some implementations of the present disclosure. As Figure 5As shown, in the database system 230, the logging function 510 can be initiated by setting the modes 512 and 514. Specifically, the binlog mode of the database system 230 can be set to row-based by using “set binlog_format=row”, and the binlog_rows_query_log_events field can be configured to 1 (i.e., on) in the server of the database system 230. Specifically, the above setting can be accomplished by modifying the configuration file of the database system 230, and / or directly executing “set global binlog_rows_query_log_events=1” in the server.
[0050] Continuing to refer to FIG. 4, Figure 5 At this time, the logging function 510 of the database system 230 has been initiated, and the logging function 520 can be further invoked to record the second access request (i.e., the statement 420) in the log 240 of the database system 230. According to the exemplary implementation of the present disclosure, no separate code needs to be developed for storing the environment information 212, and no separate storage space needs to be allocated for storing the environment information 212, but the existing function of the log 240 of the database system 230 can be directly invoked to complete the storage function. Further, directly storing the environment information 212 in the log 240 can facilitate the downstream services to obtain the environment information 212 via the log 240 when needed.
[0051] According to one exemplary implementation of the present disclosure, not every downstream service needs to obtain the environment information 212. Specifically, if the downstream service does not involve a shared database in a multi-environment scenario, the environment information 212 does not need to be obtained. According to one exemplary implementation of the present disclosure, the second access request 220 can be extracted from the log 240 of the database system only when it is determined that the downstream service is executed in a multi-environment scenario.
[0052] According to one exemplary implementation of the present disclosure, the second access request 220 can be extracted based on various manners. For example, the second access request 220 can be directly found and read from the log 240. Alternatively and / or additionally, the downstream second service 160 can subscribe to the log message (e.g., binlog message) of the database system 230, at this time, the log 240 message of the database system 230 subscribed by the second service 160 (which includes the second access request 160) can be received, and then the second access request 160 can be obtained from the log message.
[0053] With the example implementation of the present disclosure, instead of developing code to fetch the second access request 220 from the log 240 separately, the second access request 220 can be fetched with the help of the database system 230 and the data communication capability of the downstream service itself, and then the corresponding environment information 212 can be fetched. In this way, the code complexity and resource consumption involved in managing the application can be further reduced, and then each service in the application can be managed in a more convenient and effective way.
[0054] In the context of the present disclosure, the second service 160 downstream can only be interested in the modification of certain data items in the database system 230, and not interested in the modification of other data items. At this time, the second access request 220 can be read from the log message only if it is determined that the log message is related to the target data item of interest to the second service 160.
[0055] Suppose the first service 150 is a microservice for registering user information, and the second service 160 is a microservice for controlling user login. Suppose different access requests in the first service 150 modify the mobile phone number and age in the user information respectively, and only the mobile phone number is used in the second service 160 to control user login and the age information is not used. At this time, only the log message about modifying the mobile phone number can be processed and the corresponding environment information 212 can be extracted, and there is no need to process the log message about modifying the age. In this way, the log message associated with the target data item of interest to the second service 160 can be processed only when needed, thereby avoiding the additional workload caused by processing irrelevant log messages unnecessarily.
[0056] According to one example implementation of the present disclosure, the environment information 212 can be read from the comment part of the extracted second access request. Referring to Figure 6 More details of reading the environment information 212 are described, which Figure 6 A block diagram 600 of extracting and utilizing environment information according to some implementations of the present disclosure is shown. As Figure 6 As shown, the environment information 212 can be extracted from the comment part 430 of the statement 420 by using a parser 610. The parser 610 can be implemented in various ways, for example, the environment information in the comment string in the SQL statement can be parsed by a regular expression.
[0057] Continuing the example above, when the environment information is identified by the keyword "K_ENV", the environment information 212 can be extracted by using a statement as shown in Figure 6 As shown, the environment information 212 can be extracted by using a statement (expressed in GO language). Specifically, "regexp.MustCompile((K_ENV):([^;]+))" can obtain the environment information ["K_ENV:env1"] in the statement 420 expressed in SQL format. It will be understood thatFigure 6 An example of the parser 610 implemented in the GO language is shown only schematically. Alternatively and / or additionally, the parser 610 can be implemented with other languages. Further, the second service 160 can be executed under an execution environment described by the read environment information 212.
[0058] Having described the detailed procedures for the various steps in the service for managing applications, in the following, see Figure 7 The overall procedure for the service for managing applications is described. Figure 7 A block diagram 700 of managing services in applications under a multi-environment scenario according to some implementations of the present disclosure is shown. As Figure 7 As shown, the swimlane environment 120 and the base environment 110 can share the base database 110, at which time the participants 122 in the swimlane environment 120 can access and modify the base database 114, and the participants 112 in the base environment 110 can also access and modify the base database 114. As shown by the arrow 710, environment information can be written into SQL statements (e.g., the comment part of the SQL statements). For example, the environment information “envl” (indicating the swimlane environment 120) can be added in the SQL statements of the participants 122, and the environment information “base” (indicating the base environment 110) can be added in the SQL statements of the participants 112. The modified SQL statements can be written into the log 116 of the base database 114. At this time, it is not necessary to care about whether the database system needs to be shared between multiple environments.
[0059] As shown in block 720, the environment information in the binlog can be identified, and the log messages including the environment information can be sent to the respective services that subscribe to the relevant binlog messages. Further, at block 730, the received log messages can be parsed in order to extract the corresponding environment information. At this time, the consumers 142 and 144 can consume in the respective environments based on the extracted environment information. Further, the swimlane database 134 can be deployed under the swimlane environment 130, and the environment information “env2” (indicating the swimlane environment 130) can be written into the SQL statements (e.g., the comment part of the SQL statements) of the participants 132. The modified SQL statements can be written into the log 136 of the swimlane database 134. At this time, the consumer 138 can consume the corresponding message queue in the swimlane environment 130.
[0060] With the example implementations of the present disclosure, by adjusting the service-side binlog_rows_query_log_events field configuration of the database system, it is possible to flexibly control to turn on or off the recording of complete SQL statements in the log. In this way, the technical solutions for managing services of applications can be started or prohibited in a simple and effective manner.
[0061] During the execution of each service, modification requests (e.g., remote procedure call (RPC) requests or hypertext transfer protocol (HTTP) requests) to the database system in respective environments can be intercepted. Respective environment information can be added to the comments of the SQL statements of the requests. At this time, the SQL statements and the detailed information of the respective row records will be written into the binlog. When the downstream services consume the binlog messages, the environment information can be extracted from the SQL statements by parsing the regular expressions. Further, the extracted environment information can be sent to the downstream services (e.g., message queue services, elastic search services, message system services, data access services, etc.) so as to ensure that the downstream services can normally consume the received messages in the respective environments.
[0062] According to one example implementation of the present disclosure, although the above describes the specific process of passing the environment information between the upstream services and the downstream services by taking the message queue services as examples. Alternatively and / or additionally, the various services herein can be any services involving the shared database system in the multi-environment scenario. For example, the services can include but are not limited to the message queue services, the elastic search services, the message system services, the data access services, etc. With the example implementation of the present disclosure, it is not necessary to develop the environment information passing function separately for each service, but different services can be managed in the same way. In this way, the efficiency of service management can be improved to further improve the development and testing efficiency of the application.
[0063] According to one example implementation of the present disclosure, the technical solutions described above can be implemented in a development tool for developing an application. At this time, different personnel using the development tool can complete the development and / or testing work in their respective dedicated environments. Further, different personnel can set a dedicated environment identifier for their respective dedicated environments so that the downstream services can be executed in the dedicated environment indicated by the dedicated environment identifier.
[0064] Specifically, assuming that multiple technical personnel collaboratively develop an application, technical personnel 1 can specify services that need to be executed in a certain dedicated environment. For example, technical personnel 1 can specify that service 1, service 2, etc. are executed in the dedicated environment “env1”. At this time, the technical personnel can use the “staining” function in the browser to specify access requests (e.g., HTTP requests and / or RPC requests) that are desired to run in a certain dedicated environment, and can store the above environment information “env1” on their own configuration information storage, etc. Further, technical personnel 2 can specify that service 1, service 2, etc. are executed in the dedicated environment “env2”. In this way, different technical personnel can facilitate the development and / or testing work in their own dedicated environment without interfering with the work of other technical personnel.
[0065] According to one example implementation of the present disclosure, the above-described technical solutions can be implemented in a plug-in of a development tool. At this time, the above-described management technical solutions can be inherited to different development tools in a more convenient and effective manner, thereby facilitating the efficiency of the development and testing personnel.
[0066] With the example implementation of the present disclosure, in the case where there is a shared database system in a multi-environment scenario, the environment information can be written into an access request to the database system, and the environment information is passed between services via the log 240 of the database system 230. At this time, the inserted environment information does not interfere with the normal execution of the access request, and the existing management mode of the database system itself about the log can be called to pass the environment information. In this way, the environment information of the services in the application can be managed in a more simple and effective manner, thereby improving the efficiency of application development and testing.
[0067] Example Process
[0068] Figure 8 A flowchart of a method 800 for managing services of an application according to some implementations of the present disclosure is shown. Here, the application includes at least a first service and a second service downstream of the first service, and the first service and the second service are executed in the same environment. At block 810, it is determined whether a first access request from the first service for modifying a data item in a database system is received. If the first access request is received, the method 800 proceeds to block 820. At block 820, environment information of the first service is obtained, the environment information describing an execution environment of the first service. At block 830, a second access request is generated based on the environment information and the first access request. At block 840, the second access request is stored in a log of the database system for extracting the environment information from the log by the second service.
[0069] According to one example implementation of the present disclosure, generating the second access request includes inserting the environment information into an annotation part of the first access request to obtain the second access request.
[0070] According to one example implementation of the present disclosure, storing the second access request includes starting a log recording function of the database system, and invoking the log recording function to record the second access request in the log of the database system.
[0071] According to one example implementation of the present disclosure, starting the log recording function includes setting the following recording modes in the database system: a row replication mode, and a row-based query log event mode.
[0072] According to one example implementation of the present disclosure, the method 800 further includes: in response to determining that the second service is executed in the multi-environment scenario, extracting the second access request from a log of the database system; reading the environment information from an annotation part of the extracted second access request; and executing the second service in an execution environment described by the read environment information.
[0073] According to one example implementation of the present disclosure, extracting the second access request from the log includes: receiving a log message of the database system subscribed by the second service, the log message including the second access request; and obtaining the second access request from the log message.
[0074] According to one example implementation of the present disclosure, obtaining the second access request from the log message includes: in response to determining that the log message relates to a target data item specified by the second service, reading the second access request from the log message.
[0075] According to one example implementation of the present disclosure, the first access request and the second access request are written in a structured query language, and the first access request includes at least one of: an insert request, a delete request, an update request.
[0076] According to one example implementation of the present disclosure, the first service and the second service include at least one of: a message queue service, an elastic search service, a message system service, a data access service.
[0077] According to one example implementation of the present disclosure, the application is executed in the multi-environment scenario, and the multi-environment scenario includes at least one of: a base environment, at least one swimlane environment different from the base environment.
[0078] According to one example implementation of the present disclosure, the method 800 is implemented in a development tool for developing the application, the method is implemented as a plug-in of the development tool, and the environment information is obtained from configuration information of a user of the development tool.
[0079] Example Apparatus and Device
[0080] Figure 9A block diagram of an apparatus 900 for managing services of an application is shown, according to some implementations of the present disclosure. Here, the application includes at least a first service and a second service downstream of the first service, the first service and the second service are executed in a same environment. The apparatus 900 includes: an obtaining module 910 configured to, in response to receiving an access request from the first service for modifying a data item in a database system, obtain environment information of the first service, the environment information describing an execution environment of the first service; a generating module 920 configured to generate a second access request based on the environment information and the first access request; and a storing module 930 configured to store the second access request in a log of the database system for extracting the environment information from the log by the second service.
[0081] According to one example implementation of the present disclosure, the generating module 920 includes: an inserting module configured to insert the environment information into an annotation part of the first access request to obtain the second access request.
[0082] According to one example implementation of the present disclosure, the storing module 930 includes: an initiating module configured to initiate a log recording function of the database system; and a calling module configured to call the log recording function to record the second access request in the log of the database system.
[0083] According to one example implementation of the present disclosure, the initiating module includes: a setting module configured to set the following recording modes in the database system: a row-based replication mode, and a row-based query log event mode.
[0084] According to one example implementation of the present disclosure, the apparatus 900 further includes: an extracting module configured to, in response to determining that the second service is executed in a multi-environment scenario, extract the second access request from the log of the database system; a reading module configured to read the environment information from an annotation part of the extracted second access request; and an executing module configured to execute the second service in an execution environment described by the read environment information.
[0085] According to one example implementation of the present disclosure, the extracting module includes: a receiving module configured to receive a log message of the database system subscribed by the second service, the log message including the second access request; and a request obtaining module configured to obtain the second access request from the log message.
[0086] According to one example implementation of the present disclosure, the request obtaining module includes: a request reading module configured to, in response to determining that the log message relates to a target data item specified by the second service, read the second access request from the log message.
[0087] According to one example implementation of the present disclosure, the first access request and the second access request are written in a structured query language, and the first access request comprises at least one of: an insert request, a delete request, an update request.
[0088] According to one example implementation of the present disclosure, the first service and the second service comprise at least one of: a message queue service, an elastic search service, a message system service, a data access service.
[0089] According to one example implementation of the present disclosure, the application is executed in a multi-environment scenario, and the multi-environment scenario comprises at least one of: a base environment, at least one swimlane environment different from the base environment.
[0090] According to one example implementation of the present disclosure, the apparatus 900 is implemented in a development tool for developing an application, the method is implemented as a plug-in of the development tool, and the environment information is obtained from configuration information of a user of the development tool.
[0091] Figure 10 A block diagram of a device 1000 capable of implementing the implementations of the present disclosure is shown. It should be understood that Figure 10 The computing device 1000 shown is merely exemplary and should not be construed as limiting the functionality and scope of the implementations described herein. Figure 10 The computing device 1000 shown can be used to implement the methods described above.
[0092] As Figure 10 The computing device 1000 is in the form of a general-purpose computing device, as shown. Components of the computing device 1000 can include, but are not limited to, one or more processors or processing units 1010, a memory 1020, a storage device 1030, one or more communication units 1040, one or more input devices 1050, and one or more output devices 1060. The processing unit 1010 can be a real or virtual processor and is capable of executing various processing according to programs stored in the memory 1020. In a multi-processor system, multiple processing units execute computer executable instructions in parallel to improve the parallel processing capability of the computing device 1000.
[0093] The computing device 1000 typically includes a plurality of computer storage media. Such media can be volatile, nonvolatile, removable, or non-removable media implemented in any method or technology for storage of information such as program modules, data, and / or data files. Storage 1030 can be implemented as a database management system, object-oriented database, or any other suitable data management system. Storage 1030 can be a removable or non-removable media, and can include machine-readable media, such as flash drives, magnetic disks, or any other media capable of storing information and / or data (e.g., training data for training) and accessible by the computing device 1000.
[0094] The computing device 1000 can further include additional removable / non-removable, volatile / nonvolatile storage media. Although not shown, a removable, non-volatile memory such as a floppy disk, a magnetic floppy disk, a magnetic hard disk, or any other magnetic storage medium can be used. A magnetic disk drive or other magnetic storage medium interface (e.g., a drive with which the device 1000 is connected) can be included in the storage interface unit 1028 so that a magnetic storage medium (e.g., a floppy disk) can be both Figure 10 read from and / or written to. As indicated previously, a magnetic disk drive or other magnetic storage medium interface is not necessarily used in the example of the computing device 1000. Optical and / or semiconductor
[0095] The communications unit 1040 allows the computing device 1000 to communicate with other computing devices over a communication medium. Additionally, the functionality of the components of the computing device 1000 can be implemented in a single computing cluster or multiple computer machines that are capable of communicating over a communication connection. Thus, the computing device 1000 can operate in a networked environment using logical connections to one or more other servers, network personal computers (PCs), or another network nodes in the networking environment.
[0096] The input device(s) 1050 can be one or more input devices such as a mouse, keyboard, trackball, etc. The output device(s) 1060 can be one or more output devices such as a display, speakers, a printer, etc. The computing device 1000 can also include other peripheral components, such as a modem or a network interface device, that can be used to communicate with one or more external devices not shown in FIG. 10 (such as a database, a display device, or any device (e.g., a network card, a modem, etc.) that enables a user to interact with the computing device 1000 or that enables the computing device 1000 to communicate in any way with another computing device). Such communication can be carried out through an input / output (I / O) interface (not shown).
[0097] According to example implementations of the present disclosure, a computer-readable storage medium is provided having computer-executable instructions stored thereon, where the computer-executable instructions are executed by a processor to implement the method described above. According to example implementations of the present disclosure, a computer program product is also provided that is tangibly stored on a non-transitory computer-readable medium and includes computer-executable instructions, where the computer-executable instructions are executed by a processor to implement the method described above. According to example implementations of the present disclosure, a computer program product is provided having a computer program stored thereon, which when executed by a processor implements the method described above.
[0098] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0099] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0100] The computer readable program instructions can also be loaded onto a computer, other programmable data processing apparatus, or other device to cause a series of operational steps to be performed on the computer, other programmable apparatus or other device to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide processes for implementing the functions / acts specified in the flowchart and / or block diagram block or blocks.
[0101] The computer program product of the present disclosure can have a signal including said computer program. This signal can be electronic, electromagnetic, optical, or any other suitable type of signal. Such a signal can be provided through a communication connection, such as electrical wiring, optical fiber, wireless interface, etc. Examples of computer program products include computer program implemented on a personal computer, server, or other networked device. A non-transitory computer readable medium, such as a floppy disk, CD-ROM, DVD-ROM, Blu-ray Disc, hard disk, or memory stick, can also be used to implement the present disclosure. The computer program product of the present disclosure can also be provided as a service to download and use the computer program over a network, such as the Internet.
[0102] Having described several implementations of the present disclosure, it will be clear to those skilled in the art that many modifications, additions, and substitutions are possible without departing from the scope and spirit of the described implementations. Many modifications and variations of the present disclosure are possible in light of the above teachings. It is, therefore, to be understood that within the scope of the appended claims, the present disclosure can be practiced otherwise than as specifically described. While the present disclosure has been described with reference to the implementation figures, it will be understood by those skilled in the art that various changes can be made and equivalents can be substituted for elements thereof without departing from the scope of the present disclosure. In addition, many modifications can be made to adapt to a particular situation and the teachings of the present disclosure to a specific implementation, without departing from the central novel teachings of the application. The implementation(s) illustrated and described herein are meant only to serve as examples. Departures in form and detail are within the scope of the disclosure. Therefore, one skilled in the art can restructure the implementation(s) as needed, while still adhering to the principles of the present disclosure.
Claims
1. A method for managing application services in a database system, wherein, The database system is a service-sharing database system under multiple environments. The application includes at least a first service and a second service downstream of the first service. The first service and the second service are executed in the same environment. The method includes: In response to receiving a first access request from the first service for modifying a data item in the database system, the environment information of the first service is obtained, the environment information describing the execution environment of the first service; Based on the environmental information and the first access request, a second access request is generated, including: inserting the environmental information into the comment portion of the first access request to obtain the second access request; and The second access request is stored in the logs of the database system for the second service to extract the environment information from the logs.
2. The method of claim 1, wherein storing the second access request comprises: Enable the logging function of the database system; as well as The logging function is invoked to record the second access request in the log of the database system.
3. The method according to claim 2, wherein activating the logging function includes setting the following logging modes in the database system: row replication mode and row-based query log event mode.
4. The method according to claim 1, further comprising: In response to determining that the second service is executed in a multi-environment scenario, the second access request is extracted from the logs of the database system; The environment information is read from the comment portion of the extracted second access request; as well as The second service is executed within the execution environment described by the read environment information.
5. The method of claim 4, wherein extracting the second access request from the log comprises: Receive log messages from the database system subscribed to by the second service, the log messages including the second access request; as well as Obtain the second access request from the log message.
6. The method of claim 5, wherein obtaining the second access request from the log message comprises: In response to determining that the log message relates to a target data item specified by the second service, the second access request is read from the log message.
7. The method according to claim 1, wherein: The first access request and the second access request are written using a structured query language, and the first access request includes at least one of the following: an insert request, a delete request, and an update request; as well as The first service and the second service include at least one of the following: message queue service, elastic search service, message system service, and data access service.
8. The method of claim 1, wherein the application is executed in a multi-environment scenario, and the multi-environment scenario includes at least one of the following: a base environment, and at least one swimlane environment different from the base environment.
9. The method of claim 1, wherein the method is implemented in a development tool for developing the application, the method is implemented as a plugin of the development tool, and the environment information is obtained from the configuration information of the user of the development tool.
10. An apparatus for managing services of an application in a database system, said database system being a service-sharing database system in multiple environments, said application including at least a first service and a second service downstream of the first service, the first service and the second service being executed in the same environment, the apparatus comprising: The acquisition module is configured to, in response to receiving a first access request from the first service for modifying a data item in the database system, acquire environment information of the first service, wherein the environment information describes the execution environment of the first service; A generation module is configured to generate a second access request based on the environment information and the first access request. The generation module is further configured to insert the environment information into the comment portion of the first access request to obtain the second access request. as well as A storage module is configured to store the second access request in the logs of the database system for use by the second service to extract the environment information from the logs.
11. An electronic device, comprising: At least one processing unit; as well as At least one memory, coupled to the at least one processing unit and storing instructions for execution by the at least one processing unit, which, when executed by the at least one processing unit, cause the electronic device to perform the method according to any one of claims 1 to 9.
12. A computer-readable storage medium having a computer program stored thereon, the computer program causing the processor to implement the method according to any one of claims 1 to 9 when executed by a processor.
Citation Information
Patent Citations
Method and device for tracking and processing network request
CN106254145A
Information processing method and device, computer equipment and storage medium
CN115525533A