Bboysoul's Blog

首页 公告 RSS

解决loki的too many outstanding requests

June 28, 2023 本文有 281 个字 需要花费 1 分钟阅读

简介

家里的 loki 一直是在收集日志的,但是从来没有使用过,今天想着可以做一个日志的 dashboard 使用下,但是发现一直报错

too many outstanding requests

然后 loki 这边的日志有大量的

context canceled

看了网上也没有什么很好的办法

还有其实日志的量真的不是很多

操作

我的解决办法是配置查询缓存

    frontend:
      max_outstanding_per_tenant: 4096
      compress_responses: true
    query_range:
      cache_results: true
      results_cache:
        cache:
          redis:
            endpoint: 127.0.0.1:6379
            timeout: 1s
            db: 5
            password: xxxxxxxxxxx
            expiration: 1h

query_range 字段在 loki 里面是用来配置查询拆分和缓存的,这里我选择的是使用 redis 作为缓存,因为家里正好有一台 redis

配置完成之后重启就问题解决了,如果碰到相同问题的,可以试试这个方法

网上有说配置max_outstanding_per_tenant但是我感觉这个不是我的主要原因

欢迎关注我的博客www.bboy.app

Have Fun


Tags:

本站总访问量 本站总访客数