CN115904701A - Parameter refreshing method, device, equipment and storage medium - Google Patents
Parameter refreshing method, device, equipment and storage medium Download PDFInfo
- Publication number
- CN115904701A CN115904701A CN202211352002.8A CN202211352002A CN115904701A CN 115904701 A CN115904701 A CN 115904701A CN 202211352002 A CN202211352002 A CN 202211352002A CN 115904701 A CN115904701 A CN 115904701A
- Authority
- CN
- China
- Prior art keywords
- thread pool
- updated
- parameters
- configuration set
- target
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 238000000034 method Methods 0.000 title claims abstract description 51
- 238000012795 verification Methods 0.000 claims abstract description 16
- 238000012544 monitoring process Methods 0.000 claims abstract description 15
- 230000000903 blocking effect Effects 0.000 claims description 19
- 238000004590 computer program Methods 0.000 claims description 17
- 230000004044 response Effects 0.000 claims description 4
- 238000004891 communication Methods 0.000 description 8
- 238000010586 diagram Methods 0.000 description 7
- 230000008569 process Effects 0.000 description 5
- 238000012545 processing Methods 0.000 description 5
- 230000000694 effects Effects 0.000 description 4
- 230000003287 optical effect Effects 0.000 description 3
- 230000006870 function Effects 0.000 description 2
- 230000003993 interaction Effects 0.000 description 2
- 238000012986 modification Methods 0.000 description 2
- 230000004048 modification Effects 0.000 description 2
- 230000002159 abnormal effect Effects 0.000 description 1
- 238000003491 array Methods 0.000 description 1
- 238000013473 artificial intelligence Methods 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 230000001413 cellular effect Effects 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000004883 computer application Methods 0.000 description 1
- 230000006378 damage Effects 0.000 description 1
- 230000007547 defect Effects 0.000 description 1
- 238000013461 design Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 239000011521 glass Substances 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000010801 machine learning Methods 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 239000013307 optical fiber Substances 0.000 description 1
- 238000011176 pooling Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001953 sensory effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
- 230000000007 visual effect Effects 0.000 description 1
Images
Classifications
-
- Y—GENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Stored Programmes (AREA)
Abstract
The invention discloses a parameter refreshing method, a parameter refreshing device, parameter refreshing equipment and a storage medium. The method comprises the steps of determining a target configuration set from a configuration center when a target application is started, and initializing a local thread pool of the target application according to thread pool parameters in the target configuration set; monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when the target configuration set is monitored to be updated, and verifying the format and the rationality of the updated thread pool parameters; and when the verification is passed, refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters. According to the technical scheme, the thread pool parameters are separated from the application based on the configuration center, so that the remote control and the hot refresh of the thread pool parameters are realized, the parameter adjustment cost is reduced, the timeliness is improved, and the system service capability is improved.
Description
Technical Field
The invention relates to the technical field of computer application, in particular to a parameter refreshing method, device, equipment and storage medium.
Background
The thread pool manages threads in the application in a unified mode based on a pooling idea, system resource exhaustion is avoided by controlling the number of the threads and circularly using thread objects, and meanwhile resource overhead caused by frequent creation and destruction of the threads is reduced. The thread pool parameters include the number of core threads, the maximum number of threads, the length of the blocking queue, etc., which determine the concurrency performance of the application.
At present, thread pool parameters obtained by the industry based on empirical values or theoretical calculation are difficult to adapt to all actual scenes, and in some scenes, the parameters need to be adjusted temporarily for emergency (for example, when a downstream system is abnormal, the number of threads of the system needs to be adjusted to reduce the concurrent request pressure of the downstream system), and when the thread pool parameters need to be adjusted, the application needs to be restarted to enable the parameters to take effect. For a scene with high requirements on timeliness or service continuity, the adjustment mode of the thread pool parameters cannot meet the requirements.
Disclosure of Invention
The invention provides a parameter refreshing method, a parameter refreshing device, equipment and a storage medium, which are used for separating thread pool parameters from applications based on a configuration center, realizing remote control and hot refreshing of the thread pool parameters, reducing parameter adjustment cost, improving timeliness and improving system service capacity.
According to an aspect of the present invention, there is provided a parameter refresh method, including:
determining a target configuration set from a configuration center when a target application is started, and initializing a local thread pool of the target application according to thread pool parameters in the target configuration set;
monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when monitoring that the target configuration set is updated, and verifying the format and the reasonability of the updated thread pool parameters;
and when the verification is passed, refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters.
According to another aspect of the present invention, there is provided a parameter refresh apparatus including:
the thread pool initialization module is used for determining a target configuration set from a configuration center when a target application is started, and initializing a local thread pool of the target application according to thread pool parameters in the target configuration set;
the parameter checking module is used for monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when the target configuration set is monitored to be updated, and checking the format and the reasonability of the updated thread pool parameters;
and the parameter refreshing module is used for refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters when the verification is passed.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the parameter refresh method of any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement a parameter refresh method according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, a target configuration set is determined from a configuration center when a target application is started, and a local thread pool of the target application is initialized according to thread pool parameters in the target configuration set; monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when the target configuration set is monitored to be updated, and verifying the format and the rationality of the updated thread pool parameters; when the verification is passed, the parameters of the local thread pool of the target application are refreshed according to the updated thread pool parameters, and the problems that in the prior art, after the initialization of the thread pool is completed, the application can only run with fixed thread pool parameters, the dynamic hot refresh cannot be realized by the thread pool parameters, when the concurrency performance of the application is adjusted, a configuration file or a database needs to be modified and the application needs to be restarted, the cost is high, the timeliness is poor, and meanwhile, the service interruption is caused are solved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1a is a flowchart of a parameter updating method according to an embodiment of the present invention;
FIG. 1b is a diagram of an application basic model of a parameter updating method according to an embodiment of the present invention;
FIG. 2a is a flowchart of another parameter refresh method according to a second embodiment of the present invention;
fig. 2b is a schematic view of a detailed process of a parameter refreshing method according to a second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a parameter refreshing apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of an electronic device implementing the parameter refreshing method according to the embodiment of the present invention.
Detailed Description
In order to make the technical solutions of the present invention better understood, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
It should be noted that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of the present invention and the above-described drawings, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Example one
Fig. 1a is a flowchart of a parameter refreshing method according to an embodiment of the present invention, where this embodiment is applicable to a situation where local thread pool parameters are refreshed during an application running process, and the method may be executed by a parameter refreshing apparatus, where the parameter refreshing apparatus may be implemented in a form of hardware and/or software, and the parameter refreshing apparatus may be configured in a server where a target application is deployed. As shown in fig. 1a, the method comprises:
s110, when the target application is started, a target configuration set is determined from the configuration center, and a local thread pool of the target application is initialized according to thread pool parameters in the target configuration set.
The target application may refer to an application program, among others. The configuration center can be a distributed configuration center, is a system which is independent of the target application and is used for providing unified configuration management, and can realize decoupling of application programs and configuration management. The configuration center may manage configuration parameters of a plurality of applications, and thus the configuration center may include at least one configuration set established in advance, each configuration set having identification information corresponding to a different application, respectively. A configuration set may refer to a grouping of configuration items under an application that describes a particular property of a set of functional logic. A target configuration set may refer to a set of configurations that match a target application.
In this embodiment, when the target application is started, a target configuration set matched with the target application may be determined from the configuration center, so as to obtain the thread pool parameters in the target configuration set to initialize the parameters of the local thread pool of the target application.
In an optional implementation manner of this embodiment, determining the target configuration set from the configuration center when the target application is started may include: when the target application is started, establishing network connection with a configuration center; and searching a configuration set matched with the target application from the configuration center according to the identification information to obtain a target configuration set.
In this embodiment, when the target application starts to run, a network connection request may be sent to the configuration center, and after the connection is successful, a configuration set matched with the target application may be searched from the configuration center according to the identification information of each configuration set in the configuration center, so as to obtain the target configuration set.
And S120, monitoring the updating state of the target configuration set in real time, acquiring the updated thread pool parameters when the target configuration set is monitored to be updated, and checking the format and the reasonability of the updated thread pool parameters.
The thread pool parameters may include a core thread number, a maximum thread number, and a blocking queue length. Accordingly, the updated thread pool parameters may include an updated core thread count, an updated maximum thread count, and an updated blocking queue length.
In this embodiment, the target application may monitor whether the target configuration set in the configuration center is updated in real time, and if it is monitored that the target configuration set is updated, the updated thread pool parameters in the target configuration set may be obtained, and the updated core thread number, the updated maximum thread number, and the format and the reasonableness of the updated blocking queue length need to be checked.
In an optional implementation manner of this embodiment, monitoring an update state of the target configuration set in real time, and acquiring updated thread pool parameters when it is monitored that the target configuration set is updated, may include: sending an update query request aiming at a target configuration set to a configuration center according to a preset mode; confirming that the updating condition is monitored when an updating notice of the configuration center for the updating inquiry request is received; and acquiring the updated thread pool parameters in response to the update notification.
The preset mode may be a long polling connection mode, or may be other realizable modes, which is not limited in this embodiment. An update query request may refer to a request to query whether an update occurs to a target configuration set. The update notification may be a notification that the hub is about to update the target configuration set to which the update query request is responsive.
In this embodiment, the target application may send an update query request for the target configuration set to the configuration center according to a preset manner to establish a network connection with the configuration center, and confirm that an update condition of the target configuration set is monitored when an update notification of the configuration center is received, so as to obtain updated thread pool parameters in response to the update notification.
And S130, when the verification is passed, refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters.
In this embodiment, if the updated core thread number, the updated maximum thread number, and the updated format and the rationality of the length of the blocking queue pass the verification, the parameters of the local thread pool of the target application may be refreshed according to the updated thread pool parameters.
The distributed configuration center of the embodiment of the invention is a basic service component independent of an application system, can separate application configuration from an application and realizes centralized management of various application configuration parameters. As shown in the basic model diagram of fig. 1b, the thread pool parameters may be stored in the distributed configuration center, the system operation and maintenance staff or the development staff may update and issue the thread pool parameters through the distributed configuration center, and after the application program acquires the latest parameters in real time in a push-pull combined manner, the thread pool parameters are enabled to take effect locally by calling a threadpoolexecution bottom layer method, so as to achieve the effect of performing hot refresh on the thread pool parameters without shutdown, i.e., adjusting the application concurrency performance in real time.
According to the technical scheme of the embodiment of the invention, a target configuration set is determined from a configuration center when a target application is started, and a local thread pool of the target application is initialized according to thread pool parameters in the target configuration set; monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when the target configuration set is monitored to be updated, and verifying the format and the reasonability of the updated thread pool parameters; when the verification is passed, the parameters of the local thread pool of the target application are refreshed according to the updated thread pool parameters, and the problems that in the prior art, after the initialization of the thread pool is completed, the application can only run with fixed thread pool parameters, the dynamic hot refresh cannot be realized by the thread pool parameters, when the concurrency performance of the application is adjusted, a configuration file or a database needs to be modified and the application needs to be restarted, the cost is high, the timeliness is poor, and meanwhile, the service interruption is caused are solved.
Example two
Fig. 2a is a flowchart of another parameter refreshing method according to a second embodiment of the present invention, and this embodiment refines the operation of checking the format and the reasonableness of the updated thread pool parameter based on the above embodiment. As shown in fig. 2a, the method comprises:
s210, when the target application is started, a target configuration set is determined from the configuration center, and a local thread pool of the target application is initialized according to thread pool parameters in the target configuration set.
S220, monitoring the updating state of the target configuration set in real time, and acquiring updated thread pool parameters when the target configuration set is monitored to be updated.
And S230, checking the format of the updated thread pool parameters according to the thread pool parameter standard format.
And S240, checking the rationality of the updated thread pool parameters of different categories.
In an optional implementation manner of this embodiment, the checking the reasonableness of the updated thread pool parameters of different classes may include: judging whether the thread pool parameters of different types are respectively in corresponding preset intervals; if yes, judging whether the updated core thread number is smaller than the updated maximum thread number or not, and whether the updated blocking queue length is larger than the number of tasks to be executed or not; otherwise, the parameters of the local thread pool of the target application are not refreshed according to the updated thread pool parameters.
The preset interval may include a preset core thread number interval, a preset maximum thread number interval, and a preset blocking queue length interval. The core thread number may be the minimum thread number that the thread pool needs to hold, the thread Chi Zhonghe thread number needs to be less than the maximum thread number, otherwise an exception is thrown when the core thread number or the maximum thread number is adjusted. The maximum thread number may be the maximum thread number allowed to be created by the thread Chi Zhongyun, and the non-core thread exceeding the core thread number is automatically recycled by the thread pool after the timeout waiting time is reached. The length of the blocking queue can be the maximum number of tasks that can be accommodated in the thread Chi Zusai queue, the length of the blocking queue needs to be larger than the number of existing tasks to be executed, otherwise, an exception is thrown when the length of the blocking queue is adjusted. Since the thread Chi Zhonghe needs to have a core thread number smaller than the maximum thread number, the preset core thread number interval needs to be smaller than the preset maximum thread number interval. The number of tasks to be performed may be the number of tasks to be performed existing for the target application.
In this embodiment, it may be determined whether the thread pool parameters of different types are in the corresponding preset intervals, if both of the parameters meet the requirement, it may be further determined whether the updated thread pool parameter is smaller than the updated maximum thread pool parameter, and whether the updated blocking queue length is greater than the number of tasks to be executed, and if there is a thread pool parameter that is not in the preset interval, the parameter of the local thread pool of the target application may not be refreshed according to the updated thread pool parameter.
Optionally, after determining whether the updated core thread number is smaller than the updated maximum thread number and whether the updated blocking queue length is greater than the number of tasks to be executed, the method may further include: if yes, determining that the updated thread pool parameters pass verification; otherwise, determining that the updated thread pool parameter check does not pass and not refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters.
And S250, when the verification is passed, refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters.
According to the technical scheme of the embodiment of the invention, a target configuration set is determined from a configuration center when a target application is started, and a local thread pool of the target application is initialized according to thread pool parameters in the target configuration set; monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when the target configuration set is monitored to be updated, and verifying the format of the updated thread pool parameters according to the thread pool parameter standard format; checking the rationality of the updated thread pool parameters of different classes; when the verification passes, the parameters of the local thread pool of the target application are refreshed according to the updated thread pool parameters, and the problems that in the prior art, after the initialization of the thread pool is completed, the application can only run with fixed thread pool parameters, the dynamic hot refresh cannot be realized by the thread pool parameters, when the concurrency performance of the application is adjusted, a configuration file or a database needs to be modified and the application needs to be restarted, the cost is high, the timeliness is poor, and meanwhile, the service interruption is caused are solved.
Fig. 2b is a schematic flow chart of a parameter refresh method according to a second embodiment of the present invention.
1) And when the application is started, establishing network connection with the distributed configuration center.
2) And the application acquires the thread pool parameters from a thread pool parameter configuration set pre-established by the distributed configuration center through the configuration set identification information.
3) And initializing the thread pool according to the obtained thread pool parameters.
4) The application establishes a thread pool parameter configuration set listener in a long polling connection manner.
5) When the configuration center updates and releases the thread pool parameters, the application monitors the change of the configuration set parameters and acquires the updated thread pool parameters.
6) Judging the type of the updated thread pool parameters and checking the format and the rationality of the parameters: (1) checking whether the parameter format is correct; (2) judging the updated thread pool parameter types (the number of core threads, the maximum number of threads and the length of a blocking queue); (3) checking whether the parameters are in a reasonable interval; (4) and checking the rationality of the parameters to be adjusted by combining other parameters.
7) And (4) calling a ThreadPoolExecutor bottom layer method to enable the parameters to take effect locally, and realizing the adjustment of the application concurrency.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a parameter refreshing apparatus according to a third embodiment of the present invention. As shown in fig. 3, the apparatus includes: a thread pool initialization module 310, a parameter check module 320, and a parameter refresh module 330. Wherein:
a thread pool initialization module 310, configured to determine a target configuration set from a configuration center when a target application is started, and initialize a local thread pool of the target application according to thread pool parameters in the target configuration set;
the parameter checking module 320 is configured to monitor an update state of the target configuration set in real time, obtain updated thread pool parameters when it is monitored that the target configuration set is updated, and check a format and a rationality of the updated thread pool parameters;
and the parameter refreshing module 330 is configured to refresh, when the verification passes, the parameter of the local thread pool of the target application according to the updated thread pool parameter.
According to the technical scheme of the embodiment of the invention, a target configuration set is determined from a configuration center when a target application is started, and a local thread pool of the target application is initialized according to thread pool parameters in the target configuration set; monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when the target configuration set is monitored to be updated, and verifying the format and the rationality of the updated thread pool parameters; when the verification passes, the parameters of the local thread pool of the target application are refreshed according to the updated thread pool parameters, and the problems that in the prior art, after the initialization of the thread pool is completed, the application can only run with fixed thread pool parameters, the dynamic hot refresh cannot be realized by the thread pool parameters, when the concurrency performance of the application is adjusted, a configuration file or a database needs to be modified and the application needs to be restarted, the cost is high, the timeliness is poor, and meanwhile, the service interruption is caused are solved.
Optionally, the configuration center includes at least one pre-established configuration set, and each configuration set has identification information respectively corresponding to different applications;
the thread pool initializing module 310 may be specifically configured to:
when the target application is started, establishing network connection with the configuration center;
and searching a configuration set matched with the target application from the configuration center according to the identification information to obtain the target configuration set.
Optionally, the parameter checking module 320 may be specifically configured to:
sending an update query request aiming at the target configuration set to the configuration center according to a preset mode;
confirming that an update condition is monitored when an update notification of the configuration center for the update inquiry request is received;
and acquiring updated thread pool parameters in response to the update notification.
Optionally, the parameter checking module 320 includes:
a parameter format checking unit, configured to check a format of the updated thread pool parameter according to a thread pool parameter standard format;
and the parameter rationality checking unit is used for checking the rationality of the updated thread pool parameters of different types.
Optionally, the updated thread pool parameters include an updated core thread number, an updated maximum thread number, and an updated blocking queue length.
Optionally, the parameter rationality checking unit may be specifically configured to:
judging whether the thread pool parameters of different types are respectively in corresponding preset intervals;
if yes, judging whether the updated core thread number is smaller than the updated maximum thread number and whether the updated blocking queue length is larger than the number of tasks to be executed;
otherwise, the parameters of the local thread pool of the target application are not refreshed according to the updated thread pool parameters.
Optionally, the parameter refreshing apparatus further includes a check pass determining module, configured to, after determining whether the updated core thread number is smaller than the updated maximum thread number and whether the updated blocking queue length is greater than the number of tasks to be executed:
if yes, determining that the updated thread pool parameters pass verification; otherwise, determining that the updated thread pool parameter check does not pass and not refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters.
The parameter refreshing device provided by the embodiment of the invention can execute the parameter refreshing method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
FIG. 4 shows a schematic block diagram of an electronic device 400 that may be used to implement embodiments of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 4, the electronic device 400 includes at least one processor 401, and a memory communicatively connected to the at least one processor 401, such as a Read Only Memory (ROM) 402, a Random Access Memory (RAM) 403, and the like, wherein the memory stores computer programs executable by the at least one processor, and the processor 401 may perform various suitable actions and processes according to the computer programs stored in the Read Only Memory (ROM) 402 or the computer programs loaded from a storage unit 408 into the Random Access Memory (RAM) 403. In the RAM 403, various programs and data required for the operation of the electronic device 400 can also be stored. The processor 401, ROM 402 and RAM 403 are connected to each other by a bus 404. An input/output (I/O) interface 405 is also connected to bus 404.
A number of components in the electronic device 400 are connected to the I/O interface 405, including: an input unit 406 such as a keyboard, a mouse, or the like; an output unit 407 such as various types of displays, speakers, and the like; a storage unit 408 such as a magnetic disk, optical disk, or the like; and a communication unit 409 such as a network card, modem, wireless communication transceiver, etc. The communication unit 409 allows the electronic device 400 to exchange information/data with other devices via a computer network, such as the internet, and/or various telecommunication networks.
In some embodiments, the parameter refresh method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 408. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 400 via the ROM 402 and/or the communication unit 409. When the computer program is loaded into RAM 403 and executed by processor 401, one or more steps of the parameter refresh method described above may be performed. Alternatively, in other embodiments, the processor 401 may be configured to perform the parameter refresh method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
A computer program for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on a machine, as a stand-alone software package partly on a machine and partly on a remote machine or entirely on a remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (10)
1. A parameter refresh method, comprising:
determining a target configuration set from a configuration center when a target application is started, and initializing a local thread pool of the target application according to thread pool parameters in the target configuration set;
monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when monitoring that the target configuration set is updated, and verifying the format and the reasonability of the updated thread pool parameters;
and when the verification is passed, refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters.
2. The method according to claim 1, wherein the configuration center comprises at least one pre-established configuration set, each configuration set having identification information respectively corresponding to different applications;
determining a target configuration set from a configuration center upon startup of a target application, comprising:
when the target application is started, establishing network connection with the configuration center;
and searching a configuration set matched with the target application from the configuration center according to the identification information to obtain the target configuration set.
3. The method of claim 1, wherein monitoring the update status of the target configuration set in real time, and obtaining updated thread pool parameters when it is monitored that the target configuration set is updated comprises:
sending an update query request aiming at the target configuration set to the configuration center according to a preset mode;
confirming that an update condition is monitored when an update notification of the configuration center for the update inquiry request is received;
and obtaining updated thread pool parameters in response to the update notification.
4. The method of claim 1, wherein checking the format and reasonableness of the updated thread pool parameters comprises:
checking the format of the updated thread pool parameters according to the thread pool parameter standard format;
and checking the rationality of the updated thread pool parameters of different classes.
5. The method of claim 4, wherein the updated thread pool parameters comprise an updated core thread count, an updated maximum thread count, and an updated blocking queue length.
6. The method of claim 5, wherein checking the validity of the updated thread pool parameters of different classes comprises:
judging whether the thread pool parameters of different types are respectively in corresponding preset intervals or not;
if yes, judging whether the updated core thread number is smaller than the updated maximum thread number and whether the updated blocking queue length is larger than the number of tasks to be executed;
otherwise, the parameters of the local thread pool of the target application are not refreshed according to the updated thread pool parameters.
7. The method of claim 6, wherein after determining whether the updated number of core threads is less than the updated maximum number of threads and whether the updated blocking queue length is greater than the number of tasks to be executed, further comprising:
if yes, determining that the updated thread pool parameters pass verification; otherwise, determining that the updated thread pool parameter check does not pass and not refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters.
8. A parameter refresh apparatus, comprising:
the thread pool initialization module is used for determining a target configuration set from a configuration center when a target application is started, and initializing a local thread pool of the target application according to thread pool parameters in the target configuration set;
the parameter checking module is used for monitoring the updating state of the target configuration set in real time, acquiring updated thread pool parameters when the target configuration set is monitored to be updated, and checking the format and the reasonability of the updated thread pool parameters;
and the parameter refreshing module is used for refreshing the parameters of the local thread pool of the target application according to the updated thread pool parameters when the verification is passed.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform the parameter refresh method of any of claims 1-7.
10. A computer-readable storage medium storing computer instructions for causing a processor to implement the parameter refresh method of any one of claims 1-7 when executed.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211352002.8A CN115904701A (en) | 2022-10-31 | 2022-10-31 | Parameter refreshing method, device, equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202211352002.8A CN115904701A (en) | 2022-10-31 | 2022-10-31 | Parameter refreshing method, device, equipment and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN115904701A true CN115904701A (en) | 2023-04-04 |
Family
ID=86476982
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202211352002.8A Pending CN115904701A (en) | 2022-10-31 | 2022-10-31 | Parameter refreshing method, device, equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN115904701A (en) |
-
2022
- 2022-10-31 CN CN202211352002.8A patent/CN115904701A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN115964153A (en) | Asynchronous task processing method, device, equipment and storage medium | |
CN113590329A (en) | Resource processing method and device | |
CN115544044A (en) | Data consistency keeping method, device, equipment and storage medium | |
CN115495473A (en) | Database query method and device, electronic equipment and storage medium | |
CN112948081B (en) | Method, device, equipment and storage medium for processing tasks in delayed mode | |
CN117725115A (en) | Database sequence processing method, device, equipment and storage medium | |
CN113656239A (en) | Monitoring method and device for middleware and computer program product | |
CN116319758A (en) | Data migration method, device, electronic equipment and readable storage medium | |
CN115904701A (en) | Parameter refreshing method, device, equipment and storage medium | |
CN115390992A (en) | Virtual machine creating method, device, equipment and storage medium | |
CN117520362B (en) | Data management system, method, equipment and storage medium based on distributed lock | |
CN114281478B (en) | Container operation method and device, electronic equipment and computer storage medium | |
CN115756855A (en) | Cluster switching method, device, terminal and storage medium | |
CN114584605B (en) | Service distribution method and device, electronic equipment and storage medium | |
CN116594764A (en) | Application program updating method and device, electronic equipment and storage medium | |
CN115687244A (en) | File processing monitoring method, device, equipment and medium | |
CN115665245A (en) | Local cache refreshing method and device, electronic equipment and storage medium | |
CN117743467A (en) | Agent node replacement method, device, equipment and storage medium | |
CN114428665A (en) | Data processing method, device, equipment and storage medium | |
CN118377677A (en) | Multi-server process monitoring method and device, electronic equipment and storage medium | |
CN117314440A (en) | Data processing method and device, electronic equipment and storage medium | |
CN117785403A (en) | Heartbeat task execution device for equipment, electronic equipment and storage medium | |
CN114356505A (en) | Method, apparatus, device, medium and product for scheduling groups of containers | |
CN116821175A (en) | Data query and index service creation method and device and electronic equipment | |
CN114896030A (en) | Determination method, device, equipment and storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |