Skip to content
  • Giedrius Statkevičius's avatar
    groupcache: enable H2C + add benchmarks (#5068) · ba9b36dc
    Giedrius Statkevičius authored
    
    
    * groupcache: enable H2C + add benchmarks
    
    Add h2c benchmarks. Somehow h2c is slowed than regular HTTP locally for
    me. Probably because these aren't real life benchmarks i.e. establishing
    TCP connections locally has no cost. And if there is only one operation
    happening at any time then h2 has to do more work hence more CPU usage.
    
    With 500 parallel requests going on at the same time, h2 becomes faster
    than (or is at the same level as) h1 while using a minimal number of TCP
    connections. Thus, it will work much faster in real life situations. So,
    let's enable it.
    
    ```
    name                                                               time/op
    GroupcacheRetrieval/h2c/seq-16                                      227µs ± 1%
    GroupcacheRetrieval/h2c/parallel=500-16                            54.8µs ±20%
    GroupcacheRetrieval/h1,_max_one_TCP_connection/seq-16               150µs ± 2%
    GroupcacheRetrieval/h1,_max_one_TCP_connection/parallel=500-16      146µs ± 1%
    GroupcacheRetrieval/h1,_unlimited_TCP_connections/seq-16            145µs ± 3%
    GroupcacheRetrieval/h1,_unlimited_TCP_connections/parallel=500-16  52.8µs ± 9%
    
    name                                                               alloc/op
    GroupcacheRetrieval/h2c/seq-16                                      183kB ± 0%
    GroupcacheRetrieval/h2c/parallel=500-16                             143kB ± 1%
    GroupcacheRetrieval/h1,_max_one_TCP_connection/seq-16               161kB ± 0%
    GroupcacheRetrieval/h1,_max_one_TCP_connection/parallel=500-16      162kB ± 0%
    GroupcacheRetrieval/h1,_unlimited_TCP_connections/seq-16            161kB ± 0%
    GroupcacheRetrieval/h1,_unlimited_TCP_connections/parallel=500-16   116kB ± 2%
    
    name                                                               allocs/op
    GroupcacheRetrieval/h2c/seq-16                                        283 ± 0%
    GroupcacheRetrieval/h2c/parallel=500-16                               256 ± 1%
    GroupcacheRetrieval/h1,_max_one_TCP_connection/seq-16                 260 ± 0%
    GroupcacheRetrieval/h1,_max_one_TCP_connection/parallel=500-16        262 ± 0%
    GroupcacheRetrieval/h1,_unlimited_TCP_connections/seq-16              260 ± 0%
    GroupcacheRetrieval/h1,_unlimited_TCP_connections/parallel=500-16     279 ± 1%
    ```
    
    Signed-off-by: default avatarGiedrius Statkevičius <giedrius.statkevicius@vinted.com>
    
    * Add fix according to Kemal's suggestion
    
    Signed-off-by: default avatarGiedrius Statkevičius <giedrius.statkevicius@vinted.com>
    ba9b36dc
Analyzing file…