Skip to content

Commit

Permalink
Document how to tune the size of LocalBlobAccess
Browse files Browse the repository at this point in the history
We often get questions on Slack how to do this. There are some
Prometheus metrics that can be inspected to determine whether the
key-location map and blocks backend are appropriately sized. Let's
document these explicitly in the Protobuf definitions for the storage
configuration.

While there, fix a typo in the metric name. It should be named
'old_current_new' to match the implementation, not 'old_new_current'.
  • Loading branch information
EdSchouten committed Sep 5, 2023
1 parent 842770c commit c04246b
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pkg/blobstore/local/old_current_new_location_blob_map.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ var (
prometheus.GaugeOpts{
Namespace: "buildbarn",
Subsystem: "blobstore",
Name: "old_new_current_location_blob_map_last_removed_old_block_insertion_time_seconds",
Name: "old_current_new_location_blob_map_last_removed_old_block_insertion_time_seconds",
Help: "Time at which the last removed block was inserted into the \"old\" queue, which is an indicator for the worst-case blob retention time",
},
[]string{"storage_type"})
Expand Down
28 changes: 28 additions & 0 deletions pkg/proto/configuration/blobstore/blobstore.proto
Original file line number Diff line number Diff line change
Expand Up @@ -483,6 +483,21 @@ message LocalBlobAccessConfiguration {
int64 entries = 1;
}

// Data store for the metadata of objects. The following Prometheus
// queries may be used to determine whether insertion into the
// key-location map caused other entries to be displaced prematurely:
//
// buildbarn_blobstore_hashing_key_location_map_put_iterations_count{outcome="TooManyAttempts"}
// buildbarn_blobstore_hashing_key_location_map_put_too_many_iterations_total
//
// If this query yields values greater than zero, you may need to
// increase this data store's size (or reduce the size of the blocks
// backend).
//
// Note that restarting bb_storage causes these metrics to be reset,
// meaning that you may need to run bb_storage for a longer amount of
// time to get better insight in whether objects are discarded
// prematurely.
oneof key_location_map_backend {
// Store the key-location map in memory.
KeyLocationMapInMemory key_location_map_in_memory = 11;
Expand Down Expand Up @@ -603,6 +618,19 @@ message LocalBlobAccessConfiguration {
data_integrity_validation_cache = 3;
}

// Data store for the contents of objects. The following Prometheus
// query may be used to determine the worst-case retention of this
// data store in seconds:
//
// time() -
// buildbarn_blobstore_old_current_new_location_blob_map_last_removed_old_block_insertion_time_seconds
//
// If this query yields a value that is lower than desired, you may
// need to increase this data store's size.
//
// Note that restarting bb_storage causes this metric to be reset,
// meaning that you may need to run bb_storage for a longer amount of
// time to get better insight in the worst-case retention.
oneof blocks_backend {
// Store all data in memory. For larger setups, this may place a lot
// of pressure on Go's garbage collector. It may be necessary to
Expand Down

0 comments on commit c04246b

Please sign in to comment.