Giter Club home page Giter Club logo

heapwatch's Introduction

Java CI with Maven Maven Package BCH compliance Maintainability codecov FOSSA Status

heapwatch

Have you ever had the problem that your application functionally fulfilled all the requirements, but hours or days after deployment you noticed that your application suddenly allocated twice as much memory as before? A big problem is of course finding the cause in all the commits between the last and the current release. Wouldn't it be nice to be informed at the moment of the commit that your application is suddenly consuming significantly more memory than before?

This is exactly what this pluign solves! How does this work? All you have to do is tell your JVM to write the information about the garbage collector to a log file. So if you want to view the memory used during the test execution, you can do this by making the following change in your pom:

<plugin>
	<artifactId>maven-surefire-plugin</artifactId>
	<version>...</version>
	<configuration>
		<argLine>-XX:+PrintGCDetails -XX:+PrintGCDateStamps -Xloggc:${project.build.directory}/gc.log</argLine>
	</configuration>
</plugin>

In order to abort the build (or to issue a warning in the build log) when a certain limit value is exceeded, integrate this plugin as follows:

<plugin>
	<groupId>com.github.pfichtner.heapwatch</groupId>
	<artifactId>heapwatch-maven-plugin</artifactId>
	<version>0.0.1</version>
        <configuration>
                <gclog>${project.build.directory}/gc.log</gclog>
                <heapSpace><le>800M</le></heapSpace>
        </configuration>
	<executions>
		<execution>
			<phase>verify</phase>
			<goals>
				<goal>verify</goal>
			</goals>
		</execution>
	</executions>
</plugin>

If the heapspace exceeds 800 MB, the build aborts.

Backlog:

  • Release the maven plugin to maven-central
  • Create gradle plugin with same functionality
  • Support relative values ("not more than 10% more than memory used last time")
  • Support more meassurements (currently supported: heapOccupancy, heapAfterGC, heapSpace, metaspaceOccupancy, metaspaceAfterGC, metaspaceSpace)
  • Investigate if we can attach the plugin analog to jacoco-maven-plugin (via prepare-agent goal)

This plugin uses the following FOSS software components:

License

FOSSA Status

heapwatch's People

Contributors

fossabot avatar pfichtner avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.