How the approximate repository size is calculated in Bitbucket Data Center

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. 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

Summary

When viewing a repository's settings, clicking Retrieve size details can give an estimate of its size. How is the approximate size calculated?

Solution

Bitbucket Data Center uses the following process to calculate the approximate size of repositories:

  1. First it checks if any pack files exist in the repository. If there are pack files, the approximate size of the repository is considered to be the size of all found pack files combined, and the process is finished.

  2. If there are no pack files in the repository Bitbucket will instead traverse the loose objects in the repository one by one and calculate the approximate file size by summing up the file sizes of the individual loose objects it encounters.

Limitations

We discuss "approximate size" as the calculation is expected not to be accurate. Some factors limit the accuracy:

  • For performance reasons, the process of traversing loose objects is limited to 75 milliseconds. Any loose objects that Bitbucket isn't able to traverse within that time are not included in the calculation. Repositories that are large or that reside on volumes with slower read speeds may show inaccurate data. This also explains why you may see varying results if you repeatedly have Bitbucket calculate the approximate size. The timeout of 75 milliseconds is hardcoded and can't be configured, and it does not apply to the calculation of the repository size if pack files exist (step 1 above).

  • LFS data is not included in the calculation.

  • There is a known issue with the repository settings view showing inaccurate repository sizes: BSERV-13879.

The only reliable way of sizing a repository is to perform a full clone of it and then check the resulting directory's size on disk.

Updated on March 14, 2025

Still need help?

The Atlassian Community is here for you.