CN116149790B - 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
CN116149790B
CN116149790B CN202310114651.2A CN202310114651A CN116149790B CN 116149790 B CN116149790 B CN 116149790B CN 202310114651 A CN202310114651 A CN 202310114651A CN 116149790 B CN116149790 B CN 116149790B
Authority
CN
China
Prior art keywords
started
item
data
items
springboot
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.)
Active
Application number
CN202310114651.2A
Other languages
Chinese (zh)
Other versions
CN116149790A (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

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 project 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 all-in-one machine, a plurality of Springboot items need to be run, and in the existing scheme, a JVM process is started 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 the current starting of one JVM process per Springboot item causes an increase in memory consumption for multiple JVM processes.
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 of memory consumption increase caused by starting one JVM process to a plurality of JVM processes by each Springboot item 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 Springboot items 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, groups the Springboot items to be started according to the number 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 isAnd->The data integration module judges that the first to-be-started items S1 to i1 to-be-started item Si1 are a first starting group; />And->The data integration module judges that the (1+1) th item to be started (Si 1+1) to the (2) th item to be started (Si 2) are the second starting group, and so on until>The data integration module judges that the (k-1) +1 th item Si (k-1) +1 to the N th item Sn to be started are the kth starting group;
if it isThe data integration module judges that all items to be started are a group,
wherein Ap1 is a packet data amount evaluation parameter set in the data integration module.
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.
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 isAnd->The data integration module determines that the first to-be-started items D1 to i1 are to be startedThe dynamic item Di1 is a first starting group; />And->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 untilThe data integration module judges that the items Di (k-1) +1 to be started and the items Dn2 to be started from the ith (k-1) +1 to the nth 2 are the kth starting group;
if it isThe data integration module judges that a first item set to be started is 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 isAnd->The data integration module judges that the first to-be-started items S1 to i1 to-be-started item Si1 are a first starting group; />And->The data integration module judges that the (1+1) th item to be started (Si 1+1) to the (2) th item to be started (Si 2) are the second starting group, and so on untilThe data integration module judges that the i (k-1) +1 th item Si (k-1) +1 to the N th item Sn to be started are the k-th starting group.
Further, the step S4 includes:
s41, a custom Bean name generator is adopted, a Bean NameGenerator interface is realized, a generateBeanName 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 source codes of the Springboot items, the prefix isolation is realized by the Bean names of the different Springboot items, the URL addresses exposed by Springmvc and the configuration items of the configuration files, and finally, a plurality of Springboot items are isolated and run in one Spring container. The effect of running a plurality of Springboot items by one JVM process is achieved.
Further, before the Springboot project source codes are modified, the Springboot projects to be started are grouped, grouping details are determined through the coexistence resource package, the reduction of data transfer repeatability in the same group is guaranteed, and the energy consumption of a CPU (Central processing Unit) in multi-process switching is reduced.
Further, for a group, by setting the packet 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 blocked by a system too large.
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 loss of resources in 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 more 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 system blocking caused by overlarge operation of the 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 Springboot items 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 source codes of the Springboot items, the URL addresses and configuration file configuration items exposed by Springmvc of different Springboot items are subjected to prefix isolation, and finally a plurality of Springboot items are isolated and run in a Spring container. The effect of running a plurality of Springboot items by 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 Springboot items 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 source codes of the Springboot items are modified, the Springboot items to be started are 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, 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 isAnd->The data integration module determines that the first to-be-started items S1 to i1 to-be-started item Si1 is a first starting group, and the first to-be-started item S1 is a first starting group>And->The data integration module judges that the (1+1) th item to be started (Si 1+1) to the (2) th item to be started (Si 2) are the second starting group, and so on until>The data integration module judges that the (k-1) +1 th item Si (k-1) +1 to the N th item Sn to be started are the kth starting group;
if it isThe data integration module judges that all items to be started are a group.
For a group, by setting the evaluation parameters of the packet data quantity, the balanced range of each group of mobilized data and processed data is ensured, so that the number of JVM processes is reduced, 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 numerical 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 more 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 system blockage caused by overlarge operation of the JVM process 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 under the condition that the coexisting resource packages do not exist, selecting the public resource package with the largest frequency in all items to be started to judge, determining the pseudo coexisting resource package, and classifying the starting items, thereby reducing the number of JVM processes and reducing the loss of resources in 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 isAnd->The data integration module determines that the first to-be-started items D1 to i1 to-be-started item Di1 is a first starting group and is->And->The data integration module judges that items Di1+1 to Di1 and Di2 to be started are the second starting group, and so on until +.>The data integration module judges that the items Di (k-1) +1 to be started and the items Dn2 to be started from the ith (k-1) +1 to the nth 2 are the kth starting group;
if it isThe data integration module judges that a first item set to be started is 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 isAnd->The data integration module determines a first to-be-detectedThe start item S1 to i1 to start item Si1 is the first start group, +.>And->The data integration module judges that the (1+1) th item to be started (Si 1+1) to the (2) th item to be started (Si 2) are the second starting group, and so on until>The data integration module judges that the i (k-1) +1 th item Si (k-1) +1 to the N th item Sn to be started are the k-th starting group.
Further, the step S4 includes:
s41, a custom Bean name generator is adopted, a Bean NameGenerator interface is realized, a generateBeanName 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, 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 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 the Springboot project. The effect that the same JVM process runs a plurality of Springboot items can be achieved.
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 (9)

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 Springboot items 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, groups the Springboot items to be started according to the number 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;
step S5, starting each Springboot item, wherein the Springboot items in the same group are started by adopting the same JVM process;
the step S4 includes:
s41, a custom Bean name generator is used for enabling the custom Bean name generator to realize a Bean NameGenerator interface, rewriting a generateBeanName method, obtaining a Bean name prefix according to a class name, and generating a Bean name logic;
s42, a custom ConfigurationClassBeanDefinationReader rewriting configuration ClassBeanDefinationReader # loadBeanDefinitionsForBeanMeth od method is used for realizing @ Bean annotation, bean name prefixes are obtained according to class names, and logic of Bean names is generated;
s43, a custom mapping processor custom Handlermapping is used for inheriting the RequestMappingHandlermapping, and a getMappingForMethod method is rewritten to obtain url prefixes according to package names and replace 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.
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 isAnd->The data integration module judges that the first to-be-started items S1 to i1 to-be-started item Si1 are a first starting group; />And->The data is integratedThe mould closing block judges that the (1+1) th item to be started (Si 1+1) to the (2) th item to be started (Si 2) are the second starting group, and so on until the item is ++>The data integration module judges that the (k-1) +1 th item Si (k-1) +1 to the N th item Sn to be started are the kth starting group;
if it isThe data integration module judges 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 isAnd->The data integration module judges that the first to-be-started items D1 to i1 to-be-started item Di1 are a first starting group; />And->The data integration module determines the (i 1+1) th item Di1+1 to the (i 2) th item Di2 to be started as a second starting group, and so on untilThe data integration module judges that the items Di (k-1) +1 to be started and the items Dn2 to be started from the ith (k-1) +1 to the nth 2 are the kth starting group;
if it isThe data integration module judges that a first item set to be started is 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 isAnd->The data integration module judges that the first to-be-started items S1 to i1 to-be-started item Si1 are a first starting group; />And->The data integration module judges the (1+1) th item to be started Si1+1 to the (2) th item to be started Si2 as a second starting group, and so on untilThe data integration module judges that the i (k-1) +1 th item Si (k-1) +1 to the N th item Sn to be started are the k-th starting group.
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 CN116149790A (en) 2023-05-23
CN116149790B true 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 (9)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10489170B2 (en) * 2017-06-19 2019-11-26 Salesforce.Com, Inc. Application warmup engine

Patent Citations (9)

* 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
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 (2)

* 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》.2021,60-68. *
SpringBoot项目中EhCache缓存技术的实现;王萍;《电脑知识与技术》(第29期);79-81 *

Also Published As

Publication number Publication date
CN116149790A (en) 2023-05-23

Similar Documents

Publication Publication Date Title
US7257672B2 (en) Error protection for lookup operations performed on ternary content-addressable memory entries
CN109614165B (en) Multi-version parallel operation method and device for COM (component object model) component
CN103793284B (en) Analysis system and method based on consensus pattern, for smart client service
US9600305B2 (en) Code partitioning for enhanced performance
US20050216530A1 (en) Method and apparatus for updating a stored version of content stored in a storage device
Benouaret et al. On the use of fuzzy dominance for computing service skyline based on qos
US20040216096A1 (en) Partitioning of structured programs
US11640464B2 (en) Protocol model learning and guided firmware analysis
Laoutaris et al. Joint object placement and node dimensioning for internet content distribution
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
CN107301347A (en) A kind of method that Hbuilder App calling figures are obtained based on static analysis
US7761860B2 (en) Pre-compiling device
CN105468412A (en) Dynamic packaging method and dynamic packaging device
US7844606B2 (en) Legacy filter support in a new managed file system filter model
CN114327495A (en) AST-based abnormal acquisition code injection method, device and application thereof
CN110334141A (en) Method, apparatus, computer equipment and the storage medium of data conversion
CN108153542A (en) Set-top box software code administration method and system
CN115407942B (en) Data processing method suitable for single chip microcomputer chip
CN103020071A (en) Data synchronization method and data synchronization device
CN109814983A (en) Task batch processing method, device, computer equipment and storage medium
CN102468978A (en) Service configuration method and device
US11194556B1 (en) Deterministic memory allocation for real-time applications
CN115442091A (en) Instant messaging application behavior identification method and system based on network security

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