How to pass JVM arguments to the Mesh sidecar
Platform notice: Server and Data Center only. This article only applies to Atlassian products on the Server and Data Center platforms.
Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Purpose
As of Bitbucket 8.0, Git operations are now run in the mesh sidecar. This sidecar JVM is launched as a child process directly from the Bitbucket JVM, and therefore does not have startup scripts. This means users have to configure the sidecar JVM options through bitbucket.properties
in Bitbucket data center for items such as JMX settings, heap dump, or gc logging configuration and the sidecar process will inherit these settings.
Solution
This configuration only affects the mesh sidecar and does not propagate to any remote mesh nodes. Remote mesh nodes will have startup scripts in the <Mesh-install>/bin/
folder, and you can update JVM arguments in the _start-mesh.sh
file under JVM_SUPPORT_RECOMMENDED_ARGS - similar to Bitbucket
More details on setting up a remote Mesh node can be found in Set up and configure Mesh nodes
Add the following lines to the bitbucket.properties
file adding the arguments you want the mesh sidecar to pick up. Next time Bitbucket and the sidecar starts it will pick up these changes:
# Pass custom JVM arguments on the command line used to start the Mesh sidecar process. Values set here will be
# passed as the final arguments such that they can be used to override pre-set values where applicable.
# Note: The list index (i.e. the number in square brackets) must start at zero and must be contiguous.
plugin.bitbucket-git.mesh.sidecar.jvm-args[0]=-verbose:gc
plugin.bitbucket-git.mesh.sidecar.jvm-args[1]=-XX:+HeapDumpOnOutOfMemoryError
In addition there is a separate property for setting the Max and Min heap sizes, (Xmx Xms), which is outlined below:
# The heap size of the Mesh sidecar process. The configured size is applied as both the minimum (`-Xms`) and
# maximum (`-Xmx`) heap size for the sidecar process. Be aware that the sidecar requires only limited memory, even
# under highly concurrent load. Oversized heaps can result in worse performance as a result of large gc pauses. To
# prevent this, a hard limit of 2G is applied to the configured memory.
#
# This value is in megabytes.
plugin.bitbucket-git.mesh.sidecar.heap-size=768
After applying these items to bitbucket.properties
restart Bitbucket (and in effect the mesh sidecar) for it to pick up these changes.