Projects STRLCPY graphql-engine Commits d6703811
🤬
  • benchmarks: Add `Accept-Encoding: gzip` headers (NO REGRESSION)

    PR-URL: https://github.com/hasura/graphql-engine-mono/pull/5622
    GitOrigin-RevId: d4952b00cfe322f9f80d1005412ac3c777f3bd46
  • Loading...
  • Brandon Simmons committed with hasura-bot 2 months ago
    d6703811
    1 parent 4a582532
  • ■ ■ ■ ■ ■
    server/benchmarks/README.md
    skipped 85 lines
    86 86   https://well-typed.com/blog/2021/01/fragmentation-deeper-look/
    87 87   https://well-typed.com/blog/2021/03/memory-return/
    88 88   
     89 +- If optimizing or tuning the output/compression codepath:
     90 + - `chinook`.`*_small_result` and `simple_query_*` queries are average wrt
     91 + response body size (according to cloud data)
     92 + - ...and `chinook`.`full_introspection` is ~P95
     93 + 
    89 94  ## Adding a new benchmark and reviewing
    90 95   
    91 96  You'll create a new directory under `benchmark_sets/`, and in general can
    skipped 42 lines
  • ■ ■ ■ ■ ■ ■
    server/benchmarks/benchmark_sets/chinook/config.query.yaml
    skipped 4 lines
    5 5   X-Hasura-Admin-Secret: my-secret
    6 6   X-Hasura-Role: employee
    7 7   X-Hasura-User-Id: 4
     8 + # On cloud about 95% of requests incoming Accept gzip (which as of writing
     9 + # means we unconditionally compress, which has significant performance
     10 + # impact), so it's important that we include it in all benchmarks unless we
     11 + # have an intentional reason not to.
     12 + Accept-Encoding: gzip
    8 13   
    9 14  # Anchors to help us DRY below; settings here may be overridden selectively
    10 15  constants:
    skipped 25 lines
    36 41   ############################################################################
    37 42   # single-table query, small result size; makes use of permissions for
    38 43   # filtering; low RPS
     44 + #
     45 + # NOTE: According to data from cloud this is a pretty average response (we see
     46 + # P50 compressed response body size of 123 bytes, and P75 290 bytes):
     47 + #
     48 + # uncompressed body size: ~600 bytes
     49 + # compressed body size: ~200 bytes (as of time of writing)
    39 50   - name: simple_query_low_load
    40 51   <<: *k6_custom
    41 52   options:
    skipped 40 lines
    82 93   
    83 94   
    84 95   ######## Small result size
     96 + #
     97 + # uncompressed body size: ~650 bytes
     98 + # compressed body size: ~200 bytes
     99 + 
    85 100   - name: complex_query_low_load_small_result
    86 101   <<: *k6_custom
    87 102   options:
    skipped 49 lines
    137 152   
    138 153   
    139 154   ######## Large result size
     155 + #
     156 + # NOTE: According to data from cloud, this is somewhere between
     157 + # P90 (2 kB compressed) and P95 (4 kB compressed):
     158 + #
     159 + # uncompressed body size: ~33 kB
     160 + # compressed body size: ~3 kB (as of time of writing)
     161 + 
    140 162   - name: complex_query_low_load_large_result
    141 163   <<: *k6_custom
    142 164   options:
    skipped 32 lines
    175 197   # The standard introspection query from server/src-rsr/introspection.json
    176 198   # We don't expect a server to be hammered with these, but they are crucial
    177 199   # for clients (like graphiql):
     200 + #
     201 + # NOTE: According to data from cloud, this is somewhere between
     202 + # P95 (4 kB compressed) and P99 (40 kB compressed):
     203 + #
     204 + # uncompressed body size: ~190 kB
     205 + # compressed body size: ~13 kB (as of time of writing)
    178 206   
    179 207   - name: full_introspection
    180 208   <<: *k6_custom
    skipped 110 lines
  • ■ ■ ■ ■ ■ ■
    server/benchmarks/benchmark_sets/huge_schema/config.query.yaml
    1 1  # This tells graphql-bench that it's testing a hasura instance and should
    2 2  # collect some additional metrics:
    3 3  extended_hasura_checks: true
    4  -# headers:
    5  -# X-Hasura-Admin-Secret: my-secret
     4 +headers:
     5 + Accept-Encoding: gzip
    6 6   
    7 7  # Anchors to help us DRY below; settings here may be overridden selectively
    8 8  constants:
    skipped 310 lines
  • ■ ■ ■ ■ ■ ■
    server/benchmarks/benchmark_sets/remote_schema/config.query.yaml
    1 1  # This tells graphql-bench that it's testing a hasura instance and should
    2 2  # collect some additional metrics:
    3 3  extended_hasura_checks: true
    4  -# headers:
    5  -# X-Hasura-Admin-Secret: my-secret
     4 +headers:
     5 + Accept-Encoding: gzip
    6 6   
    7 7  # Anchors to help us DRY below; settings here may be overridden selectively
    8 8  constants:
    skipped 230 lines
  • ■ ■ ■ ■ ■ ■
    server/src-lib/Hasura/Server/Compression.hs
    skipped 41 lines
    42 42  contentEncodingHeader :: CompressionType -> NH.Header
    43 43  contentEncodingHeader CTGZip = gzipHeader
    44 44   
    45  --- | Maybe compress the response body, based on the client's Accept-Encoding
    46  --- and our own judgement.
    47 45  compressResponse ::
    48 46   NH.RequestHeaders ->
    49 47   BL.ByteString ->
    skipped 171 lines
Please wait...
Page is in error, reload to recover