Skip to content

vttablet: benchmarks and two small optimizations#7560

Merged
systay merged 3 commits intovitessio:masterfrom
vmg:vmg/tablet-opt-1
Mar 1, 2021
Merged

vttablet: benchmarks and two small optimizations#7560
systay merged 3 commits intovitessio:masterfrom
vmg:vmg/tablet-opt-1

Conversation

@vmg
Copy link
Copy Markdown
Collaborator

@vmg vmg commented Feb 26, 2021

Description

This is a small benchmark suite for vttablet queries which I've started running to find hotspots.

So far, I found two fixes that are trivial and give a measurable improvement in the flame graphs. vstreamer is hot!

Related Issue(s)

Checklist

  • Should this PR be backported?
  • Tests were added or are not required
  • Documentation was added or is not required

Deployment Notes

Impacted Areas in Vitess

Components that this PR will affect:

  • Query Serving
  • VReplication
  • Cluster Management
  • Build/CI
  • VTAdmin

vmg added 3 commits February 26, 2021 17:31
Signed-off-by: Vicent Marti <vmg@strn.cat>
Calling `cp.MysqlParams` once per event is really wasteful because it
must prepare a Parameters struct including all the authentication
credentials for the connection. We only need the active database name
to process the event, so ask just for that.

Signed-off-by: Vicent Marti <vmg@strn.cat>
There is a bad merge in this code that is causing `ReloadAt` to be
called two times in a row. Previously, the schema was _always_ being
reloaded when parsing a DDL statement. @sougou changed this so the
schema only reloads when the statement must be sent upstream, but then
Rohit brought back the functionality of _always_ reloading the DDL
without removing the case where we were already reloading for sent
statements.

Signed-off-by: Vicent Marti <vmg@strn.cat>
// Reload schema only if the DDL change is relevant.
// TODO(sougou): move this back to always load after
// the schema reload bug is fixed.
vs.se.ReloadAt(context.Background(), vs.pos)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

@sougou can you please verify that it is safe to remove this duplicated call? See 6e40b88 for details

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

@vmg, yes this can be removed. I thought I had already removed the duplication, thanks for catching this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice catch! The call should be removed.

@@ -481,7 +472,7 @@ func (vs *vstreamer) parseEvent(ev mysql.BinlogEvent) ([]*binlogdatapb.VEvent, e
}
vs.se.ReloadAt(context.Background(), vs.pos)
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Note that the call is duplicated here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants