optiopay / kafka

Go driver for Kafka

Home Page:https://godoc.org/github.com/optiopay/kafka

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Tune performance in proto package

husio opened this issue · comments

There's a lot of memory allocation in proto package. Limiting memory allocation to minimum will give huge performance boost.

Publish before and after benchmarks.

8e1ce1c

Those are not the best benchmarks (test server influence the benchmark), but it's nice to see it's getting better:

benchmark                                     old ns/op     new ns/op     delta
BenchmarkConsumer_10Msgs-8                    22253         18684         -16.04%
BenchmarkConsumer_100Msgs-8                   12870         10537         -18.13%
BenchmarkConsumer_500Msgs-8                   7612          5891          -22.61%
BenchmarkConsumer_2000Msgs-8                  5667          4332          -23.56%
BenchmarkConsumer_10000Msgs-8                 5365          4119          -23.22%
BenchmarkConsumerConcurrent_8Consumers-8      5904          4341          -26.47%
BenchmarkConsumerConcurrent_32Consumers-8     7164          4663          -34.91%
BenchmarkConsumerConcurrent_64Consumers-8     7282          5452          -25.13%
BenchmarkProducer_1Msgs-8                     61896         58182         -6.00%
BenchmarkProducer_2Msgs-8                     75609         70525         -6.72%
BenchmarkProducer_10Msgs-8                    235018        230918        -1.74%
BenchmarkProducer_50Msgs-8                    1038969       1031797       -0.69%
BenchmarkProducer_200Msgs-8                   3640673       2919342       -19.81%
BenchmarkProducer_1000Msgs-8                  8555772       7418401       -13.29%

benchmark                                     old allocs     new allocs     delta
BenchmarkConsumer_10Msgs-8                    55             26             -52.73%
BenchmarkConsumer_100Msgs-8                   45             19             -57.78%
BenchmarkConsumer_500Msgs-8                   44             19             -56.82%
BenchmarkConsumer_2000Msgs-8                  44             19             -56.82%
BenchmarkConsumer_10000Msgs-8                 44             19             -56.82%
BenchmarkConsumerConcurrent_8Consumers-8      45             19             -57.78%
BenchmarkConsumerConcurrent_32Consumers-8     56             20             -64.29%
BenchmarkConsumerConcurrent_64Consumers-8     56             24             -57.14%
BenchmarkProducer_1Msgs-8                     141            70             -50.35%
BenchmarkProducer_2Msgs-8                     184            88             -52.17%
BenchmarkProducer_10Msgs-8                    525            229            -56.38%
BenchmarkProducer_50Msgs-8                    2214           917            -58.58%
BenchmarkProducer_200Msgs-8                   8523           3475           -59.23%
BenchmarkProducer_1000Msgs-8                  42134          17086          -59.45%

benchmark                                     old bytes     new bytes     delta
BenchmarkConsumer_10Msgs-8                    6725          5737          -14.69%
BenchmarkConsumer_100Msgs-8                   6332          5348          -15.54%
BenchmarkConsumer_500Msgs-8                   6281          5302          -15.59%
BenchmarkConsumer_2000Msgs-8                  6382          5404          -15.32%
BenchmarkConsumer_10000Msgs-8                 6372          5394          -15.35%
BenchmarkConsumerConcurrent_8Consumers-8      6595          5434          -17.60%
BenchmarkConsumerConcurrent_32Consumers-8     8585          6111          -28.82%
BenchmarkConsumerConcurrent_64Consumers-8     8524          7272          -14.69%
BenchmarkProducer_1Msgs-8                     12130         10911         -10.05%
BenchmarkProducer_2Msgs-8                     17074         14874         -12.89%
BenchmarkProducer_10Msgs-8                    62503         52475         -16.04%
BenchmarkProducer_50Msgs-8                    307696        258023        -16.14%
BenchmarkProducer_200Msgs-8                   1122216       925812        -17.50%
BenchmarkProducer_1000Msgs-8                  5895469       4916630       -16.60%

comparison of 6d618d8 and a2c0898

benchmark                                     old ns/op     new ns/op     delta
BenchmarkConsumer_10Msgs-8                    22212         17321         -22.02%
BenchmarkConsumer_100Msgs-8                   12448         8089          -35.02%
BenchmarkConsumer_500Msgs-8                   7603          4507          -40.72%
BenchmarkConsumer_2000Msgs-8                  5667          3334          -41.17%
BenchmarkConsumer_10000Msgs-8                 5360          3250          -39.37%
BenchmarkConsumerConcurrent_8Consumers-8      5891          3617          -38.60%
BenchmarkConsumerConcurrent_32Consumers-8     7166          4004          -44.13%
BenchmarkConsumerConcurrent_64Consumers-8     7247          4454          -38.54%
BenchmarkProducer_1Msgs-8                     62441         89560         +43.43%
BenchmarkProducer_2Msgs-8                     77050         102231        +32.68%
BenchmarkProducer_10Msgs-8                    234957        205019        -12.74%
BenchmarkProducer_50Msgs-8                    1102814       698816        -36.63%
BenchmarkProducer_200Msgs-8                   3588782       2110857       -41.18%
BenchmarkProducer_1000Msgs-8                  8769310       4907970       -44.03%
BenchmarkProduceRequestMarshal-8              3968625       336768        -91.51%
BenchmarkProduceResponseUnmarshal-8           4378          4501          +2.81%
BenchmarkFetchRequestMarshal-8                4578          2766          -39.58%
BenchmarkFetchResponseUnmarshal-8             371377        356101        -4.11%

benchmark                                     old allocs     new allocs     delta
BenchmarkConsumer_10Msgs-8                    55             17             -69.09%
BenchmarkConsumer_100Msgs-8                   45             10             -77.78%
BenchmarkConsumer_500Msgs-8                   44             10             -77.27%
BenchmarkConsumer_2000Msgs-8                  44             10             -77.27%
BenchmarkConsumer_10000Msgs-8                 44             10             -77.27%
BenchmarkConsumerConcurrent_8Consumers-8      45             10             -77.78%
BenchmarkConsumerConcurrent_32Consumers-8     56             10             -82.14%
BenchmarkConsumerConcurrent_64Consumers-8     56             12             -78.57%
BenchmarkProducer_1Msgs-8                     141            62             -56.03%
BenchmarkProducer_2Msgs-8                     184            71             -61.41%
BenchmarkProducer_10Msgs-8                    525            139            -73.52%
BenchmarkProducer_50Msgs-8                    2214           466            -78.95%
BenchmarkProducer_200Msgs-8                   8523           1672           -80.38%
BenchmarkProducer_1000Msgs-8                  42134          8082           -80.82%
BenchmarkProduceRequestMarshal-8              36066          324            -99.10%
BenchmarkProduceResponseUnmarshal-8           7              7              +0.00%
BenchmarkFetchRequestMarshal-8                45             20             -55.56%
BenchmarkFetchResponseUnmarshal-8             617            516            -16.37%

benchmark                                     old bytes     new bytes     delta
BenchmarkConsumer_10Msgs-8                    6725          6231          -7.35%
BenchmarkConsumer_100Msgs-8                   6332          4475          -29.33%
BenchmarkConsumer_500Msgs-8                   6281          4314          -31.32%
BenchmarkConsumer_2000Msgs-8                  6382          4398          -31.09%
BenchmarkConsumer_10000Msgs-8                 6372          4384          -31.20%
BenchmarkConsumerConcurrent_8Consumers-8      6595          4456          -32.43%
BenchmarkConsumerConcurrent_32Consumers-8     8585          5032          -41.39%
BenchmarkConsumerConcurrent_64Consumers-8     8524          5977          -29.88%
BenchmarkProducer_1Msgs-8                     12130         25010         +106.18%
BenchmarkProducer_2Msgs-8                     17075         27958         +63.74%
BenchmarkProducer_10Msgs-8                    62505         57437         -8.11%
BenchmarkProducer_50Msgs-8                    307708        222460        -27.70%
BenchmarkProducer_200Msgs-8                   1122200       735310        -34.48%
BenchmarkProducer_1000Msgs-8                  5895459       3916492       -33.57%
BenchmarkProduceRequestMarshal-8              3511831       174904        -95.02%
BenchmarkProduceResponseUnmarshal-8           1315          1315          +0.00%
BenchmarkFetchRequestMarshal-8                688           416           -39.53%
BenchmarkFetchResponseUnmarshal-8             205695        184831        -10.14%