Skip to content

Commit

Permalink
kv/bulk: add low priority admission header to bulk SSTs
Browse files Browse the repository at this point in the history
Release note (performance improvement): Bulk ingestion writes now use a lower priority for admission control.
  • Loading branch information
dt committed Mar 31, 2022
1 parent 856f750 commit 05cb78a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions pkg/kv/bulk/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ go_library(
"//pkg/settings/cluster",
"//pkg/storage",
"//pkg/storage/enginepb",
"//pkg/util/admission",
"//pkg/util/hlc",
"//pkg/util/humanizeutil",
"//pkg/util/log",
Expand Down
12 changes: 10 additions & 2 deletions pkg/kv/bulk/sst_batcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import (
"github.com/cockroachdb/cockroach/pkg/settings/cluster"
"github.com/cockroachdb/cockroach/pkg/storage"
"github.com/cockroachdb/cockroach/pkg/storage/enginepb"
"github.com/cockroachdb/cockroach/pkg/util/admission"
"github.com/cockroachdb/cockroach/pkg/util/hlc"
"github.com/cockroachdb/cockroach/pkg/util/humanizeutil"
"github.com/cockroachdb/cockroach/pkg/util/log"
Expand Down Expand Up @@ -552,9 +553,16 @@ func (b *SSTBatcher) addSSTable(
req.SSTTimestampToRequestTimestamp = b.batchTS
}

ba := roachpb.BatchRequest{Header: roachpb.Header{Timestamp: b.batchTS}}
ba := roachpb.BatchRequest{
Header: roachpb.Header{Timestamp: b.batchTS},
AdmissionHeader: roachpb.AdmissionHeader{
Priority: int32(admission.BulkNormalPri),
CreateTime: timeutil.Now().UnixNano(),
Source: roachpb.AdmissionHeader_FROM_SQL,
NoMemoryReservedAtSource: true,
},
}
ba.Add(req)

beforeSend := timeutil.Now()
br, pErr := b.db.NonTransactionalSender().Send(ctx, ba)
sendTime := timeutil.Since(beforeSend)
Expand Down

0 comments on commit 05cb78a

Please sign in to comment.