Skip to content

Commit

Permalink
Automatic merge of master into galahad
Browse files Browse the repository at this point in the history
  • Loading branch information
OracleLabsAutomation committed Nov 21, 2024
2 parents 8d7af08 + 37bc089 commit 682e846
Show file tree
Hide file tree
Showing 10 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion docs/reference-manual/native-image/BuildOptions.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ Run `native-image --help` for help on build options.
* `--target`: select the compilation target for `native-image` (in the `<OS>-<architecture>` format). It defaults to host's OS-architecture pair.
* `--trace-class-initialization`: provide a comma-separated list of fully-qualified class names that a class initialization is traced for
* `--trace-object-instantiation`: provide a comma-separated list of fully-qualified class names that an object instantiation is traced for
* `-O<level>`: control code optimizations where available variants are: `b` - optimize for fastest build time, `s` - optimize for size, `0` - no optimizations, `1` - basic optimizations, `2` - aggressive optimizations, `3` - all optimizations for best performance (enabled automatically with Profile-Guided Optimizations)
* `-O<level>`: control code optimizations where available variants are: `b` - optimize for fastest build time, `s` - optimize for size, `0` - no optimizations, `1` - basic optimizations, `2` - aggressive optimizations, `3` - all optimizations for best performance (enabled automatically with Profile-Guided Optimization (PGO))
* `-da`, `-da[:[packagename]|:[classname]`, `disableassertions[:[packagename]|:[classname]`: disable assertions with specified granularity at run time
* `-dsa`, `-disablesystemassertions`: disable assertions in all system classes at run time
* `-ea`, `-ea[:[packagename]|:[classname]`, `enableassertions[:[packagename]|:[classname]`: enable assertions with specified granularity at run time
Expand Down
10 changes: 5 additions & 5 deletions docs/reference-manual/native-image/BuildOutput.md
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ Use `-Os` to optimize for size.
The targeted machine type can be selected with the `-march` option and defaults to `x86-64-v3` on AMD64 and `armv8-a` on AArch64.
See [here](#recommendation-cpu) for recommendations on how to use this option.

On Oracle GraalVM, the line also shows information about [Profile-Guided Optimizations (PGO)](#recommendation-pgo).
On Oracle GraalVM, the line also shows information about [Profile-Guided Optimization (PGO)](#recommendation-pgo).
- `off`: PGO is not used
- `instrument`: The generated executable or shared library is instrumented to collect data for PGO (`--pgo-instrument`)
- `user-provided`: PGO is enabled and uses a user-provided profile (for example `--pgo default.iprof`)
Expand Down Expand Up @@ -305,23 +305,23 @@ Use `-march=list` to list all available machine types that can be targeted expli
The G1 garbage collector is available for your platform.
Consider enabling it using `--gc=G1` at build time to improve the latency and throughput of your application.
For more information see the [docs on Memory Management](MemoryManagement.md).
For best peak performance, also consider using [Profile-Guided Optimizations](#recommendation-pgo).
For best peak performance, also consider using [Profile-Guided Optimization](#recommendation-pgo).

#### <a name="recommendation-heap"></a>`HEAP`: Specify a Maximum Heap Size

Please refer to [Maximum Heap Size](#glossary-gc-max-heap-size).

#### <a name="recommendation-pgo"></a>`PGO`: Use Profile-Guided Optimizations for Improved Throughput
#### <a name="recommendation-pgo"></a>`PGO`: Use Profile-Guided Optimization for Improved Throughput

Consider using Profile-Guided Optimizations to optimize your application for improved throughput.
Consider using Profile-Guided Optimization (PGO) to optimize your application for improved throughput.
These optimizations allow the Graal compiler to leverage profiling information, similar to when it is running as a JIT compiler, when AOT-compiling your application.
For this, perform the following steps:

1. Build your application with `--pgo-instrument`.
2. Run your instrumented application with a representative workload to generate profiling information in the form of an `.iprof` file.
3. Re-build your application and pass in the profiling information with `--pgo=<your>.iprof` to generate an optimized version of your application.

Relevant guide: [Optimize a Native Executable with Profile-Guided Optimizations](guides/optimize-native-executable-with-pgo.md).
Relevant guide: [Optimize a Native Executable with Profile-Guided Optimization](guides/optimize-native-executable-with-pgo.md).

For best peak performance, also consider using the [G1 garbage collector](#recommendation-g1gc).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ The following table provides an overview of the different optimization levels an
| `-O2` | Advanced | **Default:** Aims for good performance at a reasonable file size. |
| `-O3` | All | Aims for the best performance at the cost of longer build times. Used automatically by Oracle GraalVM for [PGO builds](guides/optimize-native-executable-with-pgo.md) (`--pgo` option). `-O3` and `-O2` are identical in GraalVM Community Edition. |

### Profile-Guided Optimizations for Improved Throughput
### Profile-Guided Optimization for Improved Throughput

Consider using Profile-Guided Optimizations to optimize your application for improved throughput.
Consider using Profile-Guided Optimization (PGO) to optimize your application for improved throughput.
These optimizations allow the Graal compiler to leverage profiling information, similar to when it is running as a JIT compiler, when AOT-compiling your application.
For this, perform the following steps:

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-manual/native-image/PGO-Basic-Usage.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
layout: docs
toc_group: pgo
link_title: Basic Usage of Profile-Guided Optimizations
link_title: Basic Usage of Profile-Guided Optimization
permalink: /reference-manual/native-image/optimizations-and-performance/PGO/basic-usage/
---

Expand Down
2 changes: 1 addition & 1 deletion docs/reference-manual/native-image/PGO-LCOV.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ permalink: /reference-manual/native-image/optimizations-and-performance/PGO/LCOV

Here you will learn how to analyze PGO profiles with the aid of LCOV-based tooling.

Profile-Guided Optimizations (PGO) help you maximize the performance of your native application.
Profile-Guided Optimization (PGO) helps you maximize the performance of your native application.
As part of the PGO process, you create an instrumented binary and run a workload on it to generate
a PGO profile file that you can then feed back into the build process to generate an optimized binary
of your application.
Expand Down
6 changes: 3 additions & 3 deletions docs/reference-manual/native-image/PGO.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,15 +86,15 @@ This would lead to the inlining phase choosing to inline `handleNotEnoughArgumen
Hence, the goal is to gather profiles on workload that match the production workloads as much as possible.
The gold standard for this is to run the exact same workloads you expect to run in production on the instrumented binary.

For a more detailed usage overview, go to [Basic Usage of Profile-Guided Optimizations](PGO-Basic-Usage.md) documentation.
For a more detailed usage overview, go to [Basic Usage of Profile-Guided Optimization](PGO-Basic-Usage.md) documentation.

### Further Reading

* [Basic Usage of Profile-Guided Optimizations](PGO-Basic-Usage.md)
* [Basic Usage of Profile-Guided Optimization](PGO-Basic-Usage.md)
* [Inspecting a Profile in a Build Report](PGO-Build-Report.md)
* [Creating LCOV Coverage Reports](PGO-LCOV.md)
* [Merging Profiles from Multiple Sources](PGO-Merging-Profiles.md)
* [Tracking Profile Quality Over Time](PGO-Profile-Quality.md)
* [The _iprof_ File Format](PGO-IprofFileFormat.md)
* [The _iprof_ JSON Schema](assets/iprof-v1.0.0.schema.json)
* [Frequently Asked Questions](PGO-FAQ.md)
* [Frequently Asked Questions](PGO-FAQ.md)
2 changes: 1 addition & 1 deletion docs/reference-manual/native-image/WorkshopsAndLabs.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following labs are available:
- [GraalVM Native Image Quick Start](https://luna.oracle.com/lab/47dafec8-4095-4fba-8313-dad43a64dee4): This lab is for developers new to Native Image who are keen to start building cloud native Java applications.
- [GraalVM, Reflection and Native Image](https://luna.oracle.com/lab/5fde71fb-8044-4c82-aa1c-3f2e5771caed): This lab shows how to preconfigure the `native-image` builder when reflection is used, and make your Java application compatible with ahead-of-time compilation using Native Image.
- [GraalVM Native Image, Spring and Containerisation](https://luna.oracle.com/lab/fdfd090d-e52c-4481-a8de-dccecdca7d68): This lab shows you how to package a Spring Boot application into a native executable; containerise it; shrink the footprint even more by creating small a Distroless container Image.
- [Optimize Cloud Native Java Apps with Oracle GraalVM PGO](https://luna.oracle.com/lab/3f0b7c86-6105-4b7a-9a3b-eb73b251a1aa): This lab shows how to run a Java Microbenchmark Harness (JMH) benchmark as a native executable, built with GraalVM Native Image, and then optimize it for higher throughput using Profile-Guided Optimizations (PGO).
- [Optimize Cloud Native Java Apps with Oracle GraalVM PGO](https://luna.oracle.com/lab/3f0b7c86-6105-4b7a-9a3b-eb73b251a1aa): This lab shows how to run a Java Microbenchmark Harness (JMH) benchmark as a native executable, built with GraalVM Native Image, and then optimize it for higher throughput using Profile-Guided Optimization (PGO).
- [OCI MySQL, Vault, Micronaut, GraalVM Native Image](https://luna.oracle.com/lab/a78388fd-c15f-48b4-96aa-5e4716ae236c): In this lab, you will learn how to build a portable cloud-native Java application with Micronaut, GraalVM Native Image and MySQL Database service, and Secrets in Vault on Oracle Cloud Infrastructure.
- [GraalVM Native Build Tools, for Maven](https://luna.oracle.com/lab/e5af592b-3365-45ce-b964-6fd409e5c76f): This lab shows you how to use the GraalVM Native Build Tools to easily build a native executable of your application using Maven. It is aimed at developers with the knowledge of Java.
- [Build Cloud Native Java Applications with Micronaut and GraalVM Native Image](https://luna.oracle.com/lab/e329af0f-504e-4eb0-8804-2dd6b10076c9): The workshop features several labs that walk you through the steps to get going with Micronaut, GraalVM, and Oracle Cloud Infrastructure services.
Expand Down
2 changes: 1 addition & 1 deletion docs/reference-manual/native-image/guides/guides.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ Here you will learn how to:
- [Include Reachability Metadata Using the Native Image Gradle Plugin](include-reachability-metadata-gradle.md)
- [Include Reachability Metadata Using the Native Image Maven Plugin](include-reachability-metadata-maven.md)
- [Include Resources in a Native Executable](include-resources.md)
- [Optimize a Native Executable with Profile-Guided Optimizations](optimize-native-executable-with-pgo.md)
- [Optimize a Native Executable with Profile-Guided Optimization](optimize-native-executable-with-pgo.md)
- [Optimize a Native Executable for File Size](optimize-file-size.md)
- [Optimize Size of a Native Executable using Build Reports](optimize-native-executable-size-using-build-report.md)
- [Optimize Memory Footprint of a Native Executable](optimize-memory-footprint.md)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ Moreover, build-time initialization, if not used towards a specific goal, can ca
Generally, it is a good idea to check file size, number of embedded resources, or other metrics from time to time, for example, when adding or updating dependencies, or even monitor build metrics frequently.
For this, you can use the [machine-readable version of the build output](../BuildOutput.md#machine-readable-build-output) or the [build reports for GitHub Actions](https://medium.com/graalvm/native-image-build-reports-and-update-notifications-351aca964a55){:target="_blank"}.

There are other Native Image techniques that can positively affect the executable size, besides improving other metrics, for example, [Profile-Guided Optimizations (PGO)](optimize-native-executable-with-pgo.md).
There are other Native Image techniques that can positively affect the executable size, besides improving other metrics, for example, [Profile-Guided Optimization (PGO)](optimize-native-executable-with-pgo.md).

### Related Documentation

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ permalink: /reference-manual/native-image/guides/optimize-native-executable-with
redirect_from: /reference-manual/native-image/PGO/
---

# Optimize a Native Executable with Profile-Guided Optimizations
# Optimize a Native Executable with Profile-Guided Optimization

GraalVM Native Image offers quick startup and less memory consumption for a Java application, running as a native executable, by default.
You can optimize this native executable even more for additional performance gain and higher throughput by applying Profile-Guided Optimizations (PGO).
You can optimize this native executable even more for additional performance gain and higher throughput by applying Profile-Guided Optimization (PGO).

With PGO you can collect the profiling data in advance, and then feed it to the `native-image` tool, which will use this information to optimize the performance of a native application.
The general workflow is:
Expand Down Expand Up @@ -188,7 +188,7 @@ For other installation options, visit the [Downloads section](https://www.graalv
You should get the performance comparable to, or faster, than the Java version of the program. For example, on a machine with 16 GB of memory and 8 cores, the `TOTAL time` for 10 iterations reduced from ~2200 to ~270 milliseconds.

This guide showed how you can optimize native executables for additional performance gain and higher throughput.
Oracle GraalVM offers extra benefits for building native executables, such as Profile-Guided Optimizations (PGO).
Oracle GraalVM offers extra benefits for building native executables, such as Profile-Guided Optimization (PGO).
With PGO you "train" your application for specific workloads and significantly improve the performance.

### Related Documentation
Expand Down

0 comments on commit 682e846

Please sign in to comment.