-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[serve] prevent in memory metric store in handles from growing in memory
There are two potential sources of memory leak for the `InMemoryMetricsStore` in the handles that's used to record/report autoscaling metrics: 1. Old replica ID keys are never removed. We remove old replica keys from `num_queries_sent_to_replicas` when we get an updated list of running replicas from the long poll update, but we don't do any such cleaning for the in memory metrics store. This means there is leftover, uncleaned data for replicas that are no longer running. 2. We don't delete data points recorded from more than `look_back_period_s` ago for replicas except during window avg queries. This should mostly be solved once (1) is solved because this should only be a problem for replicas that are no longer running. This PR addresses (1) and (2) by periodically * pruning keys that haven't had updated data points in the past `look_back_period_s`. * compacting datapoints that are more than `look_back_period_s` old Main benchmarks picked from the full microbenchmark run posted below in the comments: |metric| master | current changes | % change | |------|---|---| -------- | |http_p50_latency|11.082594282925129|11.626139283180237|4.9044924534731305| |http_1mb_p50_latency|11.81719359010458|12.776304967701435|8.116236484439| |http_10mb_p50_latency|17.57313683629036|18.03796272724867|2.6450934473940757| |http_avg_rps|204.2|195.04|-4.48579823702252| |grpc_p50_latency|7.965719327330589|8.844093419611454|11.026927465| |grpc_1mb_p50_latency|17.652496695518494|19.921275787055492|12.852454418603475| |grpc_10mb_p50_latency|142.39510521292686|153.88561598956585|8.069456291673038| |grpc_avg_rps|203.35|211.01|3.766904352102296| |handle_p50_latency|4.890996962785721|4.082906059920788|-16.522007864929765| |handle_1mb_p50_latency|11.582874692976475|10.905216448009014|-5.8505186573275525| |handle_10mb_p50_latency|65.54202642291784|67.52330902963877|3.0229193615962657| |handle_avg_rps|394.57|404.85|2.6053678688192194| Closes #44870. Signed-off-by: Cindy Zhang <[email protected]>
- Loading branch information
Showing
5 changed files
with
131 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters