Skip to content
This repository has been archived by the owner on Nov 24, 2023. It is now read-only.

debug-tools: Binlog event blackhole #235

Merged
merged 15 commits into from
Nov 19, 2019

Conversation

csuzhangxc
Copy link
Member

What problem does this PR solve?

add a binlog-event-blackhole tool to test the speed of fetching binlog event.

What is changed and how it works?

add a binlog-event-blackhole tool.

Check List

Tests

  • Manual test (add detailed scripts or steps below)
    • run binlog-event-blackhole tool with different args

for more information, see README.md under the binlog-event-blackhole folder.

@csuzhangxc csuzhangxc added priority/normal Minor change, requires approval from ≥1 primary reviewer type/qa relate to quality assurance status/PTAL This PR is ready for review. Add this label back after committing new changes labels Aug 12, 2019
@codecov
Copy link

codecov bot commented Aug 15, 2019

Codecov Report

Merging #235 into master will not change coverage.
The diff coverage is n/a.

@@             Coverage Diff             @@
##             master       #235   +/-   ##
===========================================
  Coverage   57.4825%   57.4825%           
===========================================
  Files           160        160           
  Lines         16191      16191           
===========================================
  Hits           9307       9307           
  Misses         5970       5970           
  Partials        914        914

When exiting, the result will be output to the log as following

```log
[2019/08/12 15:44:19.269 +08:00] [INFO] [main.go:95] ["binlog-event-blackhole exit"] [event-count=35] [byte-count=2360] [duration=705.627314ms] [tps=49.601254522865595] ["speed (byte/s)"=3344.541733541794]
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
[2019/08/12 15:44:19.269 +08:00] [INFO] [main.go:95] ["binlog-event-blackhole exit"] [event-count=35] [byte-count=2360] [duration=705.627314ms] [tps=49.601254522865595] ["speed (byte/s)"=3344.541733541794]
[2019/08/12 15:44:19.269 +08:00] [INFO] [main.go:95] ["binlog-event-blackhole exit"] [event-count=35] [byte-count=2360] [duration=705.627314ms] [tps=49.601254522865595] ["throughput (byte/s)"=3344.541733541794]

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 50c2b56

| byte-count | The total bytes have received from the upstream master |
| duration | The duration has be taken to fetch binlog events |
| tps | The events have received per second |
| speed | The speed of fetching binlog event data (bytes/second) |
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
| speed | The speed of fetching binlog event data (bytes/second) |
| throughput | The throughput of fetching binlog event data (bytes/second) |

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 50c2b56

}

// readEventsWithGoMySQL reads binlog events from the master server with `go-mysql` pkg.
func readEventsWithGoMySQL(ctx context.Context, conn *client.Conn) (uint64, uint64, time.Duration, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

the differences with readEventsWithoutGoMySQL is the "github.com/siddontang/go-mysql/client".Conn use a buffer, I originally thought that it also contains more logic, such as decoding/parsing.

Let's do this now, you can add the complete go-mysql logic later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeh. after doing some benchmark later, I think more (fine-grained) things we can do.

speed := float64(byteCount) / duration.Seconds()
log.L().Info("binlog-event-blackhole exit",
zap.Uint64("event-count", eventCount), zap.Uint64("byte-count", byteCount),
zap.Duration("duration", duration), zap.Float64("tps", tps), zap.Float64("speed (byte/s)", speed))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
zap.Duration("duration", duration), zap.Float64("tps", tps), zap.Float64("speed (byte/s)", speed))
zap.Duration("duration", duration), zap.Float64("tps", tps), zap.Float64("throughput (byte/s)", speed))

Copy link
Member Author

Choose a reason for hiding this comment

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

addressed in 50c2b56.

@IANTHEREAL
Copy link
Collaborator

Rest LGTM

@csuzhangxc
Copy link
Member Author

/run-all-tests tidb=release-3.0

@csuzhangxc
Copy link
Member Author

/run-all-tests tidb=release-3.0

Copy link
Collaborator

@IANTHEREAL IANTHEREAL left a comment

Choose a reason for hiding this comment

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

LGTM

@IANTHEREAL IANTHEREAL added status/LGT1 One reviewer already commented LGTM and removed status/PTAL This PR is ready for review. Add this label back after committing new changes labels Nov 19, 2019
@IANTHEREAL
Copy link
Collaborator

/run-all-tests tidb=release-3.0

@csuzhangxc
Copy link
Member Author

/run-all-tests tidb=release-3.0

1 similar comment
@csuzhangxc
Copy link
Member Author

/run-all-tests tidb=release-3.0

@csuzhangxc csuzhangxc merged commit e37b039 into pingcap:master Nov 19, 2019
@csuzhangxc csuzhangxc deleted the binlog-event-blackhole branch November 19, 2019 10:02
lichunzhu pushed a commit to lichunzhu/dm that referenced this pull request Apr 6, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
priority/normal Minor change, requires approval from ≥1 primary reviewer status/LGT1 One reviewer already commented LGTM type/qa relate to quality assurance
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants