Skip to content

Commit

Permalink
feat: Enable automatic stream sharding by default (#12451)
Browse files Browse the repository at this point in the history
Signed-off-by: Edward Welch <[email protected]>
  • Loading branch information
slim-bean authored Apr 3, 2024
1 parent 27606a3 commit 24f4e45
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions docs/sources/setup/upgrade/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,10 @@ This new metric will provide a more clear signal that there is an issue with ing
| `legacy-read-mode` | false | true | Deprecated. It will be removed in the next minor release. |
{{% /responsive-table %}}

#### Automatic stream sharding is enabled by default

Automatic stream sharding helps keep the write load of high volume streams balanced across ingesters and helps to avoid hot-spotting. Check out the [operations page](https://grafana.com/docs/loki/latest/operations/automatic-stream-sharding/) for more information

#### Write dedupe cache is deprecated
Write dedupe cache is deprecated because it not required by the newer single store indexes ([TSDB]({{< relref "../../operations/storage/tsdb" >}}) and [boltdb-shipper]({{< relref "../../operations/storage/boltdb-shipper" >}})).
If you using a [legacy index type]({{< relref "../../storage#index-storage" >}}), consider migrating to TSDB (recommended).
Expand Down
6 changes: 3 additions & 3 deletions pkg/distributor/shardstreams/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ type Config struct {
}

func (cfg *Config) RegisterFlagsWithPrefix(prefix string, fs *flag.FlagSet) {
fs.BoolVar(&cfg.Enabled, prefix+".enabled", false, "Automatically shard streams to keep them under the per-stream rate limit")
fs.BoolVar(&cfg.Enabled, prefix+".enabled", true, "Automatically shard streams to keep them under the per-stream rate limit")
fs.BoolVar(&cfg.LoggingEnabled, prefix+".logging-enabled", false, "Enable logging when sharding streams")
cfg.DesiredRate.Set("3mb") //nolint:errcheck
fs.Var(&cfg.DesiredRate, prefix+".desired-rate", "threshold used to cut a new shard. Default (3MB) means if a rate is above 3MB, it will be sharded.")
cfg.DesiredRate.Set("1536KB") //nolint:errcheck
fs.Var(&cfg.DesiredRate, prefix+".desired-rate", "threshold used to cut a new shard. Default (1536KB) means if a rate is above 1536KB/s, it will be sharded.")
}
4 changes: 2 additions & 2 deletions pkg/ingester/instance_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,8 @@ func TestStreamShardingUsage(t *testing.T) {
tenantShardStreamsCfg := limiter.limits.ShardStreams(customTenant1)

t.Run("test default configuration", func(t *testing.T) {
require.Equal(t, false, defaultShardStreamsCfg.Enabled)
require.Equal(t, "3MB", defaultShardStreamsCfg.DesiredRate.String())
require.Equal(t, true, defaultShardStreamsCfg.Enabled)
require.Equal(t, "1536KB", defaultShardStreamsCfg.DesiredRate.String())
require.Equal(t, false, defaultShardStreamsCfg.LoggingEnabled)
})

Expand Down

0 comments on commit 24f4e45

Please sign in to comment.