[ 
https://issues.apache.org/jira/browse/MNG-6030?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andriy updated MNG-6030:
------------------------
    Description: 
after version 3.0.5 we found a very big memory consumption with maven. needed 
for build memory grows from 1G to 5G 

According to current implementation there were change with commit 
https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commit;h=e778ea67121f17232a7dced3fb4f0a205ffa64af
   
https://issues.apache.org/jira/browse/MNG-5312

{code}
private ModelBuildingRequest getModelBuildingRequest( InternalConfig config )
    {
@@ -256,7 +256,7 @@ public class DefaultProjectBuilder
         request.setUserProperties( configuration.getUserProperties() );
         request.setBuildStartTime( configuration.getBuildStartTime() );
         request.setModelResolver( resolver );
-        request.setModelCache( config.modelCache );
+        request.setModelCache( new ReactorModelCache() );

         return request;
     }
{code}

and as result new ReactorModelCache created for each ModelBuildingRequest which 
is created new to parse each pom.xml included in the build as module. 

so if there is a big projects with a lot of modules ModelBuildingRequest is 
created for each of them and parse result is not reused between modules.  and 
if all this modules has the same parent pom it parsed each time and stored as 
many times as many ModelBuildingRequest was created. As parent pom often 
contains dependencies, dependencyManagement and common information for all 
modules it cause a larger memory footprint then was before. In version 3.0.5 
and earlier ReactorModelCache was single and was reused between 
ModelBuildingRequest.

in our cause footprint grew from 1g to 5g.

it will be better to reuse result of parsing pom files between 
ModelBuildingRequests.

  was:
after version 3.0.5 we found a very big memory consumption with maven. needed 
for build memory grows from 1G to 5G 

According to current implementation there were change with commit 
https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commit;h=e778ea67121f17232a7dced3fb4f0a205ffa64af
 

{code}
private ModelBuildingRequest getModelBuildingRequest( InternalConfig config )
    {
@@ -256,7 +256,7 @@ public class DefaultProjectBuilder
         request.setUserProperties( configuration.getUserProperties() );
         request.setBuildStartTime( configuration.getBuildStartTime() );
         request.setModelResolver( resolver );
-        request.setModelCache( config.modelCache );
+        request.setModelCache( new ReactorModelCache() );

         return request;
     }
{code}

and as result new ReactorModelCache created for each ModelBuildingRequest which 
is created new to parse each pom.xml included in the build as module. 

so if there is a big projects with a lot of modules ModelBuildingRequest is 
created for each of them and parse result is not reused between modules.  and 
if all this modules has the same parent pom it parsed each time and stored as 
many times as many ModelBuildingRequest was created. As parent pom often 
contains dependencies, dependencyManagement and common information for all 
modules it cause a larger memory footprint then was before. In version 3.0.5 
and earlier ReactorModelCache was single and was reused between 
ModelBuildingRequest.

in our cause footprint grew from 1g to 5g.

it will be better to reuse result of parsing pom files between 
ModelBuildingRequests.


> ReactorModelCache do not used effectively after maven version 3.0.5 which 
> cause a large memory footprint
> --------------------------------------------------------------------------------------------------------
>
>                 Key: MNG-6030
>                 URL: https://issues.apache.org/jira/browse/MNG-6030
>             Project: Maven
>          Issue Type: Improvement
>          Components: Embedding
>    Affects Versions: 3.1.1, 3.2.5, 3.3.3, 3.3.9
>            Reporter: Andriy
>              Labels: performance
>
> after version 3.0.5 we found a very big memory consumption with maven. needed 
> for build memory grows from 1G to 5G 
> According to current implementation there were change with commit 
> https://git-wip-us.apache.org/repos/asf?p=maven.git;a=commit;h=e778ea67121f17232a7dced3fb4f0a205ffa64af
>    
> https://issues.apache.org/jira/browse/MNG-5312
> {code}
> private ModelBuildingRequest getModelBuildingRequest( InternalConfig config )
>     {
> @@ -256,7 +256,7 @@ public class DefaultProjectBuilder
>          request.setUserProperties( configuration.getUserProperties() );
>          request.setBuildStartTime( configuration.getBuildStartTime() );
>          request.setModelResolver( resolver );
> -        request.setModelCache( config.modelCache );
> +        request.setModelCache( new ReactorModelCache() );
>          return request;
>      }
> {code}
> and as result new ReactorModelCache created for each ModelBuildingRequest 
> which is created new to parse each pom.xml included in the build as module. 
> so if there is a big projects with a lot of modules ModelBuildingRequest is 
> created for each of them and parse result is not reused between modules.  and 
> if all this modules has the same parent pom it parsed each time and stored as 
> many times as many ModelBuildingRequest was created. As parent pom often 
> contains dependencies, dependencyManagement and common information for all 
> modules it cause a larger memory footprint then was before. In version 3.0.5 
> and earlier ReactorModelCache was single and was reused between 
> ModelBuildingRequest.
> in our cause footprint grew from 1g to 5g.
> it will be better to reuse result of parsing pom files between 
> ModelBuildingRequests.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to