Skip to content

Commit 043ba64

Browse files
committed
storage: use fastest profile for default compression
This change fixes the issue of having different cluster setting defaults on different platforms, which is problematic for auto-generated documentation. Epic: none Release note: None
1 parent a548c60 commit 043ba64

File tree

3 files changed

+20
-27
lines changed

3 files changed

+20
-27
lines changed

docs/generated/settings/settings-for-tenants.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,9 +401,9 @@ storage.delete_compaction_excise.enabled boolean true set to false to direct Peb
401401
storage.ingestion.value_blocks.enabled boolean true set to true to enable writing of value blocks in ingestion sstables application
402402
storage.max_sync_duration duration 20s maximum duration for disk operations; any operations that take longer than this setting trigger a warning log entry or process crash system-visible
403403
storage.max_sync_duration.fatal.enabled boolean true if true, fatal the process when a disk operation exceeds storage.max_sync_duration application
404-
storage.sstable.compression_algorithm enumeration minlz determines the compression algorithm to use when compressing sstable data blocks for use in a Pebble store; [snappy = 1, zstd = 2, none = 3, minlz = 4] system-visible
405-
storage.sstable.compression_algorithm_backup_storage enumeration minlz determines the compression algorithm to use when compressing sstable data blocks for backup row data storage; [snappy = 1, zstd = 2, none = 3, minlz = 4] system-visible
406-
storage.sstable.compression_algorithm_backup_transport enumeration minlz determines the compression algorithm to use when compressing sstable data blocks for backup transport; [snappy = 1, zstd = 2, none = 3, minlz = 4] system-visible
404+
storage.sstable.compression_algorithm enumeration fastest determines the compression algorithm to use when compressing sstable data blocks for use in a Pebble store; [snappy = 1, zstd = 2, none = 3, minlz = 4, fastest = 5] system-visible
405+
storage.sstable.compression_algorithm_backup_storage enumeration fastest determines the compression algorithm to use when compressing sstable data blocks for backup row data storage; [snappy = 1, zstd = 2, none = 3, minlz = 4, fastest = 5] system-visible
406+
storage.sstable.compression_algorithm_backup_transport enumeration fastest determines the compression algorithm to use when compressing sstable data blocks for backup transport; [snappy = 1, zstd = 2, none = 3, minlz = 4, fastest = 5] system-visible
407407
timeseries.storage.resolution_10s.ttl duration 240h0m0s the maximum age of time series data stored at the 10 second resolution. Data older than this is subject to rollup and deletion. system-visible
408408
timeseries.storage.resolution_30m.ttl duration 2160h0m0s the maximum age of time series data stored at the 30 minute resolution. Data older than this is subject to deletion. system-visible
409409
trace.debug_http_endpoint.enabled (alias: trace.debug.enable) boolean false if set, traces for recent requests can be seen at https://<ui>/debug/requests application

docs/generated/settings/settings.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,9 @@
357357
<tr><td><div id="setting-storage-ingestion-value-blocks-enabled" class="anchored"><code>storage.ingestion.value_blocks.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>set to true to enable writing of value blocks in ingestion sstables</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
358358
<tr><td><div id="setting-storage-max-sync-duration" class="anchored"><code>storage.max_sync_duration</code></div></td><td>duration</td><td><code>20s</code></td><td>maximum duration for disk operations; any operations that take longer than this setting trigger a warning log entry or process crash</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>
359359
<tr><td><div id="setting-storage-max-sync-duration-fatal-enabled" class="anchored"><code>storage.max_sync_duration.fatal.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if true, fatal the process when a disk operation exceeds storage.max_sync_duration</td><td>Serverless/Dedicated/Self-Hosted</td></tr>
360-
<tr><td><div id="setting-storage-sstable-compression-algorithm" class="anchored"><code>storage.sstable.compression_algorithm</code></div></td><td>enumeration</td><td><code>minlz</code></td><td>determines the compression algorithm to use when compressing sstable data blocks for use in a Pebble store; [snappy = 1, zstd = 2, none = 3, minlz = 4]</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>
361-
<tr><td><div id="setting-storage-sstable-compression-algorithm-backup-storage" class="anchored"><code>storage.sstable.compression_algorithm_backup_storage</code></div></td><td>enumeration</td><td><code>minlz</code></td><td>determines the compression algorithm to use when compressing sstable data blocks for backup row data storage; [snappy = 1, zstd = 2, none = 3, minlz = 4]</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>
362-
<tr><td><div id="setting-storage-sstable-compression-algorithm-backup-transport" class="anchored"><code>storage.sstable.compression_algorithm_backup_transport</code></div></td><td>enumeration</td><td><code>minlz</code></td><td>determines the compression algorithm to use when compressing sstable data blocks for backup transport; [snappy = 1, zstd = 2, none = 3, minlz = 4]</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>
360+
<tr><td><div id="setting-storage-sstable-compression-algorithm" class="anchored"><code>storage.sstable.compression_algorithm</code></div></td><td>enumeration</td><td><code>fastest</code></td><td>determines the compression algorithm to use when compressing sstable data blocks for use in a Pebble store; [snappy = 1, zstd = 2, none = 3, minlz = 4, fastest = 5]</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>
361+
<tr><td><div id="setting-storage-sstable-compression-algorithm-backup-storage" class="anchored"><code>storage.sstable.compression_algorithm_backup_storage</code></div></td><td>enumeration</td><td><code>fastest</code></td><td>determines the compression algorithm to use when compressing sstable data blocks for backup row data storage; [snappy = 1, zstd = 2, none = 3, minlz = 4, fastest = 5]</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>
362+
<tr><td><div id="setting-storage-sstable-compression-algorithm-backup-transport" class="anchored"><code>storage.sstable.compression_algorithm_backup_transport</code></div></td><td>enumeration</td><td><code>fastest</code></td><td>determines the compression algorithm to use when compressing sstable data blocks for backup transport; [snappy = 1, zstd = 2, none = 3, minlz = 4, fastest = 5]</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>
363363
<tr><td><div id="setting-storage-wal-failover-unhealthy-op-threshold" class="anchored"><code>storage.wal_failover.unhealthy_op_threshold</code></div></td><td>duration</td><td><code>100ms</code></td><td>the latency of a WAL write considered unhealthy and triggers a failover to a secondary WAL location</td><td>Dedicated/Self-Hosted</td></tr>
364364
<tr><td><div id="setting-timeseries-storage-enabled" class="anchored"><code>timeseries.storage.enabled</code></div></td><td>boolean</td><td><code>true</code></td><td>if set, periodic timeseries data is stored within the cluster; disabling is not recommended unless you are storing the data elsewhere</td><td>Dedicated/Self-Hosted</td></tr>
365365
<tr><td><div id="setting-timeseries-storage-resolution-10s-ttl" class="anchored"><code>timeseries.storage.resolution_10s.ttl</code></div></td><td>duration</td><td><code>240h0m0s</code></td><td>the maximum age of time series data stored at the 10 second resolution. Data older than this is subject to rollup and deletion.</td><td>Dedicated/Self-hosted (read-write); Serverless (read-only)</td></tr>

pkg/storage/pebble.go

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"math"
1313
"os"
1414
"path/filepath"
15-
"runtime"
1615
"sort"
1716
"strconv"
1817
"strings"
@@ -184,17 +183,22 @@ type CompressionAlgorithm int64
184183
// These values end up being the underlying value of the cluster setting, so
185184
// they must be stable across releases.
186185
const (
187-
CompressionAlgorithmSnappy CompressionAlgorithm = 1
188-
CompressionAlgorithmZstd CompressionAlgorithm = 2
189-
CompressionAlgorithmNone CompressionAlgorithm = 3
190-
CompressionAlgorithmMinLZ CompressionAlgorithm = 4
186+
CompressionAlgorithmSnappy CompressionAlgorithm = 1
187+
CompressionAlgorithmZstd CompressionAlgorithm = 2
188+
CompressionAlgorithmNone CompressionAlgorithm = 3
189+
CompressionAlgorithmMinLZ CompressionAlgorithm = 4
190+
CompressionAlgorithmFastest CompressionAlgorithm = 5
191191
)
192192

193193
var compressionAlgorithmToString = map[CompressionAlgorithm]string{
194194
CompressionAlgorithmSnappy: "snappy",
195195
CompressionAlgorithmMinLZ: "minlz",
196196
CompressionAlgorithmNone: "none",
197197
CompressionAlgorithmZstd: "zstd",
198+
199+
// CompressionAlgorithmFastest uses either Snappy or MinLZ, depending on the
200+
// architecture.
201+
CompressionAlgorithmFastest: "fastest",
198202
}
199203

200204
// String implements fmt.Stringer for CompressionAlgorithm.
@@ -225,19 +229,6 @@ func RegisterCompressionAlgorithmClusterSetting(
225229
)
226230
}
227231

228-
var defaultCompressionAlgorithm = func() CompressionAlgorithm {
229-
if runtime.GOARCH == "amd64" {
230-
// We prefer MinLZ on amd64 because it is slightly superior to Snappy in
231-
// almost all cases (both in terms of speed and compression ratio).
232-
//
233-
// Only amd64 has an optimized assembly MinLZ implementation; the Go
234-
// implementation is significantly slower, especially when decompressing;
235-
// see https://github.com/minio/minlz#protobuf-sample
236-
return CompressionAlgorithmMinLZ
237-
}
238-
return CompressionAlgorithmSnappy
239-
}()
240-
241232
// CompressionAlgorithmStorage determines the compression algorithm used to
242233
// compress data blocks when writing sstables for use in a Pebble store (written
243234
// directly, or constructed for ingestion on a remote store via AddSSTable).
@@ -246,7 +237,7 @@ var defaultCompressionAlgorithm = func() CompressionAlgorithm {
246237
var CompressionAlgorithmStorage = RegisterCompressionAlgorithmClusterSetting(
247238
"storage.sstable.compression_algorithm",
248239
`determines the compression algorithm to use when compressing sstable data blocks for use in a Pebble store;`,
249-
defaultCompressionAlgorithm,
240+
CompressionAlgorithmFastest,
250241
)
251242

252243
// CompressionAlgorithmBackupStorage determines the compression algorithm used
@@ -256,7 +247,7 @@ var CompressionAlgorithmStorage = RegisterCompressionAlgorithmClusterSetting(
256247
var CompressionAlgorithmBackupStorage = RegisterCompressionAlgorithmClusterSetting(
257248
"storage.sstable.compression_algorithm_backup_storage",
258249
`determines the compression algorithm to use when compressing sstable data blocks for backup row data storage;`,
259-
defaultCompressionAlgorithm,
250+
CompressionAlgorithmFastest,
260251
)
261252

262253
// CompressionAlgorithmBackupTransport determines the compression algorithm used
@@ -269,7 +260,7 @@ var CompressionAlgorithmBackupStorage = RegisterCompressionAlgorithmClusterSetti
269260
var CompressionAlgorithmBackupTransport = RegisterCompressionAlgorithmClusterSetting(
270261
"storage.sstable.compression_algorithm_backup_transport",
271262
`determines the compression algorithm to use when compressing sstable data blocks for backup transport;`,
272-
defaultCompressionAlgorithm,
263+
CompressionAlgorithmFastest,
273264
)
274265

275266
func getCompressionProfile(
@@ -286,6 +277,8 @@ func getCompressionProfile(
286277
return pebble.NoCompression
287278
case CompressionAlgorithmMinLZ:
288279
return pebble.MinLZCompression
280+
case CompressionAlgorithmFastest:
281+
return pebble.FastestCompression
289282
default:
290283
return pebble.DefaultCompression
291284
}

0 commit comments

Comments
 (0)