Skip to content

Commit

Permalink
Merge branch 'cgfrost-78798560-Memory-Java-opts'
Browse files Browse the repository at this point in the history
  • Loading branch information
nebhale committed Nov 20, 2014
2 parents 93e7c44 + d920d76 commit 0b9a0cf
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 8 deletions.
45 changes: 42 additions & 3 deletions docs/framework-java_opts.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ The framework can be configured by creating or modifying the [`config/java_opts.
| Name | Description
| ---- | -----------
| `from_environment` | Whether to append the value of the `JAVA_OPTS` environment variable to the collection of Java options
| `java_opts` | The Java options to use when running the application. All values are used without modification when invoking the JVM. The options are specified as a single YAML scalar in plain style or enclosed in single or double quotes.
| `java_opts` | The Java options to use when running the application. All values are used without modification when invoking the JVM. The options are specified as a single YAML scalar in plain style or enclosed in single or double quotes.

Any `JAVA_OPTS` from either the config file or environment variables that configure memory options will cause deployment to fail as they're not allowed. Memory options are configured by the buildpack and may not be modified.
Any `JAVA_OPTS` from either the config file or environment variables that configure memory options will cause deployment to fail as they're not allowed. Memory options are configured by the buildpack and may not be modified.

## Example
```yaml
Expand All @@ -35,5 +35,44 @@ from_environment: false
java_opts: -Xloggc:$PWD/beacon_gc.log -verbose:gc
```
[Configuration and Extension]: ../README.md#configuration-and-extension
## Memory Settings
The following `JAVA_OPTS` are restricted and will cause the application to fail deployment.

* `-Xms`
* `-Xmx`
* `-Xss`
* `-XX:MaxMetaspaceSize`
* `-XX:MaxPermSize`
* `-XX:MetaspaceSize`
* `-XX:PermSize`

### Allowed Memory Settings

Setting any of the allowed memory settings may require a change to the [Memory Weightings]. Where a value is shown it is the default value for that setting.

| Argument| Description
| ------- | -----------
| `-Xmn <SIZE>` | Maximum size of young generation, known as the eden region. **This could effect the total heap size [Memory Weightings].**
| `-XX:+UseGCOverheadLimit` | Use a policy that limits the proportion of the VM's time that is spent in GC before an `java.lang.OutOfMemoryError` error is thrown.
| `-XX:+UseLargePages` | Use large page memory. For details, see [Java Support for Large Memory Pages].
| `-XX:-HeapDumpOnOutOfMemoryError` | Dump heap to file when `java.lang.OutOfMemoryError` is thrown.
| `-XX:HeapDumpPath=<PATH>` | Path to directory or filename for heap dump.
| `-XX:LargePageSizeInBytes=<SIZE>` | Sets the large page size used for the Java heap.
| `-XX:MaxDirectMemorySize=<SIZE>` | Upper limit on the maximum amount of allocatable direct buffer memory. **This could effect the [Memory Weightings].**
| `-XX:MaxHeapFreeRatio=<RATIO>` | Maximum percentage of heap free after GC to avoid shrinking.
| `-XX:MaxNewSize=<SIZE>` | Maximum size of new generation. Since `1.4`, `MaxNewSize` is computed as a function of `NewRatio`. **This could effect the total heap size [Memory Weightings].**
| `-XX:MinHeapFreeRatio=<RATIO>` | Minimum percentage of heap free after GC to avoid expansion.
| `-XX:NewRatio=<RATIO>` | Ratio of old/new generation sizes. 2 is equal to approximately 66%.
| `-XX:NewSize=<SIZE>` | Default size of new generation. **This could effect the total heap size [Memory Weightings].**
| `-XX:OnError="<CMD ARGS>;<CMD ARGS>"` | Run user-defined commands on fatal error.
| `-XX:OnOutOfMemoryError="<CMD ARGS>;<CMD ARGS>"` | Run user-defined commands when an `java.lang.OutOfMemoryError` is first thrown.
| `-XX:ReservedCodeCacheSize=<SIZE>` | _Java 8 Only_ Maximum code cache size. Also know as `-Xmaxjitcodesize`. **This could effect the [Memory Weightings].**
| `-XX:SurvivorRatio=<RATIO>` | Ratio of eden/survivor space. Solaris only.
| `-XX:TargetSurvivorRatio=<RATIO>` | Desired ratio of survivor space used after scavenge.
| `-XX:ThreadStackSize=<SIZE>` | Thread stack size. (0 means use default stack size).

[`config/java_opts.yml`]: ../config/java_opts.yml
[Configuration and Extension]: ../README.md#configuration-and-extension
[Java Support for Large Memory Pages]: http://www.oracle.com/technetwork/java/javase/tech/largememory-jsp-137182.html
[Memory Weightings]: jre-open_jdk_jre.md#memory-weightings
6 changes: 1 addition & 5 deletions java-buildpack.iml
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="RUBY_MODULE" version="4">
<component name="CompassSettings">
<option name="compassSupportEnabled" value="true" />
</component>
<component name="ModuleRunConfigurationManager">
<configuration default="false" name="All Tests" type="RSpecRunConfigurationType" factoryName="RSpec" singleton="true">
<predefined_log_file id="RUBY_RSPEC" enabled="true" />
Expand Down Expand Up @@ -305,5 +302,4 @@
<LOAD_PATH number="4" string0="$MODULE_DIR$/lib" string1="$MODULE_DIR$/spec" string2="$MODULE_DIR$/bin" string3="$MODULE_DIR$/spec/bin" />
<I18N_FOLDERS number="0" />
</component>
</module>

</module>

0 comments on commit 0b9a0cf

Please sign in to comment.