![]() |
1 год назад | |
---|---|---|
.. | ||
README.md | 1 год назад | |
benchmark.sh | 1 год назад | |
fuzzer.sh | 1 год назад | |
gorilla.cc | 1 год назад | |
gorilla.h | 1 год назад |
This provides an alternative way of representing values stored in database pages. Instead of allocating and using a page of fixed size, ie. 4096 bytes, the Gorilla implementation adds support for dynamically sized pages that contain a variable number of Gorilla buffers.
Each buffer takes 512 bytes and compresses incoming data using the Gorilla compression:
1
.0
bit to indicate the change.1
bit.A Gorilla page can have multiple Gorilla buffers. If the values of a metric
are highly compressible, just one Gorilla buffer is able to store all the values
that otherwise would require a regular 4096 byte page, ie. we can use just 512
bytes instead. In the worst case scenario (for metrics whose values are not
compressible at all), a Gorilla page might end up having 9
Gorilla buffers,
consuming 4608 bytes. In practice, this is pretty rare and does not negate
the effect of compression for the metrics.
When a gorilla page is full, ie. it contains 1024 slots/values, we serialize the linked-list of gorilla buffers directly to disk. During deserialization, eg. when performing a DBEngine query, the Gorilla page is loaded from the disk and its linked-list entries are patched to point to the new memory allocated for serving the query results.
Overall, on a real-agent the Gorilla compression scheme reduces memory consumption approximately by ~30%, which can be several GiB of RAM for parents having hundreds, or even thousands of children streaming to them.