Streaming application dynamic configuration method and device, electronic equipment and storage medium
Through the configuration center, the configuration center manages the configuration items of streaming applications, the business interruption and complexity problems of streaming applications when configuration items are changed are solved, dynamic configuration and real-time updates are realized, and the reliability and efficiency of the application are improved.
Patent Information
- Application Number
- CN202411314285.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-20
- Publication Date
- 2024-12-20
AI Technical Summary
Existing streaming applications need to recompile and restart the application when configuration items are changed, resulting in business interruptions and high complexity in configuration management.
Configuration item management is carried out through the configuration center. The streaming application receives preset connection parameters during initialization, establishes connections with the configuration center, caches and updates configuration information, and perceives configuration changes in real time to achieve dynamic configuration and rapid effectiveness.
It solves the problems of untimely changes in configuration items and business interruptions, realizes dynamic management and real-time updates of configuration items, and reduces the frequency of application restarts and the complexity of configuration management.
Smart Images

Figure CN119166239A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of hot deployment of streaming applications, and in particular to a method, device, electronic device, and storage medium for dynamic configuration of streaming applications. Background Art
[0002] In the early days of software development, hard coding was generally used for configuration definition. As the software industry developed, software developers gradually discovered the disadvantages of hard coding: the code is too tightly coupled with the application and has poor scalability. Therefore, configuration files were gradually used instead of hard coding. Later, as software security requirements became increasingly stringent, the use of configuration files caused software information leakage. Software developers gradually began to consider information security, and encrypting the content of configuration files became a common practice. At the same time, software developers also gradually discovered other problems that were not solved by the configuration file method, such as the need to restart the configured application and business interruption. Summary of the invention
[0003] The embodiments of the present application provide a method, device, electronic device, and storage medium for dynamic configuration of a streaming application, so as to realize dynamic perception of configuration item changes during real-time data processing by the streaming application, and to enable real-time effectiveness of configuration item changes.
[0004] The present application embodiment adopts the following technical solutions:
[0005] In a first aspect, an embodiment of the present application provides a method for dynamically configuring a streaming application, wherein the method is performed by the streaming application and includes:
[0006] Receive preset connection parameters from a configuration center, where the preset connection parameters include a connection address and an application ID;
[0007] Establishing a connection with the configuration center according to the preset connection parameters;
[0008] After connecting to the configuration center based on the connection address, cache and update the configuration information of the configuration center; and
[0009] Read the dynamic changes of the configuration information to obtain the latest configuration information.
[0010] In some embodiments, the streaming application includes a plurality of computing units, and the method further includes:
[0011] Acquire preset connection parameters of the configuration center during initialization;
[0012] Each computing unit in the streaming application uses the API interface provided by the configuration center to connect to the configuration center, and obtains the configuration set corresponding to the application ID preset in the preset connection parameters.
[0013] In some embodiments, after connecting to the configuration center based on the connection address, caching and updating the configuration information of the configuration center includes:
[0014] After each computing unit in the streaming application obtains the configuration information of the configuration center during initialization, it caches the original configuration and / or the configuration object obtained after parsing that meets the business needs, and the caching includes at least one of the following: caching the configuration in the local JVM memory, caching in the external storage system according to the business needs;
[0015] A monitoring mechanism is established to sense the configuration changes of the configuration center and make the same changes to the local cache according to the configuration changes.
[0016] In some embodiments, establishing a monitoring mechanism to sense configuration changes of the configuration center includes:
[0017] Through the configuration change event monitoring function provided by the configuration center, the selected computing unit of the real-time application receives the configuration change information pushed by the configuration center, and then updates the cache processing push mode;
[0018] The real-time application actively reads the full configuration from the configuration center at regular intervals, and then uses the latest full configuration to replace the local cache processing in a pull mode.
[0019] In some embodiments, the reading of the dynamic changes of the configuration information to obtain the latest configuration information includes:
[0020] After establishing a connection with the configuration center during initialization, multiple computing units respectively perform any one or more operations of reading configuration, caching configuration, monitoring configuration changes, and updating cache;
[0021] When processing business, multiple computing units read the configuration directly from the cache.
[0022] In some embodiments, the receiving configuration center's preset connection parameters, the preset connection parameters including the connection address and the application ID, include:
[0023] Passing the connection parameters to the startup class of the streaming application at startup, the streaming application parses the passed-in parameters when running the startup class, and passes the connection parameters to the computing unit that needs to connect to the configuration center at definition;
[0024] The computing unit is connected to the configuration center according to the input parameters.
[0025] In some embodiments, receiving preset connection parameters from a configuration center, the preset connection parameters including a connection address and an application ID, includes:
[0026] Configuring the connection parameters of the configuration center to the JVM parameters of the streaming application;
[0027] The computing unit that needs to connect to the configuration center obtains the connection parameters from the JVM parameters;
[0028] The computing unit is connected to the configuration center according to the input parameters.
[0029] In a second aspect, an embodiment of the present application further provides a dynamic configuration device for a streaming application, wherein the device is executed by a streaming application and includes:
[0030] A receiving module, used to receive preset connection parameters of a configuration center, wherein the preset connection parameters include a connection address and an application ID;
[0031] A connection establishment module, used to establish a connection with the configuration center according to the preset connection parameters;
[0032] a cache module, configured to cache and update configuration information of the configuration center after connecting to the configuration center based on the connection address; and
[0033] The reading module is used to read the dynamic changes of the configuration information to obtain the latest configuration information.
[0034] In a third aspect, an embodiment of the present application further provides an electronic device, comprising: a processor; and a memory arranged to store computer executable instructions, wherein the executable instructions, when executed, cause the processor to perform the above method.
[0035] In a fourth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores one or more programs. When the one or more programs are executed by an electronic device including multiple application programs, the electronic device executes the above method.
[0036] At least one of the above technical solutions adopted in the embodiments of the present application can achieve the following beneficial effects: receiving preset connection parameters of the configuration center, wherein the preset connection parameters include a connection address and an application ID. Then, according to the preset connection parameters, a connection with the configuration center is established. After connecting to the configuration center based on the connection address, the configuration information of the configuration center is cached and updated, and finally the dynamic changes of the configuration information are read to obtain the latest configuration information. The above method manages configuration items (addition, modification or deletion) through the configuration center, and reads the configuration items of the configuration center and caches them in the local memory. The above method can also perceive changes in configuration items, obtain the latest configuration, update the local cache, and finally read and parse the configuration in the local cache when processing data. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0038] Figure 1 A schematic diagram of a flow chart of a method for dynamically configuring a streaming application in an embodiment of the present application;
[0039] Figure 2 It is a structural schematic diagram of a dynamic configuration device for streaming applications in an embodiment of the present application;
[0040] Figure 3 This is a schematic diagram of the structure of an electronic device in an embodiment of the present application. DETAILED DESCRIPTION
[0041] In order to make the purpose, technical solution and advantages of the present application clearer, the technical solution of the present application will be clearly and completely described below in combination with the specific embodiments of the present application and the corresponding drawings. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of the present application.
[0042] In the process of processing real-time data streams based on the streaming computing engine Flink, it is necessary to read the corresponding environment configuration items, business configuration items or performance configuration items for various data in the data stream according to the business logic. However, there are mainly the following implementation solutions in related technologies:
[0043] (1) Define configuration items in the program code. Define the required configuration directly in the code in a hard-coded form. The code references the configuration and reads the configuration when the application starts. When the configuration changes or new configurations are added, modify or add configuration definitions, recompile the code, package and restart the application to make the configuration effective.
[0044] (2) By passing in the configuration file when the task starts, the configuration file is loaded when the program starts, and the configuration definition is parsed to make the configuration effective. When the configuration changes or new configurations are added, modify the corresponding configuration items in the configuration file or add new configurations, and restart the application to make them effective.
[0045] (3) Write the configuration item into the configuration data stream, and associate the business data stream with the configuration data stream when the application is running. When processing data in the business data stream, read the corresponding configuration from the configuration data stream. When a configuration item changes, insert a new configuration into the configuration data stream to overwrite the outdated configuration in the data stream.
[0046] Disadvantages in (1): Code and configuration are coupled. When changing the configuration, it is necessary to recompile and repackage, replace the production environment package, and restart the application. The whole process is cumbersome. At the same time, due to its characteristics (restoring state data, applying for distributed computing resources, etc.), the restart time of streaming applications is long. During the restart process, data cannot be processed in time and even cause business processing interruption.
[0047] Disadvantages in (2): Configuration files are stored separately, which poses security risks (such as being modified or accidentally deleted). In addition, the application still needs to be restarted for the configuration to take effect. During the restart process, the timeliness of data processing and the interruption of business processing still exist.
[0048] Disadvantages in (3): Configuration items cannot be managed intuitively by saving them through data streams. Viewing the configuration content requires consuming data streams, which is a cumbersome process. Reading the configuration stream in an associated manner requires additional coding to implement the associated logic, the configuration stream processing method, and the orderliness of the configuration data, which is difficult to implement.
[0049] In order to solve the problem of coupling between technical configuration and code in related technologies, after modifying the configuration, it is necessary to go through cumbersome processes such as compilation and packaging, online replacement, and application restart. At the same time, it solves the problem that in related technologies, restarting the application to make the configuration effective easily causes data processing or business processing interruption. In an embodiment of the present application, a method of accessing a configuration center in a streaming application to realize dynamic configuration is provided. The streaming application can manage configuration items through the configuration center, and read the configuration items of the configuration center and cache them in the local memory.
[0050] The technical solutions provided by various embodiments of the present application are described in detail below in conjunction with the accompanying drawings.
[0051] The architecture in the embodiment of the present application is based on Flink. Flink executes any stream data program in a data parallel and pipeline manner. Flink's pipeline runtime system can execute batch and stream processing programs. In addition, Flink's runtime itself also supports the execution of iterative algorithms.
[0052] The architecture also includes: Apollo is a distributed configuration center developed by Ctrip's framework department. It can centrally manage the configuration of different application environments and clusters. After the configuration is modified, it can be pushed to the application end in real time. It also has standardized permissions, process governance and other features, and is suitable for microservice configuration management scenarios.
[0053] The present application embodiment provides a method for dynamically configuring a streaming application, such as Figure 1 As shown, a schematic flow chart of a method for dynamically configuring a streaming application in an embodiment of the present application is provided, and the method at least includes the following steps S110 to S140:
[0054] Step S110, receiving preset connection parameters of the configuration center, wherein the preset connection parameters include a connection address and an application ID.
[0055] In the process of processing real-time data streams based on the streaming computing engine Flink, it is necessary to read the corresponding environment configuration items, business configuration items or performance configuration items for various data in the data stream according to the business logic. Considering the coupling problem between technical configuration and code, after modifying the configuration, it is necessary to go through cumbersome processes such as compilation and packaging, online replacement, and application restart. By receiving the preset connection parameters of the configuration center, it can be used to establish a connection with the configuration center. The connection address and application ID are carried in the preset connection parameters.
[0056] The purpose of preset parameters is to enable the program to connect to the specified configuration center. To achieve this function, you need to pass the connection parameters to the application. During the startup process of the Flink streaming application, it can connect to the configuration center to implement subsequent configuration loading, caching, and updating functions.
[0057] It can be understood that the application ID refers to the Flink application ID configured in the configuration center. During the startup of the Flink application, this ID will be passed to the Flink application as a startup parameter, so that Flink can go to the configuration center to find the corresponding configuration information based on this ID.
[0058] Streaming applications are implemented based on the programming interface natively provided by Flink, and can be seamlessly integrated with other components or processing mechanisms in the Flink framework while reducing the complexity of implementation.
[0059] Step S120: establishing a connection with the configuration center according to the preset connection parameters.
[0060] The streaming application establishes a connection with the configuration center according to preset connection parameters, and can usually connect to the configuration center using an API interface provided by the configuration center.
[0061] The Flink programming model provides three methods, open, invoke, and close, for computing unit logic implementation, which are used for computing unit initialization, business processing, and resource release. Each computing unit of a streaming application obtains the connection parameters of the configuration center during initialization (in the open method), connects to the configuration center using the API (application programming interface) provided by the configuration center, and obtains the configuration set corresponding to the application ID specified in the connection parameters.
[0062] It can be understood that in addition to being obtained through code compilation, the configuration center can also be replaced by a database table. The configuration items are written into the database as database records, and then the records of the configuration table in the database are queried when the computing unit of the streaming application is initialized, cached locally, and the configuration table is regularly queried and updated in the pull method to achieve dynamic configuration. Finally, the configuration is read from the cache during business processing.
[0063] Step S130, after connecting to the configuration center based on the connection address, cache and update the configuration information of the configuration center.
[0064] After the connection with the configuration center is based on the connection address, the configuration information of the configuration center can be cached and updated, that is, the streaming application caches the original configuration or the configuration object that is parsed to meet the business needs.
[0065] Step S140: read the dynamic changes of the configuration information to obtain the latest configuration information.
[0066] Dynamic configuration information provides configuration change access to the configuration center based on Flink streaming applications, and provides the ability for Flink to dynamically update and take effect the changed configuration in real time.
[0067] The streaming application reads the dynamic changes of the configuration information, establishes a connection with the configuration center, reads the configuration, caches the configuration, monitors the configuration changes and updates the cache.
[0068] Through the above method, the streaming application is executed, and the streaming application integrates the configuration center to realize the solution process of dynamic configuration, which is to transmit the configuration center, connect to the configuration center, cache and listen to the configuration, and read the cache configuration.
[0069] In addition, the above method provides an implementation method for transmitting the configuration center connection information to the streaming application and the real-time application computing unit monitoring the configuration changes of the configuration center.
[0070] In one embodiment of the present application, the streaming application includes multiple computing units, and the method also includes: obtaining preset connection parameters of the configuration center during initialization; each computing unit in the streaming application uses an API interface provided by the configuration center to connect to the configuration center, and obtains the configuration set corresponding to the application ID preset in the preset connection parameters.
[0071] As mentioned above, when initializing a streaming application, you first need the Apollo JVM startup parameters and Apollo configuration information, then the task jar package and task configuration, and finally the Flink startup script.
[0072] Flink streaming applications include computing units. Specifically, streaming applications split the entire business processing logic into different modules, namely computing units. Before submitting the application, the definition of each computing unit is completed through different parameters and logic. After the application is submitted, computing resources are allocated to each computing unit and initialized. After the initialization is completed, business processing is performed. During the process of accessing the configuration center, the connection parameters of the configuration center, including the connection address, application ID, etc., are passed to the streaming application, and then the streaming application connects to the configuration center through the passed-in parameters.
[0073] It should be noted that the configuration set corresponding to the application ID is the set of configuration information required for processing and calculation during the operation of the Flink streaming application. During the Flink streaming application process, the configuration set corresponding to the configuration in the configuration center is found according to the application ID, and the configuration set is loaded into the application. When processing, it can be processed according to the configuration center.
[0074] Through the above steps, you can use the multiple environments, permission management, version release management and other functions provided by the configuration center to manage the configuration in a refined manner.
[0075] In one embodiment of the present application, after connecting to the configuration center based on the connection address, caching and updating the configuration information of the configuration center includes: after each computing unit in the streaming application obtains the configuration information of the configuration center during initialization, caching the original configuration and / or the configuration object that meets business needs after parsing, and the caching includes at least one of the following: caching the configuration in the local JVM memory, caching to an external storage system according to business needs; establishing a monitoring mechanism to perceive the configuration changes of the configuration center and making the same changes to the local cache according to the configuration changes.
[0076] Optionally, the connection parameters are passed to the startup class of the streaming application at startup. The application parses the passed-in parameters when running the startup class, and passes the connection parameters to the computing unit that needs to connect to the configuration center when defining it.
[0077] Optionally, considering that the current mainstream streaming computing engines (flink, spark, storm) are all based on the Java virtual machine (JVM), the connection parameters of the configuration center can be configured into the JVM parameters of the streaming application, and the computing units that need to connect to the configuration center directly obtain the connection parameters from the JVM parameters.
[0078] The above method solves the problem of coupling of existing technical configuration and code, and the need to restart the application to make configuration changes effective, while also avoiding business interruption.
[0079] In one embodiment of the present application, the establishment of a monitoring mechanism to perceive configuration changes of the configuration center includes: through the configuration change event monitoring function provided by the configuration center, the computing unit selected by the real-time application receives the configuration change information pushed by the configuration center, and then updates the cache processing in a push manner; the real-time application periodically and actively reads the full configuration from the configuration center, and then replaces the local cache processing with the latest full configuration in a pull manner.
[0080] Flink's programming model provides three methods, open, invoke, and close, to implement the computing unit logic, which are used for computing unit initialization, business processing, and resource release (such as memory recovery and database connection closing).
[0081] After each computing unit of the streaming application obtains the configuration of the configuration center during initialization (in the open method), it caches the original configuration or parses it into a configuration object that meets business needs. You can choose to cache the configuration locally, that is, in the JVM memory, or cache it in an external storage system such as redis, hbase, or database according to business needs. The open method is the function called by the initialization configuration during the startup of the flink application. The invoke method is the function called by the business logic after the flink application is started. Here, the initialized configuration can be obtained for use.
[0082] Furthermore, after caching the configuration, each computing unit of the streaming application needs to establish a monitoring mechanism to perceive the configuration changes of the configuration center and make the same changes to the local cache according to the configuration changes.
[0083] Specifically, the configuration change monitoring of the configuration center has two mechanisms: push and pull. Push means that through the configuration change event monitoring function provided by the configuration center, the real-time application computing unit receives the configuration change information pushed by the configuration center, and then performs processing such as updating the cache. Pull means that the real-time application actively reads the full configuration from the configuration center at a fixed time, and then performs processing such as replacing the local cache with the latest full configuration.
[0084] In one embodiment of the present application, the dynamic changes of the configuration information are read to obtain the latest configuration information, including: after multiple computing units establish a connection with the configuration center during initialization, they respectively perform any one or more operations of reading configuration, caching configuration, monitoring configuration changes and updating cache; when processing business, multiple computing units directly read the configuration from the cache.
[0085] Flink's programming model provides three methods, open, invoke, and close, to implement the computing unit logic, which are used for computing unit initialization, business processing, and resource release (such as memory recovery and database connection closing).
[0086] The computing unit in the streaming application completes the establishment of a connection with the configuration center, reads the configuration, caches the configuration, monitors configuration changes, and updates the cache during initialization. The computing unit in the streaming application directly reads the configuration from the cache during business processing (in the invoke method).
[0087] In one embodiment of the present application, the preset connection parameters of the receiving configuration center include a connection address and an application ID, including: passing the connection parameters to a startup class of a streaming application upon startup, the streaming application parsing the passed-in parameters when running the startup class, and passing the connection parameters to a computing unit that needs to connect to the configuration center when defining; and connecting to the configuration center through the computing unit according to the passed-in parameters.
[0088] When the streaming application is started, the connection parameters are passed to the startup class of the streaming application. When the application runs the startup class, the connection parameters are parsed and passed to the computing unit that needs to connect to the configuration center when it is defined.
[0089] In one embodiment of the present application, preset connection parameters of a configuration center are received, wherein the preset connection parameters include a connection address and an application ID, including: configuring the connection parameters of the configuration center to the JVM parameters of a streaming application; obtaining the connection parameters from the JVM parameters based on a computing unit that needs to connect to the configuration center; and connecting to the configuration center through the computing unit according to the input parameters.
[0090] Streaming computing engines are all run based on the Java Virtual Machine (JVM), so the connection parameters of the configuration center can be configured into the JVM parameters of the streaming application, and then the connection parameters can be directly obtained from the JVM parameters through the computing unit that needs to connect to the configuration center.
[0091] The present application embodiment also provides a device 200, such as Figure 2 As shown, a schematic diagram of the structure in an embodiment of the present application is provided, wherein the device 200 at least includes: an acquisition module 210, a first determination module 220, a second determination module 230 and a smoothing module 240, wherein:
[0092] In one embodiment of the present application, the acquisition module 210 is specifically used for:
[0093] In one embodiment of the present application, an initialization module is also included for
[0094] Acquire preset connection parameters of the configuration center during initialization;
[0095] Each computing unit in the streaming application uses the API interface provided by the configuration center to connect to the configuration center, and obtains the configuration set corresponding to the application ID preset in the preset connection parameters.
[0096] In one embodiment of the present application, it also includes: an update module for
[0097] After each computing unit in the streaming application obtains the configuration information of the configuration center during initialization, it caches the original configuration and / or the configuration object obtained after parsing that meets the business needs, and the caching includes at least one of the following: caching the configuration in the local JVM memory, caching in the external storage system according to the business needs;
[0098] A monitoring mechanism is established to sense the configuration changes of the configuration center and make the same changes to the local cache according to the configuration changes.
[0099] In one embodiment of the present application, the update module is also used to
[0100] Through the configuration change event monitoring function provided by the configuration center, the selected computing unit of the real-time application receives the configuration change information pushed by the configuration center, and then updates the cache processing push mode;
[0101] The real-time application actively reads the full configuration from the configuration center at regular intervals, and then uses the latest full configuration to replace the local cache processing in a pull mode.
[0102] In one embodiment of the present application, a reading module is also included for
[0103] After establishing a connection with the configuration center during initialization, multiple computing units respectively perform any one or more operations of reading configuration, caching configuration, monitoring configuration changes, and updating cache;
[0104] When processing business, multiple computing units read the configuration directly from the cache.
[0105] In one embodiment of the present application, the receiving module 210 is used to
[0106] Passing the connection parameters to the startup class of the streaming application at startup, the streaming application parses the passed-in parameters when running the startup class, and passes the connection parameters to the computing unit that needs to connect to the configuration center at definition;
[0107] The computing unit is connected to the configuration center according to the input parameters.
[0108] In one embodiment of the present application, the receiving module 210 is further used to
[0109] Configuring the connection parameters of the configuration center to the JVM parameters of the streaming application;
[0110] The computing unit that needs to connect to the configuration center obtains the connection parameters from the JVM parameters;
[0111] The computing unit is connected to the configuration center according to the input parameters.
[0112] It can be understood that the above-mentioned dynamic configuration device for streaming applications can implement the various steps of the dynamic configuration method for streaming applications provided in the above-mentioned embodiments. The relevant explanations on the dynamic configuration method for streaming applications are applicable to the dynamic configuration device for streaming applications and will not be repeated here.
[0113] Figure 3 This is a schematic diagram of the structure of an electronic device according to an embodiment of the present application. Figure 3 At the hardware level, the electronic device includes a processor, and optionally also includes an internal bus, a network interface, and a memory. The memory may include a memory, such as a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk storage. Of course, the electronic device may also include hardware required for other services.
[0114] The processor, network interface and memory can be interconnected through an internal bus, which can be an ISA (Industry Standard Architecture) bus, a PCI (Peripheral Component Interconnect) bus or an EISA (Extended Industry Standard Architecture) bus. The bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 3 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0115] The memory is used to store the program. Specifically, the program may include a program code, and the program code includes a computer operation instruction. The memory may include a memory and a non-volatile memory, and provides instructions and data to the processor.
[0116] The processor reads the corresponding computer program from the non-volatile memory into the memory and then runs it, forming a dynamic configuration device for streaming applications at the logical level. The processor executes the program stored in the memory and is specifically used to perform the following operations:
[0117] Receive preset connection parameters from a configuration center, where the preset connection parameters include a connection address and an application ID;
[0118] Establishing a connection with the configuration center according to the preset connection parameters;
[0119] After connecting to the configuration center based on the connection address, cache and update the configuration information of the configuration center; and
[0120] Read the dynamic changes of the configuration information to obtain the latest configuration information.
[0121] The above application Figure 1 The method performed by the dynamic configuration device of the streaming application disclosed in the illustrated embodiment can be applied to a processor or implemented by a processor. The processor may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by an integrated logic circuit of hardware in the processor or an instruction in the form of software. The above processor may be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in the embodiments of the present application can be implemented or executed. The general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc. The steps of the method disclosed in conjunction with the embodiments of the present application can be directly embodied as a hardware decoding processor for execution, or a combination of hardware and software modules in the decoding processor for execution. The software module can be located in a storage medium mature in the art such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory, and the processor reads the information in the memory and completes the steps of the above method in combination with its hardware.
[0122] The electronic device may also perform Figure 1 Method for executing a dynamic configuration device of a streaming application in a streaming application, and realizing the dynamic configuration device of the streaming application in Figure 1 The functions of the illustrated embodiment will not be described in detail in the embodiments of the present application.
[0123] The present application also provides a computer-readable storage medium, which stores one or more programs, wherein the one or more programs include instructions, which, when executed by an electronic device including multiple application programs, enable the electronic device to execute Figure 1 The method executed by the dynamic configuration device of the streaming application in the embodiment shown is specifically used to execute:
[0124] Receive preset connection parameters from a configuration center, where the preset connection parameters include a connection address and an application ID;
[0125] Establishing a connection with the configuration center according to the preset connection parameters;
[0126] After connecting to the configuration center based on the connection address, cache and update the configuration information of the configuration center; and
[0127] Read the dynamic changes of the configuration information to obtain the latest configuration information.
[0128] Those skilled in the art will appreciate that embodiments of the present invention may be provided as methods, systems, or computer program products. Therefore, the present invention may take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the present invention may take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0129] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0130] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1A function specified in one or more boxes.
[0131] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0132] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0133] The memory may include non-permanent storage in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0134] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0135] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0136] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0137] The above is only an embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various changes and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application should be included in the scope of the claims of the present application.
Claims
1. A dynamic configuration method for streaming applications, in, Executed by a streaming application, the method includes: Receive preset connection parameters from a configuration center, where the preset connection parameters include a connection address and an application ID; Establishing a connection with the configuration center according to the preset connection parameters; After connecting to the configuration center based on the connection address, cache and update the configuration information of the configuration center; and Read the dynamic changes of the configuration information to obtain the latest configuration information.
2. The method according to claim 1, in, The streaming application includes a plurality of computing units, and the method further includes: Acquire preset connection parameters of the configuration center during initialization; Each computing unit in the streaming application uses the API interface provided by the configuration center to connect to the configuration center, and obtains the configuration set corresponding to the application ID preset in the preset connection parameters.
3. The method according to claim 2, in, After connecting to the configuration center based on the connection address, caching and updating the configuration information of the configuration center includes: After each computing unit in the streaming application obtains the configuration information of the configuration center during initialization, it caches the original configuration and / or the configuration object obtained after parsing that meets the business needs, and the caching includes at least one of the following: caching the configuration in the local JVM memory, caching in the external storage system according to business needs; A monitoring mechanism is established to sense the configuration changes of the configuration center and make the same changes to the local cache according to the configuration changes.
4. The method according to claim 3, in, The establishing of a monitoring mechanism to sense configuration changes of the configuration center includes: Through the configuration change event monitoring function provided by the configuration center, the selected computing unit of the real-time application receives the configuration change information pushed by the configuration center, and then updates the cache processing push mode; The real-time application actively reads the full configuration from the configuration center at regular intervals, and then uses the latest full configuration to replace the local cache processing in a pull mode.
5. The method according to claim 2, in, The reading of the dynamic changes of the configuration information to obtain the latest configuration information includes: After establishing a connection with the configuration center during initialization, multiple computing units respectively perform any one or more operations of reading configuration, caching configuration, monitoring configuration changes, and updating cache; When processing business, multiple computing units read the configuration directly from the cache.
6. The method according to claim 1, in, The receiving configuration center's preset connection parameters, the preset connection parameters including the connection address and the application ID, include: Passing the connection parameters to the startup class of the streaming application at startup, the streaming application parses the passed-in parameters when running the startup class, and passes the connection parameters to the computing unit that needs to connect to the configuration center when defining; The computing unit is connected to the configuration center according to the input parameters.
7. The method according to claim 6, in, Receive preset connection parameters from the configuration center, the preset connection parameters including the connection address and application ID, including: Configuring the connection parameters of the configuration center to the JVM parameters of the streaming application; The computing unit that needs to connect to the configuration center obtains the connection parameters from the JVM parameters; The computing unit is connected to the configuration center according to the input parameters.
8. A dynamic configuration device for streaming applications, in, Executed by a streaming application, the device comprises: A receiving module, used to receive preset connection parameters from a configuration center, wherein the preset connection parameters include a connection address and an application ID; A connection establishment module, used to establish a connection with the configuration center according to the preset connection parameters; a cache module, configured to cache and update configuration information of the configuration center after connecting to the configuration center based on the connection address; and The reading module is used to read the dynamic changes of the configuration information to obtain the latest configuration information.
9. An electronic device, include: processor; as well as A memory arranged to store computer executable instructions, which when executed cause the processor to perform the method of any one of claims 1 to 7.
10. A computer-readable storage medium storing one or more programs, which, when executed by an electronic device including a plurality of application programs, causes the electronic device to execute any one of the methods of claims 1 to 7.
