CN116149790A - Method for starting multiple Springboot items based on JVM process reduction - Google Patents

Method for starting multiple Springboot items based on JVM process reduction Download PDF

Info

Publication number
CN116149790A
CN116149790A CN202310114651.2A CN202310114651A CN116149790A CN 116149790 A CN116149790 A CN 116149790A CN 202310114651 A CN202310114651 A CN 202310114651A CN 116149790 A CN116149790 A CN 116149790A
Authority
CN
China
Prior art keywords
started
data
item
items
integration module
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.)
Granted
Application number
CN202310114651.2A
Other languages
Chinese (zh)
Other versions
CN116149790B (en
Inventor
谢雨航
王敏
庄恩贵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingan Yun Xin Technology Co ltd
Original Assignee
Beijing Jingan Yun Xin Technology Co ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by Beijing Jingan Yun Xin Technology Co ltd filed Critical Beijing Jingan Yun Xin Technology Co ltd
Priority to CN202310114651.2A priority Critical patent/CN116149790B/en
Publication of CN116149790A publication Critical patent/CN116149790A/en
Application granted granted Critical
Publication of CN116149790B publication Critical patent/CN116149790B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/455Emulation; Interpretation; Software simulation, e.g. virtualisation or emulation of application or operating system execution engines
    • G06F9/45533Hypervisors; Virtual machine monitors
    • G06F9/45558Hypervisor-specific management and integration aspects
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5077Logical partitioning of resources; Management or configuration of virtualized resources
    • YGENERAL 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
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Stored Programmes (AREA)

Abstract

The invention relates to the technical field of JAVA application and development, in particular to a method for starting a plurality of Springboot items based on a reduced JVM process, which comprises the following steps that a data evaluation module evaluates the data quantity required to be mobilized of each Springboot item to be started; the data tracing module counts public resource packages related to data to be mobilized of each Springboot item to be started; the data integration module groups Springboot to be started according to the information acquired by the data evaluation module and the data tracing module; the name generation module corrects the source codes of Springboot items in the same group; starting each Springboot item, and starting the Springboot items in the same group by adopting the same jvm process. According to the invention, by modifying the Springboot source code, prefix isolation is realized between the Bean names of different Springboot items, the URL addresses exposed by Springmvc and configuration file configuration items, and finally, a plurality of Springboot items are isolated and run in a Spring container, so that the effect of running a plurality of Springboots by one JVM process is achieved.

Description

Method for starting multiple Springboot items based on JVM process reduction
Technical Field
The invention relates to the technical field of JAVA application and development, in particular to a method for starting a plurality of Springboot items based on a reduced JVM process.
Background
The Springboot framework is mainly applied to a micro-service architecture system. The micro-service architecture design has a good solution to the three-high problem. However, for items that are not highly concurrent and sensitive to hardware resources, there is a disadvantage. For example, in the integrated machine, a plurality of Springboot items need to be operated, and an existing scheme can start a jvm process for each Springboot item.
Chinese patent publication No. CN111104207A discloses a method for realizing dynamic configuration of timing tasks based on SpringBoot. The method comprises the following steps: 1. defining task classes and writing task methods to be executed; 2. defining a timer configuration class, and configuring a timer trigger, an attribute and a scheduling method; 3. defining a timer time configuration class, and setting how often to access a database; 4. the cron expression performed by the timer is obtained from the database and a decision is made as to whether to reset the timing task.
It can be seen that starting one jvm process per Springboot item and multiple jvm processes causes the memory consumption to increase.
Disclosure of Invention
Therefore, the invention provides a method for starting a plurality of Springboot items based on a reduced JVM process, which is used for solving the problem that memory consumption is increased due to the fact that each Springboot item starts a JVM process and a plurality of JVM processes in the prior art.
To achieve the above object, the present invention provides a method for starting a plurality of Springboot items based on a reduced JVM process, including,
step S1, a data evaluation module evaluates the data quantity required to be mobilized of each Springboot item to be started;
step S2, the data tracing module counts public resource packages related to data to be mobilized of each Springboot item to be started;
step S3, the data integration module groups the Springboot to be started according to the information acquired by the data evaluation module and the data tracing module; the data integration module analyzes public resource packages related to data to be mobilized of each Springboot item to be started, judges whether coexistence resource packages exist or not, and if the coexistence resource packages exist, the data integration module groups the Springboots to be started according to the quantity of the coexistence resource packages and the data quantity occupied by the coexistence resource packages;
s4, the name generation module corrects the source codes of Springboot items in the same group;
and S5, starting each Springboot item, wherein the Springboot items in the same group are started by adopting the same jvm process.
Further, the data evaluation module numbers each Springboot item to be started from small to large according to the data quantity to be mobilized, and marks the data quantity as a first item to be started S1, a second item to be started S2, an N-th item to be started Sn, and N as the total number of Springboot items to be started;
the data evaluation module evaluates and obtains the data quantity A01 to be mobilized of a first to-be-started item S1, the data quantity A02 to be mobilized of a second to-be-started item S2, and the data quantity A0N to be mobilized of an N to-be-started item Sn;
the data tracing module counts a public resource package set B1 related to the calling data of a first item S1 to be started, counts a public resource package set B2 related to the calling data of a second item S2 to be started, counts a public resource package set Bn1 related to the calling data of an item Sn to be started of an N1, wherein N1 is the number of items to be started, and N1 is a positive integer;
the data integration module numbers the public resource packet set, and records the public resource packet set as a first public resource packet b1, a second public resource packet b2, wherein the M first public resource packet bm, M is the number of public resource packets, and M is a positive integer;
the data integration module analyzes each public resource packet set to determine whether a coexistence resource packet exists, wherein the coexistence resource packet refers to that all public resource packet sets contain a certain public resource packet bj, j=1, 2.
Further, the data integration module is internally provided with a coexisting resource packet data amount evaluation parameter Ps, the data integration module counts the data amount PZ contained in the coexisting resource packet, the data integration module compares the data amount PZ with the coexisting resource packet data amount evaluation parameter Ps,
if Pz is more than or equal to Ps, the data integration module groups the starting items according to the data quantity of each item to be started;
if PZ is less than Ps, the data integration module groups the starting items according to the difference value of the data quantity PZ and the coexisting resource packet data quantity evaluation parameter Ps and the data quantity of each item to be started.
Further, if Pz is greater than or equal to Ps, the data integration module groups the startup items according to the data amount of each to-be-started item, where:
if it is
Figure SMS_1
> Ap1, and->
Figure SMS_2
Ap1 is not more than, and the data integration module judges that the first item to be started S1 to the i1 th item to be started Si1 are the first starting group; />
Figure SMS_3
> Ap1, and->
Figure SMS_4
Ap1 is not more than, the data integration module judges that the items Si1+1 to Si2 to be started from the (1+1) th item to the (2) th item to be started are the second starting group, and so on until #, #>
Figure SMS_5
Ap1, the data integration module determines +.>
Figure SMS_6
The items Si1 to Sn to be started are the kth starting group;
if it is
Figure SMS_7
And Ap1, the data integration module determines that all items to be started are a group,
wherein Ap1 is a packet data amount evaluation parameter set in the data integration module.
5. The method for starting a plurality of Springboot items based on a reduced JVM process as set forth in claim 4, wherein,
when Pz is smaller than Ps, the data integration module calculates a difference value PC between the data volume Pz and the coexistence resource packet data volume evaluation parameter Ps, sets pc=ps-Pz, adjusts the grouping data volume evaluation parameter Ap1 to Ap1', and groups the items to be started according to the grouping method of Pz is larger than or equal to Ps,
Ap1’=Ap1+PC×L,
wherein L is a calculation compensation parameter of the coexisting resource packet data volume and the packet data volume evaluation parameter.
Further, the larger the number of common resource packets in the coexistence resource packets, the smaller the value of the packet data amount evaluation parameter Ap 1.
7. The method for starting a plurality of Springboot items based on a reduced JVM process as set forth in claim 3, wherein,
if the coexisting resource package bj does not exist, the data integration module acquires the public resource package bk with the largest occurrence frequency in all items to be started, counts the number Kg of the items to be started containing the public resource package bk, and is provided with a pseudo coexisting resource package generation evaluation value Ka,
if Kg is more than or equal to Ka, the data integration module judges that the public resource package bk is a pseudo-coexisting resource package, the data integration module defines to-be-started items stored with the pseudo-coexisting resource package as a first to-be-started item set, defines to-be-started items without the pseudo-coexisting resource package as a second to-be-started item set, and groups the first to-be-started item set and the second to-be-started item set respectively;
if Kg is less than Ka, the data integration module judges that no pseudo-coexistence resource packet exists, and the data integration module directly groups all items to be started.
Further, if Kg is greater than or equal to Ka, the data integration module groups a first type of to-be-started item set, the first type of to-be-started item set includes N2 to-be-started items, the data integration module re-marks to the to-be-started items in the first type of to-be-started item set from small to large according to the data volume required to be mobilized, and marks the to-be-started items as a first to-be-started item D1, a second to-be-started item D2, an N2 to-be-started item Dn2, wherein the data volume required to be mobilized by the first to-be-started item D1 is A21, the data volume required to be mobilized by the second to-be-started item D2 is A22, the data volume required to be mobilized by the N2 to-be-started item N2 is A2N2, and a grouping data volume evaluation parameter Ap2 is arranged in the data integration module,
if it is
Figure SMS_8
> Ap2, and->
Figure SMS_9
Ap2 is not more than, and the data integration module judges that the first item D1 to the i1 item Di1 to be started are the first starting group; />
Figure SMS_10
> Ap2, and->
Figure SMS_11
Ap2 is not more than, the data integration module judges that items Di1+1 to Di2 to be started from the (1+1) th item to Di1+1 to the (2) th item to be started are a second starting group, and so on until
Figure SMS_12
Ap2, the data integration module determines +.>
Figure SMS_13
The items Di1 to Dn2 to be started are the kth starting group;
if it is
Figure SMS_14
The data integration module judges that a first class of items to be started are collected to form a first starting group;
the data integration module is used for re-labeling the items to be started in the second type item set to be started from small to large according to the data quantity required to be mobilized, the items to be started are recorded as N2+1th item Dn2+1 to be started, N2+2th item Dn2+2 to be started, the Nth item Dn to be started, wherein the data quantity required to be mobilized by the N2+1th item Dn2+1 to be started is A2n2+1, the data quantity required to be mobilized by the N2+2th item Dn2+2 to be started is A2n, the data integration module is internally provided with a grouping data quantity evaluation parameter Ap3, and the data integration module groups the second type item set to be started in the same grouping mode as the first type item set to be started.
Further, the data integration module directly groups all items to be started without pseudo-coexistence resource packet, a grouping data quantity evaluation parameter Ap3 is arranged in the data integration module,
if it is
Figure SMS_15
> Ap3, and->
Figure SMS_16
Ap3 is not more than, and the data integration module judges that the first item to be started S1 to the i1 th item to be started Si1 are the first starting group; />
Figure SMS_17
> Ap3, and->
Figure SMS_18
Ap3 is not more than, the data integration module judges that the (i 1+1) th item to be started (Si 1+1) to the (i 2) th item to be started (Si 2) are the second starting group, and so on until
Figure SMS_19
Ap3, the data integration module determines +.>
Figure SMS_20
The items to be started Si1 to N are the kth start-up group.
Further, the step S4 includes:
s41, a custom Bean name generator is adopted to realize a Bean NameGenerator interface, a geneeBeanName method is rewritten, the Bean name prefix is obtained according to the class name, and the Bean name logic is generated.
S42, a custom ConfigurationClassBeanDefinancinRefer rewrites a ConfigurationClassBeanDefinancinRefer# loadBeanDefinancinsForBeanmethod method to realize @ Bean annotation, obtain a Bean name prefix according to a class name, and generate logic of the Bean name;
s43, the custom mapping processor custom Handlermapping is enabled to inherit the RequestMappingHandlermapping, and the getMappingForMethod method is rewritten to achieve the purposes of acquiring url prefixes according to package names and replacing original url logic.
S44, the post processor of the custom Be UtautolowiredAnnonandPostProcessor rewrites the AutowiredatannotypastProcessor' S PostProperties method, and the current class name is stored in the thread context before metadata #inject is executed, so that the subsequent processing @ Value attribute injection obtains class name information.
Compared with the prior art, the method has the beneficial effects that by modifying the Springboot source code, the prefix isolation is realized by the Bean names of different Springboot items, the URL addresses exposed by Springmvc and the configuration items of the configuration file, and finally, a plurality of Springboot items are isolated and run in one Spring container. The effect of running a plurality of Springboot with one JVM process is achieved.
Further, before the Springboot source code is modified, the Springboot to be started is grouped, grouping details are determined through the coexistence resource package, the reduction of the data scheduling repeatability in the same group is ensured, and the energy consumption of a CPU (Central processing Unit) in multi-process switching is reduced.
Further, for a group, by setting the group data quantity evaluation parameter, the balance range of each group of mobilized data and processed data is ensured, on one hand, the number of jvm processes is reduced, on the other hand, the running fluency of a single jvm process is ensured, and the running jvm process is prevented from being too large and causing system blocking.
Further, when the data volume of the coexisting resource packet is smaller, the number of the packet data volume evaluation parameter is increased, and the number of groups is further reduced, so that the number of jvm processes is reduced, and the resource loss during the system operation is reduced.
Further, when the data of a plurality of public resource packages are mobilized, the system operation duty ratio is increased, so that the packet data quantity evaluation parameter value is smaller when the number of the public resource packages is larger, the operation smoothness of a single jvm process is ensured, and the system jam caused by the overlarge jvm process is prevented.
Further, under the condition that no coexisting resource packet exists, the public resource packet with the largest frequency in all items to be started is selected for judgment, the pseudo coexisting resource packet is determined, and the starting items are classified, so that the number of jvm processes is reduced, and the loss of resources in the system operation is reduced.
Drawings
Fig. 1 is a flowchart of a method for starting a plurality of Springboot items based on a reduced JVM process in an embodiment.
Detailed Description
In order that the objects and advantages of the invention will become more apparent, the invention will be further described with reference to the following examples; it should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the invention.
Preferred embodiments of the present invention are described below with reference to the accompanying drawings. It should be understood by those skilled in the art that these embodiments are merely for explaining the technical principles of the present invention, and are not intended to limit the scope of the present invention.
It should be noted that, in the description of the present invention, terms such as "upper," "lower," "left," "right," "inner," "outer," and the like indicate directions or positional relationships based on the directions or positional relationships shown in the drawings, which are merely for convenience of description, and do not indicate or imply that the apparatus or elements must have a specific orientation, be constructed and operated in a specific orientation, and thus should not be construed as limiting the present invention.
Furthermore, it should be noted that, in the description of the present invention, unless explicitly specified and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be either fixedly connected, detachably connected, or integrally connected, for example; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention can be understood by those skilled in the art according to the specific circumstances.
Referring to fig. 1, fig. 1 is a flowchart of a method for starting up a plurality of Springboot items based on a reduced JVM process in an embodiment.
The invention provides a method for starting a plurality of Springboot items based on a reduced JVM process, which comprises the following steps of,
step S1, a data evaluation module evaluates the data quantity required to be mobilized of each Springboot item to be started;
step S2, the data tracing module counts public resource packages related to data to be mobilized of each Springboot item to be started;
step S3, the data integration module groups the Springboot to be started according to the information acquired by the data evaluation module and the data tracing module;
s4, the name generation module corrects the source codes of Springboot items in the same group;
and S5, starting each Springboot item, wherein the Springboot items in the same group are started by adopting the same jvm process.
According to the invention, by modifying the Springboot source code, prefix isolation is realized by the Bean names of different Springboot items, the URL addresses exposed by Springmvc and the configuration items of the configuration file, and finally, a plurality of Springboot items are isolated and run in a Spring container. The effect of running a plurality of Springboot with one JVM process is achieved.
Further, the data evaluation module numbers each Springboot item to be started from small to large according to the data quantity to be mobilized, and marks the data quantity as a first item to be started S1, a second item to be started S2, an N-th item to be started Sn, and N as the total number of Springboot items to be started;
the data evaluation module evaluates and obtains the data quantity A01 to be mobilized of a first to-be-started item S1, the data quantity A02 to be mobilized of a second to-be-started item S2, and the data quantity A0N to be mobilized of an N to-be-started item Sn;
the data tracing module counts a public resource package set B1 related to the calling data of a first item S1 to be started, counts a public resource package set B2 related to the calling data of a second item S2 to be started, counts a public resource package set Bn1 related to the calling data of an item Sn to be started of an N1, wherein N1 is the number of items to be started, and N1 is a positive integer;
the data integration module numbers the public resource packet set, and records the public resource packet set as a first public resource packet b1, a second public resource packet b2, wherein the M first public resource packet bm, M is the number of public resource packets, and M is a positive integer;
the data integration module analyzes each public resource packet set to determine whether a coexistence resource packet exists, wherein the coexistence resource packet refers to that all public resource packet sets contain a certain public resource packet bj, j=1, 2, & m;
if the coexistence resource packet exists, the data integration module groups the Springboot to be started according to the quantity of the coexistence resource packet and the data quantity occupied by the coexistence resource packet.
Further, the data integration module is internally provided with a coexisting resource packet data amount evaluation parameter Ps, the data integration module counts the data amount PZ contained in the coexisting resource packet, the data integration module compares the data amount PZ with the coexisting resource packet data amount evaluation parameter Ps,
if Pz is more than or equal to Ps, the data integration module groups the starting items according to the data quantity of each item to be started;
if PZ is less than Ps, the data integration module groups the starting items according to the difference value of the data quantity PZ and the coexisting resource packet data quantity evaluation parameter Ps and the data quantity of each item to be started.
Before the Springboot source codes are modified, the Springboot to be started is grouped, grouping details are determined through the coexistence resource package, the reduction of the data scheduling repeatability in the same group is guaranteed, and the energy consumption of a CPU (Central processing Unit) in multi-process switching is reduced.
Further, the data integration module is internally provided with a grouping data quantity evaluation parameter Ap1, when Pz is more than or equal to Ps,
if it is
Figure SMS_21
> Ap1, and->
Figure SMS_22
Ap1 is not more than, the data integration module judges that the first item S1 to the i1 item Si1 to be started are the first starting group, and the +.>
Figure SMS_23
> Ap1, and->
Figure SMS_24
Ap1 is not more than, the data integration module judges that the items Si1+1 to Si2 to be started from the (1+1) th item to the (2) th item to be started are the second starting group, and so on until #, #>
Figure SMS_25
Ap1, the data integration module determines +.>
Figure SMS_26
The items Si1 to Sn to be started are the kth starting group;
if it is
Figure SMS_27
And (3) less than Ap1, and judging that all items to be started are one group by the data integration module.
For a group, by setting the evaluation parameters of the packet data quantity, the balance range of each group of mobilized data and processed data is ensured, on one hand, the number of jvm processes is reduced, on the other hand, the running fluency of a single jvm process is ensured, and the system blocking caused by the overlarge running jvm process is prevented.
Further, when Pz < Ps, the data integration module calculates PC, pc=ps-Pz, the data integration module adjusts the packet data amount evaluation parameter Ap1 to Ap1', ap1' =ap1+pc×l, and L is a calculation compensation parameter of the coexisting resource packet data amount and the packet data amount evaluation parameter; and the data integration module adjusting Ap1 to Ap1' groups the items to be started according to a grouping method that Pz is more than or equal to Ps.
When the data quantity of the coexisting resource packet is smaller, the value of the evaluation parameter of the packet data quantity is increased, and the number of groups is further reduced, so that the number of jvm processes is reduced, and the loss of resources in the system operation is reduced.
Further, the packet data amount evaluation parameter Ap1 is related to the number of common resource packets included in the coexistence resource packet, and the larger the number of common resource packets in the coexistence resource packet is, the smaller the value of the packet data amount evaluation parameter Ap1 is.
When the data of a plurality of public resource packages are mobilized, the system operation duty ratio is increased, so that the larger the number of the public resource packages is, the smaller the packet data quantity evaluation parameter value is, the smoothness of operation of a single jvm process is ensured, and the occurrence of system blocking caused by overlarge jvm processes is prevented.
Further, if there is no coexisting resource package bj, the data integration module obtains the public resource package bk with the largest occurrence frequency in all the items to be started, counts the number Kg of the items to be started containing the public resource package bk, sets a pseudo coexisting resource package generation evaluation value Ka in the data integration module,
if Kg is more than or equal to Ka, the data integration module judges that the public resource package bk is a pseudo-coexisting resource package, the data integration module defines to-be-started items stored with the pseudo-coexisting resource package as a first to-be-started item set, defines to-be-started items without the pseudo-coexisting resource package as a second to-be-started item set, and groups the first to-be-started item set and the second to-be-started item set respectively;
if Kg is less than Ka, the data integration module judges that no pseudo-coexistence resource packet exists, and the data integration module directly groups all items to be started.
And for the condition that the coexisting resource packet does not exist, selecting the public resource packet with the largest frequency in all the items to be started to judge, determining the pseudo coexisting resource packet, and classifying the starting items, thereby reducing the number of jvm processes and reducing the loss of resources during the system operation.
Further, if Kg is greater than or equal to Ka, the data integration module groups a first type of to-be-started item set, the first type of to-be-started item set includes N2 to-be-started items, the data integration module re-marks to the to-be-started items in the first type of to-be-started item set from small to large according to the data volume required to be mobilized, and marks the to-be-started items as a first to-be-started item D1, a second to-be-started item D2, an N2 to-be-started item Dn2, wherein the data volume required to be mobilized by the first to-be-started item D1 is A21, the data volume required to be mobilized by the second to-be-started item D2 is A22, the data volume required to be mobilized by the N2 to-be-started item N2 is A2N2, and a grouping data volume evaluation parameter Ap2 is arranged in the data integration module,
if it is
Figure SMS_28
> Ap2, and->
Figure SMS_29
Ap2 is not more than, and the data integration module judges that the first item D1 to i1 item Di1 to be started are the first starting group and the +.>
Figure SMS_30
> Ap2, and->
Figure SMS_31
Ap2 is not more than, the data integration module judges that items Di1+1 to Di2 to be started from the (1+1) th item to Di1+1 to the (2) th item to be started are a second starting group, and so on until the item is a part of the item (I) to (II)>
Figure SMS_32
Ap2, the data integration module determines +.>
Figure SMS_33
The items Di1 to Dn2 to be started are the kth starting group;
if it is
Figure SMS_34
The data integration module judges that a first class of items to be started are collected to form a first starting group;
the data integration module is used for re-labeling the items to be started in the second type item set to be started from small to large according to the data quantity required to be mobilized, the items to be started are recorded as N2+1th item Dn2+1 to be started, N2+2th item Dn2+2 to be started, the Nth item Dn to be started, wherein the data quantity required to be mobilized by the N2+1th item Dn2+1 to be started is A2n2+1, the data quantity required to be mobilized by the N2+2th item Dn2+2 to be started is A2n, the data integration module is internally provided with a grouping data quantity evaluation parameter Ap3, and the data integration module groups the second type item set to be started in the same grouping mode as the first type item set to be started.
Further, the data integration module directly groups all items to be started without pseudo-coexistence resource packet, a grouping data quantity evaluation parameter Ap3 is arranged in the data integration module,
if it is
Figure SMS_35
> Ap3, and->
Figure SMS_36
Ap3 is not more than, the data integration module judges that the first item S1 to the i1 item Si1 to be started are the first starting group, and the +.>
Figure SMS_37
> Ap3, and->
Figure SMS_38
Ap3 is not more than, the data integration module judges that the items Si1+1 to Si2 to be started from the (1+1) th item to the (2) th item to be started are the second starting group, and so on until #, #>
Figure SMS_39
Ap3, the data integration module determines +.>
Figure SMS_40
The items to be started Si1 to N are the kth start-up group.
Further, the step S4 includes:
s41, customizing a Bean name generator, namely a custom Bean name generator, enabling the custom Bean name generator to realize a Bean name interface, rewriting a generateBeanName method, obtaining a Bean name prefix according to class names, and generating logic of the Bean names.
S42, a custom ConfigurationClassBeanDefinancinRefer rewrites a ConfigurationClassBeanDefinancinRefer# loadBeanDefinancinsForBeanmethod method to realize @ Bean annotation, obtain a Bean name prefix according to a class name, and generate logic of the Bean name;
s43, a custom mapping processor custom Handlermapping is enabled to inherit the RequestMappingHandlermapping, and the getMappingForMethod method is rewritten to achieve the purposes of acquiring url prefixes according to package names and replacing original url logic.
S44, the post processor of the custom Be UtautolowiredAnnonandPostProcessor rewrites the AutowiredatannotypastProcessor's PostProperties method, and the current class name is stored in the thread context before metadata# project is executed so that the subsequent processing @ Value attribute injection obtains class name information.
S45, a custom customerConfigurationPropertyBinder post processor rewrites a bind method of the configurationPropertyBinder, and stores the current class name into the thread context before executing the getBunder#bind so as to acquire class name information when the subsequent @ ConfigurationProperties attribute binding object.
S46, customizing the custom PropertySource PropertyResolver to rewrite the getProperty method of the PropertySource Resolver class. Class name information is acquired in the thread context to realize that configuration item logic with prefix can be preferentially selected according to mapping of class names and configuration prefixes.
S47, a constructor method of the custom customer CommonAnnogionBeanPostProcessor post processor for rewriting CommonAnnogionBeanPostProcessor#ResourceElement. When the Bean injection is searched by using the resourceName, the injected Bean name is corrected, so that the Bean cannot be injected according to the Bean name is avoided.
S48, a custom customer cleaning automatic candidateResolver rewrites the cleaning method of the customer cleaning automatic candidateResolver, and when the cleaning is used for searching Bean injection, the injected Bean name is corrected, so that the Bean cannot be injected according to the Bean name is avoided.
S49, a constructor method and a postProcesssApplationContext method for custom customer Springs application to rewrite Springs application. The super. Setband name generator (custom Bean name generator) is executed in the constructor method, letting the custom Bean name generator replace the default Bean name generator. A plurality of BeanDefinitionRegistryPostProcessor post-processors are added to the Spring container in the PostProcesssApplationContext method. And the processor is utilized to replace Spring original class with custom class, including ConfigurationClassBeanDefinitionRead, requestMappingHandlerMapping, autowiredAnnotationBeanPostProcessor, configurationPropertiesBinder, propertySourcesPropertyResolver, commonAnnotationBeanPostProcessor, customerQualifierAnnotationAutowireCandidateResolver, etc.
And introducing jar packets of a plurality of Springboot items, and setting a class path under the scanning path of Springs. And the original Springapplication is replaced by the CustomerSpringapplication as the starting class of Springboot. The same JVM process can run a plurality of Springboot effects.
Thus far, the technical solution of the present invention has been described in connection with the preferred embodiments shown in the drawings, but it is easily understood by those skilled in the art that the scope of protection of the present invention is not limited to these specific embodiments. Equivalent modifications and substitutions for related technical features may be made by those skilled in the art without departing from the principles of the present invention, and such modifications and substitutions will be within the scope of the present invention.

Claims (10)

1. A method for starting a plurality of Springboot items based on a reduced JVM process, comprising,
step S1, a data evaluation module evaluates the data quantity required to be mobilized of each Springboot item to be started;
step S2, the data tracing module counts public resource packages related to data to be mobilized of each Springboot item to be started;
step S3, the data integration module groups the Springboot to be started according to the information acquired by the data evaluation module and the data tracing module; the data integration module analyzes public resource packages related to data to be mobilized of each Springboot item to be started, judges whether coexistence resource packages exist or not, and if the coexistence resource packages exist, the data integration module groups the Springboots to be started according to the quantity of the coexistence resource packages and the data quantity occupied by the coexistence resource packages;
s4, the name generation module corrects the source codes of Springboot items in the same group;
and S5, starting each Springboot item, wherein the Springboot items in the same group are started by adopting the same jvm process.
2. The method for starting a plurality of Springboot items based on a reduced JVM process as set forth in claim 1, wherein,
the data evaluation module numbers each Springboot item to be started according to the data quantity which is required to be mobilized from small to large, and marks the data quantity as a first item S1 to be started, a second item S2 to be started, an N-th item Sn to be started, and N as the total number of the Springboot items to be started;
the data evaluation module evaluates and obtains the data quantity A01 to be mobilized of a first to-be-started item S1, the data quantity A02 to be mobilized of a second to-be-started item S2, and the data quantity A0N to be mobilized of an N to-be-started item Sn;
the data tracing module counts a public resource package set B1 related to the calling data of a first item S1 to be started, counts a public resource package set B2 related to the calling data of a second item S2 to be started, counts a public resource package set Bn1 related to the calling data of an item Sn to be started of an N1, wherein N1 is the number of items to be started, and N1 is a positive integer;
the data integration module numbers the public resource packet set, and records the public resource packet set as a first public resource packet b1, a second public resource packet b2, wherein the M first public resource packet bm, M is the number of public resource packets, and M is a positive integer;
the data integration module analyzes each public resource packet set to determine whether a coexistence resource packet exists, wherein the coexistence resource packet refers to that all public resource packet sets contain a certain public resource packet bj, j=1, 2.
3. The method for starting a plurality of Springboot items based on a reduced JVM process as set forth in claim 2, wherein,
the data integration module is internally provided with a coexisting resource packet data volume evaluation parameter Ps, the data integration module counts the data volume PZ contained in the coexisting resource packet, the data integration module compares the data volume PZ with the coexisting resource packet data volume evaluation parameter Ps,
if Pz is more than or equal to Ps, the data integration module groups the starting items according to the data quantity of each item to be started;
if PZ is less than Ps, the data integration module groups the starting items according to the difference value of the data quantity PZ and the coexisting resource packet data quantity evaluation parameter Ps and the data quantity of each item to be started.
4. The method for starting a plurality of Springboot items based on a reduced JVM process according to claim 3, wherein if Pz is greater than or equal to Ps, the process of grouping the starting items by the data integration module according to the data amount of each item to be started is:
if it is
Figure QLYQS_1
> Ap1, and->
Figure QLYQS_2
Ap1 is not more than, and the data integration module judges that the first item to be started S1 to the i1 th item to be started Si1 are the first starting group; />
Figure QLYQS_3
> Ap1, and->
Figure QLYQS_4
Ap1 is not more than, the data integration module judges that items Si1+1 to Si2 to be started from the (1+1) th item to the (2) th item to be started are a second starting group, and so on until,
Figure QLYQS_5
≤Ap1,the data integration module determines +.>
Figure QLYQS_6
The items Si1 to Sn to be started are the kth starting group;
if it is
Figure QLYQS_7
And Ap1, the data integration module determines that all items to be started are a group,
wherein Ap1 is a packet data amount evaluation parameter set in the data integration module.
5. The method for starting a plurality of Springboot items based on a reduced JVM process as set forth in claim 4, wherein,
when Pz is smaller than Ps, the data integration module calculates a difference value PC between the data volume Pz and the coexistence resource packet data volume evaluation parameter Ps, sets pc=ps-Pz, adjusts the grouping data volume evaluation parameter Ap1 to Ap1', and groups the items to be started according to the grouping method of Pz is larger than or equal to Ps,
Ap1’=Ap1+PC×L,
wherein L is a calculation compensation parameter of the coexisting resource packet data volume and the packet data volume evaluation parameter.
6. The method for starting up multiple Springboot items based on the reduced JVM process as recited in claim 3, wherein the more common resource packets in the coexistence resource packet, the smaller the value of the packet data amount evaluation parameter Ap 1.
7. The method for starting a plurality of Springboot items based on a reduced JVM process as set forth in claim 3, wherein,
if the coexisting resource package bj does not exist, the data integration module acquires the public resource package bk with the largest occurrence frequency in all items to be started, counts the number Kg of the items to be started containing the public resource package bk, and is provided with a pseudo coexisting resource package generation evaluation value Ka,
if Kg is more than or equal to Ka, the data integration module judges that the public resource package bk is a pseudo-coexisting resource package, the data integration module defines to-be-started items stored with the pseudo-coexisting resource package as a first to-be-started item set, defines to-be-started items without the pseudo-coexisting resource package as a second to-be-started item set, and groups the first to-be-started item set and the second to-be-started item set respectively;
if Kg is less than Ka, the data integration module judges that no pseudo-coexistence resource packet exists, and the data integration module directly groups all items to be started.
8. The method for starting up multiple Springboot items based on the JVM process according to claim 7, wherein if Kg is greater than or equal to Ka, the data integration module groups a first type of to-be-started item set, the first type of to-be-started item set includes N2 to-be-started items, the data integration module re-marks the to-be-started items in the first type of to-be-started item set from small to large according to the data amount to be mobilized, and records the to-be-started items as a first to-be-started item D1, a second to-be-started item D2, an nth 2 to-be-started item Dn2, wherein the data amount to be mobilized by the first to-be-started item D1 is a21, the data amount to be mobilized by the second to-be-started item D2 is A2N2, the data integration module is internally provided with a grouping data amount evaluation parameter Ap2,
if it is
Figure QLYQS_8
> Ap2, and->
Figure QLYQS_9
Ap2 is not more than, and the data integration module judges that the first item D1 to the i1 item Di1 to be started are the first starting group; />
Figure QLYQS_10
> Ap2, and->
Figure QLYQS_11
≤Ap2,The data integration module judges that items Di1+1 to Di2 to Di1 and Di2 to be started are the second starting group, and so on until
Figure QLYQS_12
Ap2, the data integration module determines +.>
Figure QLYQS_13
The items Di1 to Dn2 to be started are the kth starting group;
if it is
Figure QLYQS_14
The data integration module judges that a first class of items to be started are collected to form a first starting group;
the data integration module is used for re-labeling the items to be started in the second type item set to be started from small to large according to the data quantity required to be mobilized, the items to be started are recorded as N2+1th item Dn2+1 to be started, N2+2th item Dn2+2 to be started, the Nth item Dn to be started, wherein the data quantity required to be mobilized by the N2+1th item Dn2+1 to be started is A2n2+1, the data quantity required to be mobilized by the N2+2th item Dn2+2 to be started is A2n, the data integration module is internally provided with a grouping data quantity evaluation parameter Ap3, and the data integration module groups the second type item set to be started in the same grouping mode as the first type item set to be started.
9. The method for reducing JVM process start-up of plural Springboot items as set forth in claim 7, wherein the data integration module directly groups all items to be started up for which no pseudo-coexistence resource packet exists, wherein a packet data amount evaluation parameter Ap3 is provided in the data integration module,
if it is
Figure QLYQS_15
> Ap3, and->
Figure QLYQS_16
Ap3, the data integrationThe module judges that the first item S1 to the i1 item Si1 to be started are a first starting group; />
Figure QLYQS_17
> Ap3, and->
Figure QLYQS_18
Ap3 is not more than, the data integration module judges that the (i 1+1) th item to be started (Si 1+1) to the (i 2) th item to be started (Si 2) are the second starting group, and so on until
Figure QLYQS_19
Ap3, the data integration module determines +.>
Figure QLYQS_20
The items to be started Si1 to N are the kth start-up group.
10. The method for starting a plurality of Springboot items based on the reduced JVM process as recited in claim 1, wherein the step S4 comprises:
s41, a custom Bean name generator is adopted to realize a Bean NameGenerator interface, a geneeBeanName method is rewritten, the Bean name prefix is obtained according to the class name, and the Bean name logic is generated.
S42, a custom ConfigurationClassBeanDefinancinRefer rewrites a ConfigurationClassBeanDefinancinRefer# loadBeanDefinancinsForBeanmethod method to realize @ Bean annotation, obtain a Bean name prefix according to a class name, and generate logic of the Bean name;
s43, the custom mapping processor custom Handlermapping is enabled to inherit the RequestMappingHandlermapping, and the getMappingForMethod method is rewritten to achieve the purposes of acquiring url prefixes according to package names and replacing original url logic.
S44, the post processor of the custom Be UtautolowiredAnnonandPostProcessor rewrites the AutowiredatannotypastProcessor' S PostProperties method, and the current class name is stored in the thread context before metadata #inject is executed, so that the subsequent processing @ Value attribute injection obtains class name information.
CN202310114651.2A 2023-02-15 2023-02-15 Method for starting multiple Springboot items based on JVM process reduction Active CN116149790B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310114651.2A CN116149790B (en) 2023-02-15 2023-02-15 Method for starting multiple Springboot items based on JVM process reduction

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310114651.2A CN116149790B (en) 2023-02-15 2023-02-15 Method for starting multiple Springboot items based on JVM process reduction

Publications (2)

Publication Number Publication Date
CN116149790A true CN116149790A (en) 2023-05-23
CN116149790B CN116149790B (en) 2023-11-21

Family

ID=86338645

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310114651.2A Active CN116149790B (en) 2023-02-15 2023-02-15 Method for starting multiple Springboot items based on JVM process reduction

Country Status (1)

Country Link
CN (1) CN116149790B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104573496A (en) * 2014-12-31 2015-04-29 北京奇虎科技有限公司 Method and device for inhibiting starting items from starting
CN107403306A (en) * 2017-07-31 2017-11-28 广西科技大学 A kind of colleges and universities' society management system based on SpringBoot
US20180365036A1 (en) * 2017-06-19 2018-12-20 Salesforce.Com, Inc. Application warmup engine
CN110069905A (en) * 2019-04-26 2019-07-30 深圳智慧园区信息技术有限公司 A kind of device and method of Springboot program encryption and decryption
CN113419741A (en) * 2021-07-16 2021-09-21 南威软件股份有限公司 Online interface code generation method based on Springboot
CN114185623A (en) * 2021-12-20 2022-03-15 中国工商银行股份有限公司 Method and device for processing deadlock in application starting process
WO2022099832A1 (en) * 2020-11-10 2022-05-19 北京中电普华信息技术有限公司 Cloud environment-based sql monitoring method and apparatus
CN114879942A (en) * 2022-05-20 2022-08-09 北京宇信科技集团股份有限公司 Distributed time wheel packet registration verification method, device, medium and equipment
CN115061978A (en) * 2022-06-15 2022-09-16 内蒙古农业大学 Construction method of hadoop parameter optimization model
CN115543546A (en) * 2022-11-25 2022-12-30 金现代信息产业股份有限公司 Spring-based module heat deployment method and system

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104573496A (en) * 2014-12-31 2015-04-29 北京奇虎科技有限公司 Method and device for inhibiting starting items from starting
US20180365036A1 (en) * 2017-06-19 2018-12-20 Salesforce.Com, Inc. Application warmup engine
CN107403306A (en) * 2017-07-31 2017-11-28 广西科技大学 A kind of colleges and universities' society management system based on SpringBoot
CN110069905A (en) * 2019-04-26 2019-07-30 深圳智慧园区信息技术有限公司 A kind of device and method of Springboot program encryption and decryption
WO2022099832A1 (en) * 2020-11-10 2022-05-19 北京中电普华信息技术有限公司 Cloud environment-based sql monitoring method and apparatus
CN113419741A (en) * 2021-07-16 2021-09-21 南威软件股份有限公司 Online interface code generation method based on Springboot
CN114185623A (en) * 2021-12-20 2022-03-15 中国工商银行股份有限公司 Method and device for processing deadlock in application starting process
CN114879942A (en) * 2022-05-20 2022-08-09 北京宇信科技集团股份有限公司 Distributed time wheel packet registration verification method, device, medium and equipment
CN115061978A (en) * 2022-06-15 2022-09-16 内蒙古农业大学 Construction method of hadoop parameter optimization model
CN115543546A (en) * 2022-11-25 2022-12-30 金现代信息产业股份有限公司 Spring-based module heat deployment method and system

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
EMAD HEYDARI BENI 等: "Reducing cold starts during elastic scaling of containers in kubernetes", 《SAC \'21: PROCEEDINGS OF THE 36TH ANNUAL ACM SYMPOSIUM ON APPLIED COMPUTING》, pages 60 - 68 *
一路向北NORTH: "springboot基础(15):多环境开发独立配置文件分组", pages 1 - 2, Retrieved from the Internet <URL:《https://blog.csdn.net/u011628753/article/details/125330524》> *
未城居士: "多个springboot运行在同一个JVM", pages 1 - 12, Retrieved from the Internet <URL:《https://www.jianshu.com/p/4d8f82cb0a08》> *
王萍: "SpringBoot项目中EhCache缓存技术的实现", 《电脑知识与技术》, no. 29, pages 79 - 81 *

Also Published As

Publication number Publication date
CN116149790B (en) 2023-11-21

Similar Documents

Publication Publication Date Title
CN107833060B (en) Verification method and system for intelligent contract transaction in block chain
US7257672B2 (en) Error protection for lookup operations performed on ternary content-addressable memory entries
US7966602B1 (en) Incremental modification detector, and methods, systems, and apparatus for implementing the same
US8640245B2 (en) Optimization of anti-malware processing by automated correction of detection rules
CN109614165B (en) Multi-version parallel operation method and device for COM (component object model) component
US20060230087A1 (en) System and method for adaptive garbage collection in a virtual machine environment
Benouaret et al. On the use of fuzzy dominance for computing service skyline based on qos
US20050216530A1 (en) Method and apparatus for updating a stored version of content stored in a storage device
US20040216096A1 (en) Partitioning of structured programs
CN1577263A (en) Multilanguage-supporting user interface realizing method and apparatus thereof
CN115129494B (en) Event log collection method and system based on Windows kernel
CN107301347A (en) A kind of method that Hbuilder App calling figures are obtained based on static analysis
CN108694320A (en) The method and system of sensitive application dynamic measurement under a kind of more security contexts
US20080065821A1 (en) Method and system for character string searching
CN116149790B (en) Method for starting multiple Springboot items based on JVM process reduction
CN111694811B (en) Batch data warehousing method and device
CN105468412A (en) Dynamic packaging method and dynamic packaging device
Epstein et al. A robust APTAS for the classical bin packing problem
CN114327495A (en) AST-based abnormal acquisition code injection method, device and application thereof
CN108153542A (en) Set-top box software code administration method and system
US20090216817A1 (en) System and method for utilizing generational file names for diagnostic data files
CN115407942B (en) Data processing method suitable for single chip microcomputer chip
CN102468978A (en) Service configuration method and device
CN115442091A (en) Instant messaging application behavior identification method and system based on network security
CN111026508B (en) JAVA intelligent card and virtual machine assembly optimization method thereof

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
GR01 Patent grant
GR01 Patent grant