vault
vault copied to clipboard
VAULT-12732: Add Heap Profiling Option to Vault Server Command Line
Background
Currently, we utilize sys/pprof
and/or vault debug
to generate pprof dumps for performance and debugging purposes. However, these tools are not effective if the issue we want to investigate occurs during the startup phase, or if Vault exits too quickly to issue such requests.
Objective
To address this limitation, this PR introduces a new command-line option to Vault that allows specifying a file path to generate a heap profile dump at startup. This enhancement is intended to facilitate debugging in scenarios where Vault starts and exits rapidly, making it challenging to use the existing profiling tools.
Implementation
New Command-Line Option: -pprof-dump-dir=/path/to/dir
- This option allows users to specify the file path where the heap profile dump should be saved.
- The heap profile will be generated and saved at the specified path during the startup process.
Usage: This is a one-off option and does not require HCL configuration. It is intended for temporary use during debugging sessions and not for repeated or regular use.
Example
To start the Vault server and generate a heap profile dump, use the following command:
vault server -pprof-dump-dir=/path/to/dir
CI Results: All Go tests succeeded! :white_check_mark:
Build Results: All builds succeeded! :white_check_mark: