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

Add latency numbers to increment tool #3422

Merged
merged 3 commits into from
May 16, 2019
Merged

Conversation

animesh2049
Copy link
Contributor

@animesh2049 animesh2049 commented May 15, 2019

Add query, mutation and total txn latency numbers to increment tool.
Set CommitNow to be true in mutation.


This change is Reviewable

@animesh2049 animesh2049 requested review from manishrjain and a team as code owners May 15, 2019 12:18
dgraph/cmd/counter/increment.go Outdated Show resolved Hide resolved
dgraph/cmd/counter/increment.go Outdated Show resolved Hide resolved
dgraph/cmd/counter/increment.go Outdated Show resolved Hide resolved
@animesh2049 animesh2049 force-pushed the animesh2049/increment_tool branch from ce22694 to 633140c Compare May 15, 2019 12:40
Copy link
Member

@mangalaman93 mangalaman93 left a comment

Choose a reason for hiding this comment

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

Get another approval before you merge. LGTM

@animesh2049
Copy link
Contributor Author

animesh2049 commented May 15, 2019

Sample output

animesh@workstation:~/go/src/github.com/dgraph-io/dgraph/dgraph$ ./dgraph increment --alpha 127.0.0.1:9080 --pred=counter.val.healthcheck
Query latency: 12.328646ms
Mutation latency: 15.267391ms
0515 12:33:19.082 Counter VAL: 84   [ Ts: 10159 ]
Total txn latency is: 29.289451ms

Add query, mutation and total txn latency numbers to increment tool.
Set `CommitNow` to be true in mutation.
@animesh2049 animesh2049 force-pushed the animesh2049/increment_tool branch from 633140c to b894fec Compare May 15, 2019 13:09
@animesh2049
Copy link
Contributor Author

animesh@workstation:~/go/src/github.com/dgraph-io/dgraph/dgraph$ ./dgraph increment --alpha 127.0.0.1:9080 --pred=counter.val.healthcheck --num=10
Query latency: 3.323626ms
Mutation latency: 14.69912ms
0515 12:54:04.699 Counter VAL: 95   [ Ts: 10181 ]
Query latency: 16.204665ms
Mutation latency: 15.557931ms
0515 12:54:04.732 Counter VAL: 96   [ Ts: 10183 ]
Query latency: 16.045075ms
Mutation latency: 15.72075ms
0515 12:54:04.764 Counter VAL: 97   [ Ts: 10185 ]
Query latency: 16.251635ms
Mutation latency: 15.58223ms
0515 12:54:04.797 Counter VAL: 98   [ Ts: 10187 ]
Query latency: 16.173984ms
Mutation latency: 15.570271ms
0515 12:54:04.829 Counter VAL: 99   [ Ts: 10189 ]
Query latency: 16.903767ms
Mutation latency: 14.962927ms
0515 12:54:04.862 Counter VAL: 100   [ Ts: 10191 ]
Query latency: 14.745019ms
Mutation latency: 15.479122ms
0515 12:54:04.894 Counter VAL: 101   [ Ts: 10193 ]
Query latency: 16.296664ms
Mutation latency: 15.51334ms
0515 12:54:04.927 Counter VAL: 102   [ Ts: 10195 ]
Query latency: 16.483921ms
Mutation latency: 15.268494ms
0515 12:54:04.959 Counter VAL: 103   [ Ts: 10197 ]
Query latency: 16.359744ms
Mutation latency: 15.5736ms
0515 12:54:04.992 Counter VAL: 104   [ Ts: 10199 ]
Total txn latency is: 312.788034ms

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

0515 12:54:04.699 Counter VAL: 95 [ Ts: 10181 ] [ 16ms 14ms 30ms ]
Total: 312ms

Reviewable status: 0 of 1 files reviewed, 3 unresolved discussions (waiting on @animesh2049 and @manishrjain)

@animesh2049
Copy link
Contributor Author

Output after changing format.

animesh@workstation:~/go/src/github.com/dgraph-io/dgraph/dgraph$ ./dgraph increment --alpha 127.0.0.1:9080 --pred=counter.val.healthcheck --num=1
0516 08:20:30.571 Counter VAL: 250   [ Ts: 10491 ][ 4ms 14ms 20ms ]
Total: 21ms
animesh@workstation:~/go/src/github.com/dgraph-io/dgraph/dgraph$ ./dgraph increment --alpha 127.0.0.1:9080 --pred=counter.val.healthcheck --num=10
0516 08:20:48.18  Counter VAL: 251   [ Ts: 10493 ][ 5ms 14ms 20ms ]
0516 08:20:48.213 Counter VAL: 252   [ Ts: 10495 ][ 16ms 15ms 32ms ]
0516 08:20:48.245 Counter VAL: 253   [ Ts: 10497 ][ 16ms 14ms 32ms ]
0516 08:20:48.278 Counter VAL: 254   [ Ts: 10499 ][ 16ms 14ms 32ms ]
0516 08:20:48.31  Counter VAL: 255   [ Ts: 10501 ][ 16ms 15ms 32ms ]
0516 08:20:48.343 Counter VAL: 256   [ Ts: 10503 ][ 16ms 14ms 32ms ]
0516 08:20:48.376 Counter VAL: 257   [ Ts: 10505 ][ 16ms 14ms 32ms ]
0516 08:20:48.408 Counter VAL: 258   [ Ts: 10507 ][ 16ms 14ms 32ms ]
0516 08:20:48.44  Counter VAL: 259   [ Ts: 10509 ][ 17ms 14ms 32ms ]
0516 08:20:48.473 Counter VAL: 260   [ Ts: 10511 ][ 16ms 14ms 32ms ]
Total: 314ms

@animesh2049 animesh2049 force-pushed the animesh2049/increment_tool branch 2 times, most recently from 25c70c6 to f963386 Compare May 16, 2019 08:43
Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

Got a few comments. Address those, get @mangalaman93 to review it again and merge it.

Reviewed 1 of 1 files at r3.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @animesh2049)


dgraph/cmd/counter/increment.go, line 67 at r3 (raw file):

	Val int    `json:"val"`

	startTs uint64 // Only used for internal testing.

query time.Duration
mutation time.Duration


dgraph/cmd/counter/increment.go, line 100 at r3 (raw file):

}

func process(dg *dgo.Dgraph, conf *viper.Viper) (Counter, uint64, uint64, error) {

Instead of returning 4 results, you could add the latency numbers to Counter struct as private vars.


dgraph/cmd/counter/increment.go, line 181 at r3 (raw file):

		}
		fmt.Printf("%-17s Counter VAL: %d   [ Ts: %d ][ ", now, cnt.Val, cnt.startTs)
		fmt.Println(time.Duration(qLatency).Truncate(time.Millisecond)*time.Nanosecond,

I'm not sure about the point of doing *time.Nanosecond. That is unnecessary.

Also, instead of using duration.Truncate, use duration.Round everywhere.

The final number should be the sum of query and mutation latency, technically speaking.

@animesh2049 animesh2049 force-pushed the animesh2049/increment_tool branch from f963386 to 7ba4283 Compare May 16, 2019 11:59
Query, Mutation, Total latency are now printed
in single line.They are space separated and
are in same order as mentioned here.
@animesh2049 animesh2049 force-pushed the animesh2049/increment_tool branch from 7ba4283 to ca59e91 Compare May 16, 2019 19:23
@animesh2049
Copy link
Contributor Author

Results after further modifications

animesh@workstation:~/go/src/github.com/dgraph-io/dgraph/dgraph$ ./dgraph increment --alpha 127.0.0.1:9080 --pred=counter.val.healthcheck
0516 07:25:06.977 Counter VAL: 401   [ Ts: 50041 ][ 13ms 12ms 25ms 29ms ]
Total: 31ms
animesh@workstation:~/go/src/github.com/dgraph-io/dgraph/dgraph$ ./dgraph increment --alpha 127.0.0.1:9080 --pred=counter.val.healthcheck --num=10
0516 07:25:09.025 Counter VAL: 402   [ Ts: 50043 ][ 13ms 12ms 25ms 29ms ]
0516 07:25:09.061 Counter VAL: 403   [ Ts: 50045 ][ 21ms 12ms 33ms 35ms ]
0516 07:25:09.102 Counter VAL: 404   [ Ts: 50047 ][ 19ms 12ms 31ms 41ms ]
0516 07:25:09.137 Counter VAL: 405   [ Ts: 50049 ][ 21ms 12ms 33ms 35ms ]
0516 07:25:09.189 Counter VAL: 406   [ Ts: 50051 ][ 27ms 22ms 49ms 52ms ]
0516 07:25:09.222 Counter VAL: 407   [ Ts: 50053 ][ 19ms 12ms 31ms 33ms ]
0516 07:25:09.258 Counter VAL: 408   [ Ts: 50055 ][ 21ms 12ms 33ms 36ms ]
0516 07:25:09.294 Counter VAL: 409   [ Ts: 50057 ][ 21ms 12ms 32ms 36ms ]
0516 07:25:09.329 Counter VAL: 410   [ Ts: 50059 ][ 21ms 12ms 33ms 35ms ]
0516 07:25:09.364 Counter VAL: 411   [ Ts: 50061 ][ 21ms 12ms 33ms 36ms ]
Total: 369ms

Copy link
Contributor

@manishrjain manishrjain left a comment

Choose a reason for hiding this comment

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

:lgtm: Made some changes. Merging it now.

Reviewable status: 0 of 1 files reviewed, 6 unresolved discussions (waiting on @animesh2049 and @manishrjain)

@manishrjain manishrjain merged commit d9dd558 into master May 16, 2019
@manishrjain manishrjain deleted the animesh2049/increment_tool branch May 16, 2019 20:53
dna2github pushed a commit to dna2fork/dgraph that referenced this pull request Jul 19, 2019
Add query, mutation and server-side, client-side and difference between the two txn latency numbers to increment tool.

Set CommitNow to be true in mutation.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

3 participants