xgrommx
Repos
764
Followers
511
Following
75

Events

pull request opened
PMM-4511: Improve SlowLog `parseHeader` performance.

Looks like this was an old issue and now performance better. But this PR make parseHeader more faster.

Here benchmark between two version old and new.

Before:

goos: darwin
goarch: amd64
pkg: github.com/percona/pmm/agent/agents/mysql/slowlog/parser
cpu: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
BenchmarkParser
BenchmarkParser/testdata/fuzz-empty-admin.log
BenchmarkParser/testdata/fuzz-empty-admin.log-8         	  115218	     46409 ns/op	  12.99 MB/s	    6339 B/op	     103 allocs/op
BenchmarkParser/testdata/slow000.log
BenchmarkParser/testdata/slow000.log-8                  	  597702	      9980 ns/op	      16 B/op	       1 allocs/op
BenchmarkParser/testdata/slow001.log
BenchmarkParser/testdata/slow001.log-8                  	  161511	     36304 ns/op	  14.43 MB/s	    4666 B/op	      84 allocs/op
BenchmarkParser/testdata/slow002.log
BenchmarkParser/testdata/slow002.log-8                  	   26514	    226345 ns/op	  16.97 MB/s	   44824 B/op	     741 allocs/op
BenchmarkParser/testdata/slow003.log
BenchmarkParser/testdata/slow003.log-8                  	  156975	     38873 ns/op	   8.70 MB/s	    4301 B/op	      68 allocs/op
BenchmarkParser/testdata/slow004.log
BenchmarkParser/testdata/slow004.log-8                  	  233133	     25760 ns/op	  14.95 MB/s	    2514 B/op	      42 allocs/op
BenchmarkParser/testdata/slow005.log
BenchmarkParser/testdata/slow005.log-8                  	  145208	     40448 ns/op	   8.88 MB/s	    4531 B/op	      79 allocs/op
BenchmarkParser/testdata/slow006.log
BenchmarkParser/testdata/slow006.log-8                  	   36901	    158721 ns/op	  13.86 MB/s	   25972 B/op	     420 allocs/op
BenchmarkParser/testdata/slow007.log
BenchmarkParser/testdata/slow007.log-8                  	  209241	     28450 ns/op	   6.78 MB/s	    2689 B/op	      42 allocs/op
BenchmarkParser/testdata/slow008.log
BenchmarkParser/testdata/slow008.log-8                  	  101116	     59386 ns/op	  11.05 MB/s	    7958 B/op	     126 allocs/op
BenchmarkParser/testdata/slow009.log
BenchmarkParser/testdata/slow009.log-8                  	  102446	     58853 ns/op	  15.31 MB/s	    9661 B/op	     153 allocs/op
BenchmarkParser/testdata/slow010.log
BenchmarkParser/testdata/slow010.log-8                  	   18129	    332522 ns/op	  15.27 MB/s	   67820 B/op	    1003 allocs/op
BenchmarkParser/testdata/slow011.log
BenchmarkParser/testdata/slow011.log-8                  	   43632	    137572 ns/op	  15.64 MB/s	   28431 B/op	     400 allocs/op
BenchmarkParser/testdata/slow012.log
BenchmarkParser/testdata/slow012.log-8                  	  128665	     47020 ns/op	  12.95 MB/s	    6455 B/op	     104 allocs/op
BenchmarkParser/testdata/slow013.log
BenchmarkParser/testdata/slow013.log-8                  	   48313	    125893 ns/op	  58.54 MB/s	   28396 B/op	     604 allocs/op
BenchmarkParser/testdata/slow014.log
BenchmarkParser/testdata/slow014.log-8                  	   30163	    202639 ns/op	  21.76 MB/s	   55572 B/op	     695 allocs/op
BenchmarkParser/testdata/slow015.log
BenchmarkParser/testdata/slow015.log-8                  	   41414	    145480 ns/op	 564.21 MB/s	  256083 B/op	     120 allocs/op
BenchmarkParser/testdata/slow016.log
BenchmarkParser/testdata/slow016.log-8                  	  149176	     39357 ns/op	  10.49 MB/s	    4574 B/op	      71 allocs/op
BenchmarkParser/testdata/slow017.log
BenchmarkParser/testdata/slow017.log-8                  	  202624	     30199 ns/op	   9.27 MB/s	    2957 B/op	      46 allocs/op
BenchmarkParser/testdata/slow018.log
BenchmarkParser/testdata/slow018.log-8                  	   66895	     90334 ns/op	  14.42 MB/s	   15307 B/op	     236 allocs/op
BenchmarkParser/testdata/slow019.log
BenchmarkParser/testdata/slow019.log-8                  	   38694	    155588 ns/op	  16.85 MB/s	   27893 B/op	     418 allocs/op
BenchmarkParser/testdata/slow020.log
BenchmarkParser/testdata/slow020.log-8                  	  166784	     36111 ns/op	  14.04 MB/s	    4678 B/op	      80 allocs/op
BenchmarkParser/testdata/slow021.log
BenchmarkParser/testdata/slow021.log-8                  	  223562	     26884 ns/op	  13.32 MB/s	    2585 B/op	      46 allocs/op
BenchmarkParser/testdata/slow022.log
BenchmarkParser/testdata/slow022.log-8                  	  219540	     26560 ns/op	  13.55 MB/s	    2592 B/op	      46 allocs/op
BenchmarkParser/testdata/slow023.log
BenchmarkParser/testdata/slow023.log-8                  	   65918	     92688 ns/op	  19.60 MB/s	   17217 B/op	     276 allocs/op
BenchmarkParser/testdata/slow024.log
BenchmarkParser/testdata/slow024.log-8                  	  128323	     44919 ns/op	  14.34 MB/s	    6648 B/op	     119 allocs/op
BenchmarkParser/testdata/slow025.log
BenchmarkParser/testdata/slow025.log-8                  	  113497	     52835 ns/op	  11.60 MB/s	    7968 B/op	     123 allocs/op
BenchmarkParser/testdata/slow026.log
BenchmarkParser/testdata/slow026.log-8                  	  132860	     45638 ns/op	  10.15 MB/s	    5963 B/op	      89 allocs/op
BenchmarkParser/testdata/slow027.log
BenchmarkParser/testdata/slow027.log-8                  	    9339	    646897 ns/op	  63.37 MB/s	 2268287 B/op	     588 allocs/op
BenchmarkParser/testdata/slow028.log
BenchmarkParser/testdata/slow028.log-8                  	  175857	     34497 ns/op	  18.26 MB/s	    4228 B/op	      81 allocs/op
PASS

After:

goos: darwin
goarch: amd64
pkg: github.com/percona/pmm/agent/agents/mysql/slowlog/parser
cpu: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
BenchmarkParser
BenchmarkParser/testdata/fuzz-empty-admin.log
BenchmarkParser/testdata/fuzz-empty-admin.log-8         	  112699	     45723 ns/op	  13.19 MB/s	    5378 B/op	      94 allocs/op
BenchmarkParser/testdata/slow000.log
BenchmarkParser/testdata/slow000.log-8                  	  936429	      5836 ns/op	      16 B/op	       1 allocs/op
BenchmarkParser/testdata/slow001.log
BenchmarkParser/testdata/slow001.log-8                  	  197604	     30349 ns/op	  17.27 MB/s	    4008 B/op	      78 allocs/op
BenchmarkParser/testdata/slow002.log
BenchmarkParser/testdata/slow002.log-8                  	   45279	    132425 ns/op	  29.00 MB/s	   31286 B/op	     651 allocs/op
BenchmarkParser/testdata/slow003.log
BenchmarkParser/testdata/slow003.log-8                  	  214576	     28379 ns/op	  11.91 MB/s	    3110 B/op	      59 allocs/op
BenchmarkParser/testdata/slow004.log
BenchmarkParser/testdata/slow004.log-8                  	  263310	     22852 ns/op	  16.85 MB/s	    2212 B/op	      39 allocs/op
BenchmarkParser/testdata/slow005.log
BenchmarkParser/testdata/slow005.log-8                  	  206056	     29077 ns/op	  12.35 MB/s	    3328 B/op	      70 allocs/op
BenchmarkParser/testdata/slow006.log
BenchmarkParser/testdata/slow006.log-8                  	   65845	     90073 ns/op	  24.42 MB/s	   18736 B/op	     362 allocs/op
BenchmarkParser/testdata/slow007.log
BenchmarkParser/testdata/slow007.log-8                  	  248540	     24682 ns/op	   7.82 MB/s	    2085 B/op	      38 allocs/op
BenchmarkParser/testdata/slow008.log
BenchmarkParser/testdata/slow008.log-8                  	  159001	     37739 ns/op	  17.38 MB/s	    6109 B/op	     114 allocs/op
BenchmarkParser/testdata/slow009.log
BenchmarkParser/testdata/slow009.log-8                  	  144801	     41398 ns/op	  21.76 MB/s	    7002 B/op	     129 allocs/op
BenchmarkParser/testdata/slow010.log
BenchmarkParser/testdata/slow010.log-8                  	   26155	    230356 ns/op	  22.04 MB/s	   57079 B/op	     931 allocs/op
BenchmarkParser/testdata/slow011.log
BenchmarkParser/testdata/slow011.log-8                  	   73879	     81054 ns/op	  26.55 MB/s	   20116 B/op	     343 allocs/op
BenchmarkParser/testdata/slow012.log
BenchmarkParser/testdata/slow012.log-8                  	  144645	     38566 ns/op	  15.79 MB/s	    5439 B/op	      95 allocs/op
BenchmarkParser/testdata/slow013.log
BenchmarkParser/testdata/slow013.log-8                  	   61378	     97203 ns/op	  75.82 MB/s	   23933 B/op	     576 allocs/op
BenchmarkParser/testdata/slow014.log
BenchmarkParser/testdata/slow014.log-8                  	   47547	    126549 ns/op	  34.85 MB/s	   45425 B/op	     615 allocs/op
BenchmarkParser/testdata/slow015.log
BenchmarkParser/testdata/slow015.log-8                  	   44960	    133631 ns/op	 614.24 MB/s	  254948 B/op	     104 allocs/op
BenchmarkParser/testdata/slow016.log
BenchmarkParser/testdata/slow016.log-8                  	  207622	     29010 ns/op	  14.24 MB/s	    3718 B/op	      65 allocs/op
BenchmarkParser/testdata/slow017.log
BenchmarkParser/testdata/slow017.log-8                  	  240886	     24973 ns/op	  11.21 MB/s	    2417 B/op	      42 allocs/op
BenchmarkParser/testdata/slow018.log
BenchmarkParser/testdata/slow018.log-8                  	  117916	     51454 ns/op	  25.32 MB/s	   11454 B/op	     200 allocs/op
BenchmarkParser/testdata/slow019.log
BenchmarkParser/testdata/slow019.log-8                  	   65125	     91629 ns/op	  28.60 MB/s	   21112 B/op	     351 allocs/op
BenchmarkParser/testdata/slow020.log
BenchmarkParser/testdata/slow020.log-8                  	  198421	     29713 ns/op	  17.06 MB/s	    3961 B/op	      74 allocs/op
BenchmarkParser/testdata/slow021.log
BenchmarkParser/testdata/slow021.log-8                  	  253323	     23461 ns/op	  15.26 MB/s	    2283 B/op	      43 allocs/op
BenchmarkParser/testdata/slow022.log
BenchmarkParser/testdata/slow022.log-8                  	  250813	     23413 ns/op	  15.38 MB/s	    2293 B/op	      43 allocs/op
BenchmarkParser/testdata/slow023.log
BenchmarkParser/testdata/slow023.log-8                  	   91159	     63923 ns/op	  28.42 MB/s	   14391 B/op	     252 allocs/op
BenchmarkParser/testdata/slow024.log
BenchmarkParser/testdata/slow024.log-8                  	  170166	     35178 ns/op	  18.31 MB/s	    5636 B/op	     110 allocs/op
BenchmarkParser/testdata/slow025.log
BenchmarkParser/testdata/slow025.log-8                  	  152197	     39262 ns/op	  15.61 MB/s	    6159 B/op	     111 allocs/op
BenchmarkParser/testdata/slow026.log
BenchmarkParser/testdata/slow026.log-8                  	  176764	     33877 ns/op	  13.67 MB/s	    4392 B/op	      74 allocs/op
BenchmarkParser/testdata/slow027.log
BenchmarkParser/testdata/slow027.log-8                  	    8964	    625817 ns/op	  65.50 MB/s	 2266174 B/op	     573 allocs/op
BenchmarkParser/testdata/slow028.log
BenchmarkParser/testdata/slow028.log-8                  	  210342	     28363 ns/op	  22.21 MB/s	    3443 B/op	      78 allocs/op
PASS
Created at 1 week ago
create branch
xgrommx create branch PMM-4511-improve-slow-log-parse-header-performance
Created at 1 week ago
Created at 1 week ago
Created at 1 week ago
Created at 2 weeks ago
Created at 2 weeks ago
Created at 2 weeks ago
Created at 3 weeks ago
started
Created at 1 month ago
Created at 1 month ago