Skip to content

v0y4g3r/prom-write-request-bench

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Prometheus Write Request Deserialization Benchmark

This repository serves as an example for pursuing better deserialization performance of the well-known Protobuf-encoded Prometheus WriteRequest.

As a baseline, the deserialization implementation generated by prost takes about 7.3ms to decode a WriteRequest with 10k timeseries on our test environment.

This repository contains several branches that each did some optimization effort.

  • step1/reproduce: reproduce the baseline
  • step2/repeated_field: use RepeatedField to replace Vec for repeated field to enable pooling
  • step3/bytes: use bytes to facilitate zero-copy deserialization
  • step4/bytes-eliminate-one-copy: eliminate one copy_to_bytes invocation
  • step5/bench-bytes-slice: reproduce the overhead brought by Bytes::slice
  • step6/optimize-slice: hack Bytes::slice while ensuring lifetime guarantee

Finally, we cut the deserialization cost from 7.3ms to 1.6ms.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages