k8s-prometheus disk

Mango milk 2021-02-23 16:05:34
k8s-prometheus prometheus disk

prometheus Storage

Layout on disk
The sample taken is divided into two hours . Each two-hour period contains a directory , The directory contains one or more block files , This file contains all time series samples of this time window , And metadata files and index files ( Time series used to index measure names and labels into block files ) ).
adopt API When deleting a series , Delete records are stored in a separate logical delete file ( Instead of deleting data from the block file immediately ).
The block of the current incoming sample remains in memory , It's not fully preserved .Prometheus When the server restarts after a crash , By prewriting logs (WAL) Prevent collapse , To prevent collapse .
Prewrite log file wal With 128MB Is stored in the directory . These files contain raw data that has not been compressed , So they are much larger than regular block files .
Prometheus Will at least keep 3 Pre write log files , But high traffic servers may see more than three WAL file , Because it needs to keep raw data for at least two hours .
The first two hours of blocks will eventually be compressed into longer blocks in the background .
Compression creates larger blocks , Most of the rental time 10%, namely 21 God , Whichever is less .
--storage.tsdb.path: That's for sure Prometheus Where to write to its database . The default is data/.
--storage.tsdb.retention.time: This determines when to delete old data . The default is 15d.storage.tsdb.retention If this flag is set to any value other than the default , Coverage .
--storage.tsdb.retention.size:[EXPERIMENTAL] This determines the maximum number of bytes that the memory block can use ( Please note that , This does not include WAL size , It can be very big ). The oldest data will be deleted first . The default is 0 Or disable . The logo is experimental , Changes can be made in future releases . Supported units :KB,MB,GB,PB. for example :“ 512MB”
--storage.tsdb.retention: This flag has been discarded , It is recommended to use storage.tsdb.retention.time.
--storage.tsdb.wal-compression: This flag enables write ahead logging (WAL) Compression of . Based on your data , You can expect WAL The size will be halved , And extra CPU The load is very small . Please note that , If this flag is enabled , And then Prometheus Demote to 2.11.0 The following version , Then you will need to delete WAL, Because it will not be readable .
On average, , Prometheus used only about 1-2 Bytes . therefore , To plan Prometheus The capacity of the server , You can use the following rough formula :
needed_disk_space = retention_time_seconds * ingested_samples_per_second * bytes_per_sample
To adjust the rate of samples taken per second , It can reduce the number of time series captured ( Each target has fewer targets or fewer sequences ), Or you can increase the fetch interval . however , Because of compressing the samples in the sequence , Reducing the number of sequences may be more effective .
for example :
The set of nodes to be monitored is $$nodes={i|i>0}$$ 7
node i The number of measuring points on is $$metrics(i)$$ 50
The node i The grabbing time interval of is $$interval(i)$$, 15s
retention_time_seconds: 15d*24h*60min*60s
ingested_samples_per_second: 1/scrape_interval = 1/15s
needed_disk_space = 15d*24h*60min*60s * 1/15s * 1-2/byte * 7 * 50 = 60480000/byte /1024/1024 =57.678MB
本文为[Mango milk ]所创,转载请带上原文链接,感谢

  1. Spring can still play like this! Ali's new spring product has successfully overturned my understanding of spring!
  2. IntelliJ idea can also draw mind maps. It's really the strongest ide!
  3. JavaScript performance optimization [inline cache] V8 engine features
  4. linux 配置java环境
  5. linux find 查找文件
  6. 深入理解 Web 协议 (三):HTTP 2
  7. IntelliJ IDEA 相关问题记录
  8. Deep understanding of Web protocol (3): http 2
  9. 深入理解 Web 协议 (三):HTTP 2
  10. 腾讯IEG开源AI SDK:自动化测试吃鸡、MOBA类游戏
  11. Mysql Command
  12. Configuring Java environment with Linux
  13. Find files in Linux
  14. docker-Dockerfile 创建镜像
  15. Redis Cluster
  16. 深入理解 Web 协议 (三):HTTP 2
  17. JavaScriptBOM操作
  18. JavaScriptBOM操作
  19. Deep understanding of Web protocol (3): http 2
  20. Record of IntelliJ idea related problems
  21. Deep understanding of Web protocol (3): http 2
  22. Tencent IEG open source AI SDK: automatic testing of chicken eating and MoBa games
  23. Mysql Command
  24. Docker dockerfile create image
  25. Redis Cluster
  26. 死磕Spring之IoC篇 - 文章导读
  27. Deep understanding of Web protocol (3): http 2
  28. JavaScript BOM operation
  29. JavaScript BOM operation
  30. 死磕Spring之IoC篇 - 文章导读
  31. k8s node 操作与维护
  32. k8s 证书更新
  33. 【Java面试题第三期】JVM中哪些地方会出现内存溢出?出现的原因是什么?
  34. HashMap连环问你能答出几道?
  35. k8s-cronjob
  36. k8s-cert
  37. 头条面试官:说说Kafka的消费者提交方式,怎么实现的
  38. 什么是HTTPS以及如何实施HTTPS?
  39. Spring: an introduction to IOC
  40. Spring: an introduction to IOC
  41. Operation and maintenance of k8s node
  42. K8s certificate update
  43. vue使用sdk进行七牛上传
  44. k8s-dns
  45. JavaScript 邮箱验证 - 正则验证
  46. k8s-dashboard
  47. HashMap连环问你能答出几道?
  48. Where does memory overflow occur in the JVM? What are the reasons for this?
  49. How many questions can you answer?
  50. k8s-cronjob
  51. spring注解--Transactional
  52. k8s-cert
  53. Will the Spring Festival holiday be extended to February 27 in 2021? Here comes the response
  54. Headline Interviewer: talk about Kafka's consumer submission method, how to achieve it
  55. 【k8s集群】搭建步骤
  56. k8s-kubeadm
  57. k8s-etcd
  58. What is HTTPS and how to implement it?
  59. Java中使用HashMap改进查找性能
  60. maven发布jar包运行时找不到类问题