Data source control method, electronic equipment, storage medium and program product
By obtaining and storing data source configuration information, dynamically loading and configuring new data source connections, and adjusting connection pool parameters according to load conditions, the problem in the existing technology that applications cannot dynamically load new data sources is solved, and the flexibility of applications is improved. reliability and system performance.
Patent Information
- Application Number
- CN202410524357.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-04-28
- Publication Date
- 2024-08-23
AI Technical Summary
In the existing technology, an application can only establish a connection with a fixed data source when it is started, and cannot dynamically load new data sources, resulting in poor application flexibility and waste of connection resources.
By obtaining the configuration information of the data source to be loaded, storing and executing the data source loading steps, dynamically loading and configuring new data source connections, and adjusting the parameters of the connection pool according to the server load to ensure that the data transmission capability matches the load.
It realizes dynamic loading of new data source connections during application operation, increases the flexibility of the application, meets user needs, avoids waste of connection resources, and improves system performance and stability.
Smart Images

Figure CN118535239A
Abstract
Description
Technical Field
[0001] The present disclosure relates to a control method for a data source, an electronic device, a storage medium, and a program product. Background Art
[0002] Data source connection management is an important aspect of the normal operation of an application. After an application creates a connection with a data source, it can perform corresponding operations on the data in the data source through the connection according to the user's instructions.
[0003] At present, the way for an application to create a connection with a data source is that the application creates a connection according to a pre-configured fixed configuration during its startup phase. After the application is started, the data source can be operated through the created connection. When the above method is used to establish a connection between an application and a data source, the application can only operate on the data source that has been connected during its startup process. After the application is started, it cannot create connections for other data sources other than these data sources that have been connected. As a result, the application can only use fixed data sources, resulting in poor flexibility in operating data sources, making it difficult to meet user needs, and potentially wasting connection resources. Summary of the invention
[0004] In order to solve at least one of the above technical problems, the present disclosure provides a control method, device, electronic device, storage medium and program product for a data source.
[0005] In a first aspect, the present disclosure proposes a method for controlling a data source, comprising: obtaining configuration information of a data source to be loaded, the data source to be loaded comprising a data source that needs to establish a connection with the application after the application is started, the configuration information comprising connection parameters of the data source to be loaded; storing the configuration information, and executing a data source loading step, the data source loading step comprising: loading the data source to be loaded in the application according to the configuration information; and in response to a content change of the stored configuration information, triggering an operation of performing a configuration change on a connection of a corresponding loaded data source according to the changed configuration information.
[0006] According to one embodiment of the present disclosure, after storing the configuration information, the method further includes: polling the stored configuration information; and if the data source corresponding to the stored configuration information has not been loaded by the application, taking the data source corresponding to the stored configuration information as the data source to be loaded, and executing the data source loading step.
[0007] According to one embodiment of the present disclosure, the connection parameters include a minimum number of connections and a maximum number of connections.
[0008] According to an embodiment of the present disclosure, loading the data source to be loaded in the application according to the configuration information includes: creating a connection pool of the data source to be loaded according to the configuration information, and configuring parameters of the connection pool.
[0009] According to an embodiment of the present disclosure, configuring parameters of the connection pool includes: creating connections of the connection pool according to the connection parameters so that the initial number of connections in the connection pool is the minimum number of connections.
[0010] According to an embodiment of the present disclosure, the condition for triggering the change of the stored configuration information includes: the connection parameters of the connection pool make the data transmission capacity provided by the connection pool mismatched with the load usage of the server.
[0011] According to one embodiment of the present disclosure, the load usage of the server is represented by one or more of the following: CPU usage rate, server load value, and the current number of requests of the application.
[0012] A second aspect of the present disclosure proposes a control device for a data source, comprising: an information acquisition module, used to acquire configuration information of a data source to be loaded, wherein the data source to be loaded includes a data source that needs to establish a connection with the application after the application is started, and the configuration information includes connection parameters of the data source to be loaded; an information storage module, used to store the configuration information and execute a data source loading step, wherein the data source loading step includes: loading the data source to be loaded in the application according to the configuration information; and a configuration change module, used to trigger an operation of changing the configuration of the connection of the corresponding loaded data source according to the changed configuration information in response to a change in the content of the stored configuration information.
[0013] The third aspect of the present disclosure proposes an electronic device, comprising: a memory, the memory storing execution instructions; and a processor, the processor executing the execution instructions stored in the memory, so that the processor executes the data source control method described in any of the above embodiments.
[0014] A fourth aspect of the present disclosure proposes a readable storage medium, in which execution instructions are stored. When the execution instructions are executed by a processor, they are used to implement the control method of the data source described in any of the above embodiments.
[0015] A fifth aspect of the present disclosure proposes a computer program product, including a computer program / instruction, which, when executed by a processor, implements the method for controlling a data source described in any of the above embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] The accompanying drawings illustrate exemplary embodiments of the present disclosure and together with the description serve to explain the principles of the present disclosure. These drawings are included to provide a further understanding of the present disclosure and are incorporated in and constitute a part of this specification.
[0017] Figure 1 It is a flowchart of a method for controlling a data source according to an embodiment of the present disclosure.
[0018] Figure 2 It is a flowchart of a method for controlling a data source according to another embodiment of the present disclosure.
[0019] Figure 3 It is a flowchart of a method for controlling a data source according to yet another embodiment of the present disclosure.
[0020] Figure 4 is a schematic diagram of a control device of a data source using a hardware implementation of a processing system according to one embodiment of the present disclosure. DETAILED DESCRIPTION
[0021] The present disclosure is further described in detail below in conjunction with the accompanying drawings and implementations. It is understood that the specific implementations described herein are only used to explain the relevant content, rather than to limit the present disclosure. It should also be noted that, for ease of description, only the parts related to the present disclosure are shown in the accompanying drawings.
[0022] It should be noted that, in the absence of conflict, the embodiments and features of the embodiments in the present disclosure can be combined with each other. The technical solution of the present disclosure will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0023] Unless otherwise specified, the exemplary embodiments / embodiments shown will be understood as providing exemplary features of various details of some ways in which the technical concept of the present disclosure can be implemented in practice. Therefore, unless otherwise specified, the features of the various embodiments / embodiments can be combined, separated, interchanged and / or rearranged without departing from the technical concept of the present disclosure.
[0024] The terms used herein are for the purpose of describing specific embodiments, rather than being restrictive. As used herein, unless the context clearly indicates otherwise, the singular forms "one (kind, person)" and "said (the)" are also intended to include plural forms. In addition, when the terms "comprise" and / or "include" and their variations are used in this specification, it is explained that there are stated features, integral bodies, steps, operations, parts, assemblies and / or their groups, but it is not excluded that there are or add one or more other features, integral bodies, steps, operations, parts, assemblies and / or their groups. It should also be noted that, as used herein, the terms "substantially", "approximately" and other similar terms are used as approximate terms and not as degree terms, so that they are used to explain the inherent deviations of the measured values, calculated values and / or the values provided that will be recognized by those of ordinary skill in the art.
[0025] As the business develops, some new business data will be generated, and new business databases may be formed. These databases are equivalent to data sources. Users need to query data and request feedback from these data sources through applications. Therefore, applications need to be able to dynamically load data sources so that new data sources can also interact with applications through connections.
[0026] However, in existing solutions, the data source is usually loaded and ready when the application starts. After the application starts, only the data source loaded during the startup process and the connection created can be used. For example, for connection pools based on JDBC (Java Database Connectivity) such as Druid connection pool, Hakari connection pool or CP30 connection pool, the data source is loaded when the application starts, and it does not support adding and loading new data sources during the application running process. If you want to add a new data source to the application, you need to close the application and restart it to load the data source configuration, so the connection between the application and the newly formed data source cannot be realized.
[0027] The following takes the application scenario of dynamically loading the database of an enterprise application as an example and describes the control method, device, electronic device, readable storage medium and computer program product of the data source disclosed in the present invention with reference to the accompanying drawings.
[0028] Figure 1 FIG. 1 is a flow chart of a method for controlling a data source according to an embodiment of the present disclosure. Figure 1 The present disclosure provides a data source control method M100. The data source control method M100 of this embodiment may include the following steps S110, S120 and S130.
[0029] S110, obtaining configuration information of the data source to be loaded, wherein the data source to be loaded includes a data source that needs to establish a connection with the application after the application is started, and the configuration information includes connection parameters of the data source to be loaded.
[0030] S120, storing the configuration information and executing a data source loading step, wherein the data source loading step includes: loading the data source to be loaded in the application according to the configuration information.
[0031] S130, in response to a change in the content of the stored configuration information, triggering an operation of changing the configuration of the connection of the corresponding loaded data source according to the changed configuration information.
[0032] According to the data source control method proposed in the implementation manner of the present disclosure, a new data source connection can be added after the application is started, and the connection configuration of the newly added data source can be dynamically implemented during the operation of the application, thereby increasing the flexibility of the application's operation on the data source, meeting the user's business needs for data source operation, and avoiding wasting connection resources, thereby improving the performance and stability of the system.
[0033] After the application is started, the application will implement functions such as user query of data sources according to the connection configuration made during the startup process. Assuming that the application loads data source A and data source B during the startup process and performs connection configuration for data source A and data source B, after the application is started, the user can operate data source A and data source B through the application.
[0034] If the system newly creates data source C due to the development of new business or other reasons, then in order to enable users to query data source C through the application, data source C needs to be loaded into the application. At this time, data source C is a data source to be loaded that needs to establish a connection with the application after the application is started. The business party of data source C can send a corresponding request to the interface of the application, and the request information includes the configuration information of data source C. The application can obtain the configuration information of data source C through the received request.
[0035] After the application receives the configuration information, the application can load the data source C according to the connection parameters of the data source C in the configuration information, and initialize the connection configuration of the data source C in the application. At the same time, after receiving the configuration information, the application also stores the configuration information in a specified location in the system. It can be understood that data source A and data source B also have their own configuration information, which can also be stored in a specified location in the system.
[0036] In the subsequent process of using the application to interact with data sources A, B, and C through connection, if the connection configuration of the data source needs to be adjusted, it can be achieved by modifying the configuration information of the corresponding data source. For example, the number of users visiting data source A suddenly increases, and the connection resources currently configured for data source A in the application are insufficient to support the data transmission requirements caused by the current number of visits. At this time, the configuration information of data source A can be modified to modify the content in the configuration information so that the connection resources of data source A increase.
[0037] The system can monitor the configuration information. When the configuration information is monitored to change, the application starts to allocate connection resources according to the changed configuration information, thereby allocating more connection resources to data source A, so that data source A can normally meet the access needs of various users when the current access volume suddenly increases. It is understandable that the system can also obtain configuration information regularly and automatically configure connection resources according to the latest configuration information obtained, so as to adapt to different load conditions, which can both meet user needs and avoid wasting connection resources.
[0038] Figure 2 FIG. 1 is a flow chart of a method for controlling a data source according to another embodiment of the present disclosure. Figure 2 , step S110 may include step S111.
[0039] S111, receiving a configuration file sent by a business party, wherein the configuration file includes configuration information of a data source to be loaded.
[0040] The business party will record the configuration information of its own data source in the configuration file, and when the data source needs to be loaded into the application, it will send the configuration file to the application so that the application can configure the connection pool of the data source through the configuration information recorded in the configuration file to achieve connection and interaction between the application and the data source.
[0041] After the application obtains the configuration file through the interface and reads the configuration information, when configuring the data source to be loaded based on the configuration information, the loading may fail due to unexpected reasons. In order to compensate for the possible loading failure, after storing the configuration information, the application can poll the stored configuration information. If the data source corresponding to the stored configuration information is not loaded by the application, the data source corresponding to the stored configuration information is used as the data source to be loaded, and the data source loading step is performed.
[0042] For example, after the application receives the configuration file about data source C and obtains the configuration information of data source C, it starts to load data source C based on the configuration information, and stores the configuration information on the other hand. The storage location can be the configuration information of the loaded data source A or data source B, or a designated location in the system specifically used to store the configuration information of each data source.
[0043] The application can automatically obtain the configuration information of data source A and data source B at a fixed time, or automatically obtain the configuration information stored at a specified location, thereby obtaining the configuration information of data source C. If the configuration information of data source C is stored therein, and the application fails to load data source C for the first time, the currently loaded data sources are only data source A and data source B, that is, the data sources corresponding to the stored configuration information are more than the loaded data sources. At this time, the application starts to load data source C again using the configuration information of data source A or data source B or data source C stored at the specified location. This achieves compensation for the failure of data source loading.
[0044] If the data source C is loaded successfully the first time, when the application periodically obtains the configuration information of the loaded data source from the specified location, the data source corresponding to the stored configuration information is exactly the same as the loaded data source, and there is no need to load the data source C again.
[0045] The connection parameters may include a minimum number of connections and a maximum number of connections. The minimum number of connections L1 is used to limit the number of connections between the application and the data source to a minimum number not less than L1, and the maximum number of connections L2 is used to limit the number of connections between the application and the data source to a maximum number not exceeding L2.
[0046] In the above data source loading step, the method of loading the data source to be loaded in the application according to the configuration information may include: creating a connection pool of the data source to be loaded according to the configuration information, and configuring parameters of the connection pool. Wherein, the method of configuring parameters of the connection pool may include: creating a connection of the connection pool according to the connection parameters, so that the initial number of connections in the connection pool is the minimum number of connections.
[0047] When the application loads the data source and initializes the connection pool of the data source, a minimum number of connections, L1, is created in the connection pool.
[0048] When the application needs to communicate with the database, for example, when the business party as a user needs to search for data source C, the application can request an available connection from the connection pool of data source C, and use the connection to operate data source C after obtaining the connection, so as to enable the business party to search for data source C. As the business party interacts with the data source through the application, the number of connections in the connection pool of the data source will change between L1 and L2.
[0049] In step S130, the conditions for triggering a change in the stored configuration information may include: the connection parameters of the connection pool cause a mismatch between the data transmission capacity provided by the connection pool and the server's load usage. Among them, the server's load usage can be represented by one or more of the following: CPU usage rate, server load value, and the current number of requests for the application.
[0050] The system can obtain the current load situation when the load changes or at a preset time period, and then adjust the corresponding configuration information based on the obtained current load situation. The adjustment of the configuration information can directly trigger the system to obtain the adjusted configuration information and reconfigure the connection pool according to the adjusted configuration information. After reconfiguration, the connection pool can better match the actual load situation, realizing the dynamic adaptation of the connection pool to load changes, solving connection bottlenecks during high loads, avoiding wasting resources during low loads, improving resource utilization under the condition of meeting the server's load usage, and ensuring the performance of the system.
[0051] If the CPU usage rate exceeds the set first ratio threshold T11, or the server's load value exceeds the set first load threshold T21, or the number of requests for this data source sent by the business side exceeds the set first quantity threshold T31, it indicates that the minimum connection number L1 and the maximum connection number L2 configured for this data source currently are insufficient to handle the load. At this time, the size of the connection pool can be increased. For example, the value of L2 can be adjusted to make L2 larger, or the values of both L1 and L2 can be adjusted simultaneously to make both L1 and L2 larger. This can enable the application to create new data source connections, thereby improving the parallel processing speed and alleviating the load situation, and reducing the number of requests in the queue.
[0052] If the CPU usage rate is lower than the set second ratio threshold T12 (T12 < T11), or the server's load value is lower than the set second load threshold T22 (T22 < T21), or the number of requests for this data source sent by the business side is lower than the set second quantity threshold T32 (T32 < T31), it indicates that the number of connections configured for this data source currently is excessive. The size of the connection pool can be reduced, and the redundant connections can be closed to release resources. For example, the value of L2 can be adjusted to make L2 smaller, or the values of both L1 and L2 can be adjusted simultaneously to make both L1 and L2 smaller, thereby saving connection resources and computing resources.
[0053] When adjusting the sizes of L1 and L2, it can be to synchronously adjust L1 and L2 of each connection pool by the same adjustment amount, or to separately adjust L1 and L2 of different connection pools according to their respective usage situations.
[0054] Connection parameters can also include connection idle time. The system can obtain the usage of connections in each connection pool in real time. If the connection idle time exceeds the predetermined maximum idle time, the connection is marked as recyclable. The system can periodically check the connections in the connection pool and recycle resources for the connections marked as recyclable, that is, close the connection and release resources. At this time, the actual number of connections is reduced by one, which is convenient for effective reuse of connections. If a new connection request occurs, the system can first allocate the connection marked as recyclable. Through connection reuse and automatic adjustment, the system reduces frequent connection establishment and disconnection operations, thereby reducing system overhead.
[0055] After the application has finished using the connection, it can return the connection to the connection pool so that other applications can reuse the connection. The returned connection becomes an available connection, and the connection status is reset.
[0056] Figure 3 FIG. 1 is a flow chart of a method for controlling a data source according to another embodiment of the present disclosure. Figure 3 The implementation steps of the data source control method of this embodiment include the following steps.
[0057] S901, receiving a configuration file sent by a business party, wherein the configuration file includes configuration information of a data source to be loaded, the data source to be loaded includes a data source that needs to establish a connection with the application after the application is started, and the configuration information includes connection parameters of the data source to be loaded, the connection parameters include a maximum number of connections, a minimum number of connections, and a connection idle time.
[0058] S902, storing the configuration information and executing a data source loading step, wherein the data source loading step includes: creating a connection pool of the data source to be loaded according to the configuration information, and creating a connection in the connection pool according to the connection parameters, so that the initial number of connections in the connection pool is the minimum number of connections.
[0059] S903, polling the stored configuration information to perform a secondary load when the first load fails. If the data source corresponding to the stored configuration information has not been loaded by the application, the data source corresponding to the stored configuration information is used as the data source to be loaded, and the above data source loading step is performed.
[0060] S904, periodically obtain load usage, which includes the CPU usage rate of the server, the server load value, and the current number of requests of the application.
[0061] S906, adjusting the configuration value of the number of connections based on the load usage. If the actual value of the parameter used to characterize the load usage is higher than the corresponding threshold, the minimum number of connections and the maximum number of connections in the configuration information are adjusted upward. If the actual value of the parameter used to characterize the load usage is lower than the corresponding threshold, the minimum number of connections and the maximum number of connections in the configuration information are adjusted downward.
[0062] Figure 4 is a schematic diagram of a control device for a data source using a hardware implementation of a processing system according to an embodiment of the present disclosure. Figure 4 The present disclosure also provides a control device 1000 for a data source. The control device 1000 for a data source in this embodiment may include an information acquisition module 1002 , an information storage module 1004 and a configuration change module 1006 .
[0063] The information acquisition module 1002 is used to acquire configuration information of the data source to be loaded, wherein the data source to be loaded includes a data source that needs to establish a connection with the application after the application is started, and the configuration information includes connection parameters of the data source to be loaded.
[0064] The information storage module 1004 stores the configuration information and executes a data source loading step, wherein the data source loading step includes: loading the data source to be loaded in the application according to the configuration information.
[0065] In response to the content change of the stored configuration information, the configuration change module 1006 triggers an operation of changing the configuration of the connection of the corresponding loaded data source according to the changed configuration information.
[0066] The information acquisition module 1002 may acquire the configuration information of the data source to be loaded in a manner that includes: receiving a configuration file sent by a business party, wherein the configuration file includes the configuration information of the data source to be loaded.
[0067] After storing the configuration information, the information storage module 1004 may poll the stored configuration information. If the data source corresponding to the stored configuration information has not been loaded by the application, the data source corresponding to the stored configuration information is used as the data source to be loaded, and the data source loading step is performed.
[0068] Connection parameters can include a minimum number of connections and a maximum number of connections.
[0069] In the above data source loading step, the method of loading the data source to be loaded in the application according to the configuration information may include: creating a connection pool of the data source to be loaded according to the configuration information, and configuring parameters of the connection pool. Wherein, the method of configuring parameters of the connection pool may include: creating a connection of the connection pool according to the connection parameters, so that the initial number of connections in the connection pool is the minimum number of connections.
[0070] The conditions for triggering the change of the stored configuration information may include: the connection parameters of the connection pool make the data transmission capacity provided by the connection pool not match the load usage of the server. The load usage of the server may be represented by one or more of the following: CPU usage, server load value, and current number of requests of the application.
[0071] It should be noted that the details not disclosed in the control device 1000 of the data source of this embodiment can refer to the details disclosed in the control method M100 of the data source of the above-mentioned embodiment proposed in the present disclosure, and will not be repeated here.
[0072] The control device 1000 of the data source may include corresponding modules for executing each or several steps in the above flowchart. Therefore, each step or several steps in the above flowchart may be executed by the corresponding module, and the device may include one or more modules of these modules. The module may be one or more hardware modules specially configured to execute the corresponding steps, or implemented by a processor configured to execute the corresponding steps, or stored in a computer-readable medium for implementation by a processor, or implemented by some combination.
[0073] The hardware structure of the control device 1000 of the data source can be implemented using a bus architecture. The bus architecture may include any number of interconnected buses and bridges, depending on the specific application and overall design constraints of the hardware. The bus 1100 connects various circuits including one or more processors 1200, memory 1300 and / or hardware modules together. The bus 1100 may also connect various other circuits 1400 such as peripherals, voltage regulators, power management circuits, external antennas, etc.
[0074] The bus 1100 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Component (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, the figure only uses one connecting line, but does not mean that there is only one bus or one type of bus.
[0075] Any process or method description in the flowchart or otherwise described herein can be understood as a module, fragment or portion of a code representing one or more executable instructions for implementing the steps of a specific logical function or process, and the scope of the preferred embodiments of the present disclosure includes other implementations, in which the functions may not be performed in the order shown or discussed, including performing the functions in a substantially simultaneous manner or in a reverse order according to the functions involved, which should be understood by a person skilled in the art of the present disclosure. The processor performs the various methods and processes described above. For example, the method implementation in the present disclosure can be implemented as a software program, which is tangibly contained in a machine-readable medium, such as a memory. In some embodiments, part or all of the software program can be loaded and / or installed via a memory and / or a communication interface. When the software program is loaded into the memory and executed by the processor, one or more steps in the method described above can be performed. Alternatively, in other embodiments, the processor can be configured to perform one of the above methods in any other appropriate manner (e.g., by means of firmware).
[0076] The logic and / or steps represented in the flowchart or otherwise described herein may be embodied in any readable storage medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other system that can fetch instructions from and execute instructions on an instruction execution system, apparatus, or device), or in combination with such instruction execution systems, apparatuses, or devices.
[0077] It should be understood that the various parts of the present disclosure can be implemented in hardware, software, or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented in software stored in a memory and executed by a suitable instruction execution system. For example, if implemented in hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0078] A person skilled in the art can understand that all or part of the steps of the above-mentioned implementation method can be completed by instructing related hardware through a program, and the program can be stored in a readable storage medium, and when the program is executed, it includes one or a combination of the steps of the method implementation. The storage medium can be a volatile / non-volatile storage medium.
[0079] In addition, each functional unit in each embodiment of the present disclosure may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a readable storage medium. The storage medium may be a read-only memory, a disk or an optical disk, etc.
[0080] The present disclosure also provides an electronic device, including: a memory, the memory storing execution instructions; and a processor or other hardware module, the processor or other hardware module executes the execution instructions stored in the memory, so that the processor or other hardware module executes the data source control method of any of the above-mentioned embodiments.
[0081] The present disclosure also provides a computer-readable storage medium, in which execution instructions are stored. When the execution instructions are executed by a processor, they are used to implement the data source control method of any of the above-mentioned embodiments.
[0082] For the purposes of this specification, a "readable storage medium" may be any device that can contain, store, communicate, propagate or transmit a program for use with or in conjunction with an instruction execution system, device or apparatus. More specific examples of readable storage media (a non-exhaustive list) include the following: an electrical connection with one or more wirings (electronic device), a portable computer disk case (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and editable read-only memory (EPROM or flash memory), a fiber optic device, and a portable read-only memory (CDROM). In addition, the readable storage medium may even be paper or other suitable medium on which the program can be printed, since the program can be obtained electronically, for example, by optically scanning the paper or other medium, followed by editing, deciphering or, if necessary, processing in another suitable manner, and then stored in a memory.
[0083] The present disclosure also provides a computer program product, including a computer program / instruction, which implements the data source control method of any of the above-mentioned embodiments when the computer program / instruction is executed by a processor.
[0084] In the description of this specification, the description with reference to the terms "one embodiment / method", "some embodiments / methods", "specific examples", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment / method or example are included in at least one embodiment / method or example of the present disclosure. In this specification, the schematic representations of the above terms are not necessarily the same embodiment / method or example. Moreover, the specific features, structures, materials or characteristics described may be combined in a suitable manner in any one or more embodiments / methods or examples. In addition, those skilled in the art may combine and combine the different embodiments / methods or examples described in this specification and the features of the different embodiments / methods or examples, unless they are contradictory.
[0085] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of the present disclosure, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0086] Those skilled in the art should understand that the above embodiments are only for the purpose of clearly illustrating the present disclosure, and are not intended to limit the scope of the present disclosure. For those skilled in the art, other changes or modifications may be made based on the above disclosure, and these changes or modifications are still within the scope of the present disclosure.
Claims
1. A method for controlling a data source, It is characterized in that include: Acquire configuration information of a data source to be loaded, wherein the data source to be loaded includes a data source that needs to establish a connection with the application after the application is started, and the configuration information includes connection parameters of the data source to be loaded; The configuration information is stored, and a data source loading step is performed, wherein the data source loading step includes: loading the data source to be loaded in the application according to the configuration information; as well as In response to a change in the content of the stored configuration information, an operation of changing the configuration of the connection of the corresponding loaded data source according to the changed configuration information is triggered.
2. The method according to claim 1, It is characterized in that After storing the configuration information, the method further includes: Polling the stored configuration information; and If the data source corresponding to the stored configuration information has not been loaded by the application, the data source corresponding to the stored configuration information is used as the data source to be loaded, and the data source loading step is performed.
3. The method according to claim 1 or 2, It is characterized in that The connection parameters include a minimum number of connections and a maximum number of connections.
4. The method according to claim 3, It is characterized in that Loading the data source to be loaded in the application according to the configuration information includes: A connection pool for the data source to be loaded is created according to the configuration information, and parameters of the connection pool are configured.
5. The method according to claim 4, It is characterized in that Parameter configuration of the connection pool includes: A connection in the connection pool is created according to the connection parameters so that the initial number of connections in the connection pool is the minimum number of connections.
6. The method according to claim 4 or 5, It is characterized in that The conditions for triggering the change of the stored configuration information include: the connection parameters of the connection pool make the data transmission capacity provided by the connection pool mismatch with the load usage of the server.
7. The method according to claim 6, It is characterized in that The load usage of the server is represented by one or more of the following: CPU usage, server load value, and the current number of requests of the application.
8. An electronic device, It is characterized in that include: A memory storing execution instructions; as well as A processor, wherein the processor executes the execution instruction stored in the memory, so that the processor executes the control method of the data source according to any one of claims 1 to 7.
9. A readable storage medium, It is characterized in that The readable storage medium stores execution instructions, which are used to implement the control method of the data source according to any one of claims 1 to 7 when executed by the processor.
10. A computer program product comprising a computer program / instructions, It is characterized in that When the computer program / instructions are executed by a processor, the method for controlling a data source according to any one of claims 1 to 7 is implemented.
