Skip to content

Commit ad0a071

Browse files
authored
Parquet: add row range constraints cache (#7478)
* parquetutil: Add parquet row ranges cache Implement a parquet-common RowRangesForConstraintsCache backed by Cortex cache backends. Encode row ranges into a compact binary format and hash cache keys so they are safe for memcached and other shared cache backends. Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> * querier: Wire parquet row ranges cache into querier Add bucket-store config for the parquet row ranges cache, create the backend cache for parquet queryable Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> * Update generated config docs Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> * parquetutil: modernize row ranges cache test Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> * remove redundant backfill ttl assignment Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> * storegateway: wire parquet row ranges cache Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> * integration: Enable the parquet row ranges cache in the single-binary querier Assert that the cache misses on the first query and hits when querying the same stored series again. Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> * Fix timeout failure With WaitMissingMetrics, the e2e helper keeps retrying on missing cache hits/misses until timeout. Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com> --------- Signed-off-by: Siddarth Gundu <siddarthg0910@gmail.com>
1 parent 0732fe3 commit ad0a071

15 files changed

Lines changed: 1640 additions & 40 deletions

‎CHANGELOG.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
* [ENHANCEMENT] Tenant Federation: Avoid purging the regex resolver LRU cache on user-sync ticks when the set of known users has not changed. #7489
1717
* [ENHANCEMENT] Memberlist: Add `-memberlist.packet-read-timeout`, `-memberlist.max-packet-size`, and `-memberlist.max-concurrent-connections` flags to bound inbound gossip TCP connections, preventing slow-read, OOM, and connection-flood attacks on the gossip port. #7518
1818
* [ENHANCEMENT] Parquet Converter: Add a ring status page to expose the ring status. #7455
19+
* [ENHANCEMENT] Parquet: Add a row ranges cache for parquet query filtering in querier and store-gateway. #7478
1920
* [ENHANCEMENT] Ingester: Add WAL record metrics to help evaluate the effectiveness of WAL compression type (e.g. snappy, zstd): `cortex_ingester_tsdb_wal_record_part_writes_total`, `cortex_ingester_tsdb_wal_record_parts_bytes_written_total`, and `cortex_ingester_tsdb_wal_record_bytes_saved_total`. #7420
2021
* [ENHANCEMENT] Distributor: Introduce dynamic `Symbols` slice capacity pooling. #7398 #7401
2122
* [ENHANCEMENT] Metrics Helper: Add native histogram support for aggregating and merging, including dual-format histogram handling that exposes both native and classic bucket formats. #7359

‎docs/blocks-storage/querier.md‎

Lines changed: 234 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,240 @@ blocks_storage:
17371737
# CLI flag: -blocks-storage.bucket-store.parquet-labels-cache.subrange-ttl
17381738
[subrange_ttl: <duration> | default = 24h]
17391739

1740+
parquet_row_ranges_cache:
1741+
# The parquet row ranges cache backend type. Single or Multiple cache
1742+
# backend can be provided. Supported values in single cache: memcached,
1743+
# redis, inmemory, and '' (disable). Supported values in multi level
1744+
# cache: a comma-separated list of (inmemory, memcached, redis)
1745+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.backend
1746+
[backend: <string> | default = ""]
1747+
1748+
inmemory:
1749+
# Maximum size in bytes of in-memory parquet-row-ranges cache used
1750+
# (shared between all tenants).
1751+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.inmemory.max-size-bytes
1752+
[max_size_bytes: <int> | default = 1073741824]
1753+
1754+
memcached:
1755+
# Comma separated list of memcached addresses. Supported prefixes are:
1756+
# dns+ (looked up as an A/AAAA query), dnssrv+ (looked up as a SRV
1757+
# query, dnssrvnoa+ (looked up as a SRV query, with no A/AAAA lookup
1758+
# made after that).
1759+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.addresses
1760+
[addresses: <string> | default = ""]
1761+
1762+
# The socket read/write timeout.
1763+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.timeout
1764+
[timeout: <duration> | default = 100ms]
1765+
1766+
# The maximum number of idle connections that will be maintained per
1767+
# address.
1768+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.max-idle-connections
1769+
[max_idle_connections: <int> | default = 16]
1770+
1771+
# The maximum number of concurrent asynchronous operations can occur.
1772+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.max-async-concurrency
1773+
[max_async_concurrency: <int> | default = 3]
1774+
1775+
# The maximum number of enqueued asynchronous operations allowed.
1776+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.max-async-buffer-size
1777+
[max_async_buffer_size: <int> | default = 10000]
1778+
1779+
# The maximum number of concurrent connections running get operations.
1780+
# If set to 0, concurrency is unlimited.
1781+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.max-get-multi-concurrency
1782+
[max_get_multi_concurrency: <int> | default = 100]
1783+
1784+
# The maximum number of keys a single underlying get operation should
1785+
# run. If more keys are specified, internally keys are split into
1786+
# multiple batches and fetched concurrently, honoring the max
1787+
# concurrency. If set to 0, the max batch size is unlimited.
1788+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.max-get-multi-batch-size
1789+
[max_get_multi_batch_size: <int> | default = 0]
1790+
1791+
# The maximum size of an item stored in memcached. Bigger items are not
1792+
# stored. If set to 0, no maximum size is enforced.
1793+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.max-item-size
1794+
[max_item_size: <int> | default = 1048576]
1795+
1796+
# Use memcached auto-discovery mechanism provided by some cloud provider
1797+
# like GCP and AWS
1798+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.auto-discovery
1799+
[auto_discovery: <boolean> | default = false]
1800+
1801+
set_async_circuit_breaker_config:
1802+
# If true, enable circuit breaker.
1803+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.set-async.circuit-breaker.enabled
1804+
[enabled: <boolean> | default = false]
1805+
1806+
# Maximum number of requests allowed to pass through when the circuit
1807+
# breaker is half-open. If set to 0, by default it allows 1 request.
1808+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.set-async.circuit-breaker.half-open-max-requests
1809+
[half_open_max_requests: <int> | default = 10]
1810+
1811+
# Period of the open state after which the state of the circuit
1812+
# breaker becomes half-open. If set to 0, by default open duration is
1813+
# 60 seconds.
1814+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.set-async.circuit-breaker.open-duration
1815+
[open_duration: <duration> | default = 5s]
1816+
1817+
# Minimal requests to trigger the circuit breaker.
1818+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.set-async.circuit-breaker.min-requests
1819+
[min_requests: <int> | default = 50]
1820+
1821+
# Consecutive failures to determine if the circuit breaker should
1822+
# open.
1823+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.set-async.circuit-breaker.consecutive-failures
1824+
[consecutive_failures: <int> | default = 5]
1825+
1826+
# Failure percentage to determine if the circuit breaker should open.
1827+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.memcached.set-async.circuit-breaker.failure-percent
1828+
[failure_percent: <float> | default = 0.05]
1829+
1830+
redis:
1831+
# Comma separated list of redis addresses. Supported prefixes are: dns+
1832+
# (looked up as an A/AAAA query), dnssrv+ (looked up as a SRV query,
1833+
# dnssrvnoa+ (looked up as a SRV query, with no A/AAAA lookup made after
1834+
# that).
1835+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.addresses
1836+
[addresses: <string> | default = ""]
1837+
1838+
# Redis username.
1839+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.username
1840+
[username: <string> | default = ""]
1841+
1842+
# Redis password.
1843+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.password
1844+
[password: <string> | default = ""]
1845+
1846+
# Database to be selected after connecting to the server.
1847+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.db
1848+
[db: <int> | default = 0]
1849+
1850+
# Specifies the master's name. Must be not empty for Redis Sentinel.
1851+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.master-name
1852+
[master_name: <string> | default = ""]
1853+
1854+
# The maximum number of concurrent GetMulti() operations. If set to 0,
1855+
# concurrency is unlimited.
1856+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.max-get-multi-concurrency
1857+
[max_get_multi_concurrency: <int> | default = 100]
1858+
1859+
# The maximum size per batch for mget.
1860+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.get-multi-batch-size
1861+
[get_multi_batch_size: <int> | default = 100]
1862+
1863+
# The maximum number of concurrent SetMulti() operations. If set to 0,
1864+
# concurrency is unlimited.
1865+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.max-set-multi-concurrency
1866+
[max_set_multi_concurrency: <int> | default = 100]
1867+
1868+
# The maximum size per batch for pipeline set.
1869+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.set-multi-batch-size
1870+
[set_multi_batch_size: <int> | default = 100]
1871+
1872+
# The maximum number of concurrent asynchronous operations can occur.
1873+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.max-async-concurrency
1874+
[max_async_concurrency: <int> | default = 3]
1875+
1876+
# The maximum number of enqueued asynchronous operations allowed.
1877+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.max-async-buffer-size
1878+
[max_async_buffer_size: <int> | default = 10000]
1879+
1880+
# Client dial timeout.
1881+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.dial-timeout
1882+
[dial_timeout: <duration> | default = 5s]
1883+
1884+
# Client read timeout.
1885+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.read-timeout
1886+
[read_timeout: <duration> | default = 3s]
1887+
1888+
# Client write timeout.
1889+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.write-timeout
1890+
[write_timeout: <duration> | default = 3s]
1891+
1892+
# Whether to enable tls for redis connection.
1893+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.tls-enabled
1894+
[tls_enabled: <boolean> | default = false]
1895+
1896+
# Path to the client certificate file, which will be used for
1897+
# authenticating with the server. Also requires the key path to be
1898+
# configured.
1899+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.tls-cert-path
1900+
[tls_cert_path: <string> | default = ""]
1901+
1902+
# Path to the key file for the client certificate. Also requires the
1903+
# client certificate to be configured.
1904+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.tls-key-path
1905+
[tls_key_path: <string> | default = ""]
1906+
1907+
# Path to the CA certificates file to validate server certificate
1908+
# against. If not set, the host's root CA certificates are used.
1909+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.tls-ca-path
1910+
[tls_ca_path: <string> | default = ""]
1911+
1912+
# Override the expected name on the server certificate.
1913+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.tls-server-name
1914+
[tls_server_name: <string> | default = ""]
1915+
1916+
# Skip validating server certificate.
1917+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.tls-insecure-skip-verify
1918+
[tls_insecure_skip_verify: <boolean> | default = false]
1919+
1920+
# If not zero then client-side caching is enabled. Client-side caching
1921+
# is when data is stored in memory instead of fetching data each time.
1922+
# See https://redis.io/docs/manual/client-side-caching/ for more info.
1923+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.cache-size
1924+
[cache_size: <int> | default = 0]
1925+
1926+
set_async_circuit_breaker_config:
1927+
# If true, enable circuit breaker.
1928+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.set-async.circuit-breaker.enabled
1929+
[enabled: <boolean> | default = false]
1930+
1931+
# Maximum number of requests allowed to pass through when the circuit
1932+
# breaker is half-open. If set to 0, by default it allows 1 request.
1933+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.set-async.circuit-breaker.half-open-max-requests
1934+
[half_open_max_requests: <int> | default = 10]
1935+
1936+
# Period of the open state after which the state of the circuit
1937+
# breaker becomes half-open. If set to 0, by default open duration is
1938+
# 60 seconds.
1939+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.set-async.circuit-breaker.open-duration
1940+
[open_duration: <duration> | default = 5s]
1941+
1942+
# Minimal requests to trigger the circuit breaker.
1943+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.set-async.circuit-breaker.min-requests
1944+
[min_requests: <int> | default = 50]
1945+
1946+
# Consecutive failures to determine if the circuit breaker should
1947+
# open.
1948+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.set-async.circuit-breaker.consecutive-failures
1949+
[consecutive_failures: <int> | default = 5]
1950+
1951+
# Failure percentage to determine if the circuit breaker should open.
1952+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.redis.set-async.circuit-breaker.failure-percent
1953+
[failure_percent: <float> | default = 0.05]
1954+
1955+
multilevel:
1956+
# The maximum number of concurrent asynchronous operations can occur
1957+
# when backfilling cache items.
1958+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.multilevel.max-async-concurrency
1959+
[max_async_concurrency: <int> | default = 3]
1960+
1961+
# The maximum number of enqueued asynchronous operations allowed when
1962+
# backfilling cache items.
1963+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.multilevel.max-async-buffer-size
1964+
[max_async_buffer_size: <int> | default = 10000]
1965+
1966+
# The maximum number of items to backfill per asynchronous operation.
1967+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.multilevel.max-backfill-items
1968+
[max_backfill_items: <int> | default = 10000]
1969+
1970+
# TTL for caching parquet row ranges.
1971+
# CLI flag: -blocks-storage.bucket-store.parquet-row-ranges-cache.ttl
1972+
[ttl: <duration> | default = 10m]
1973+
17401974
# Maximum number of entries in the regex matchers cache. 0 to disable.
17411975
# CLI flag: -blocks-storage.bucket-store.matchers-cache-max-items
17421976
[matchers_cache_max_items: <int> | default = 0]

0 commit comments

Comments
 (0)