Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[dbnode] Use already encoded tags when writing time series to commit log #1898

Merged
merged 18 commits into from
Aug 21, 2019

Conversation

robskillington
Copy link
Collaborator

@robskillington robskillington commented Aug 20, 2019

What this PR does / why we need it:

This improves raw commit log write speed by using the encoded tags from the RPC batch rather than encoding from the newly created series tags. This is achieved by extending the lifetime of the tags from the RPC write request.

It also adds the ability to set in the pooling config a value for thriftBytesPoolAllocSize which can adjust from the default 1024 value a higher or lower to provided pooled bytes to thrift binary fields. This enables tweaking for workloads with a lot of tags, in the future this should hopefully be more adaptive.

Special notes for your reviewer:

Does this PR introduce a user-facing and/or backwards incompatible change?:

NONE

Does this PR require updating code package or user-facing documentation?:

NONE

Copy link
Contributor

@richardartoul richardartoul left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM minus the nits

@@ -28,7 +28,7 @@ import:
version: ^0.8

- package: github.com/apache/thrift
version: 0.9.3-pool-read-binary-2
version: 0.9.3-pool-read-binary-3
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we just merge this into master of our branch? Pretty confusing that we're pinned to a branch

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not opposed to it, problem is master is way ahead of where we are at, so we'd have to reset master all the way back to 0.9.3 on our fork which would be weird...

@@ -252,6 +253,9 @@ type PoolingPolicy struct {
// The initial alloc size for a block.
BlockAllocSize *int `yaml:"blockAllocSize"`

// The thrift bytes pool max bytes slice allocation for a single binary field.
ThriftBytesPoolMaxAllocSize *int `yaml:"thriftBytesPoolMaxAllocSize"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not really a max is it right? its always this size?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The capacity is always this size, but the actual length/size is determined by the length of the bytes being copied.

Since we suffix it with "Alloc" I'm not opposed to just calling it AllocSize and dropping the Max.

@@ -1764,7 +1769,11 @@ func (r *writeBatchPooledReq) Finalize() {
if r.writeTaggedReq != nil {
for _, elem := range r.writeTaggedReq.Elements {
apachethrift.BytesPoolPut(elem.ID)
apachethrift.BytesPoolPut(elem.EncodedTags)
// Ownership of the encoded tagts has been transferred to the BatchWriter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tags -> tags

@@ -72,9 +76,13 @@ type Series struct {
// ID is the series identifier.
ID ident.ID

// Tags are the series tags.
// Tags is the series tags.
Tags ident.Tags
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this still used anywhere?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it's used on the read side and it was going to be very difficult to remove unfortunately.

"time"

"github.com/m3db/m3/src/x/ident"
xtime "github.com/m3db/m3/src/x/time"
)

var (
errTagsAndEncodedTagsRequired = errors.New("tags iterator and encoded tags required to be provided")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"required to be provided" sounds funny. Maybe: "must be provided"

@codecov
Copy link

codecov bot commented Aug 21, 2019

Codecov Report

Merging #1898 into master will increase coverage by 33.6%.
The diff coverage is 71.7%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #1898      +/-   ##
=========================================
+ Coverage    32.1%   65.7%   +33.6%     
=========================================
  Files           4     773     +769     
  Lines         342   71560   +71218     
=========================================
+ Hits          110   47081   +46971     
- Misses        222   20924   +20702     
- Partials       10    3555    +3545
Flag Coverage Δ
#aggregator 81% <ø> (?)
#cluster 85% <ø> (?)
#collector 54.9% <ø> (+22.8%) ⬆️
#dbnode 68% <71.7%> (?)
#m3em 62% <ø> (?)
#m3ninx 68.7% <ø> (?)
#m3nsch 28.4% <ø> (?)
#metrics 17.5% <ø> (?)
#msg 74.9% <ø> (?)
#query 70.7% <ø> (?)
#x 78.7% <ø> (?)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 57d533f...63c1bf2. Read the comment docs.

@robskillington robskillington merged commit 12ed1c2 into master Aug 21, 2019
@robskillington robskillington deleted the r/fast-encode-tags branch August 21, 2019 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants