LogStash 的性能非常低

Very Low Performance With LogStash

我有一个 LogStash 配置和一个 REDIS 代理,它可以完美地处理低流量 (10 Messages/Second)。每个 ELK 服务都运行在各自独立的 2GB 服务器上。

Tomcat(Log4j) -> LogStash -> Redis ->LogStash->ES->Kibana.. 我现在有一个新的要求来记录大约 (200 messages/second)。

Tomcat->LogStash->Redis 工作得足够快(250+ messages/second),但是第二个 LogStash 似乎不够快,无法消耗 100+ messages/second来自 Redis。它目前正在做大约 10 messages/second。这可能是由于我的消息大小 (我在每条消息中记录了一个 20kb Xml 字符串).

我的第二个 lumberjack.conf 经过大量调整(我还在命令行中应用了 -w 10)进行并行处理后看起来像下面这样。我还评论了所有多行过滤器,因为它们不是线程安全的。

    input {
     #Read Log4J messages from the Redis Broker (general errors).
     redis {
      host => "192.168.0.231"
      type => "qalogs"
      port => 6379
      data_type => "list"
      key => "lsqalogs"
      batch_count => 100
      threads => 8
      codec => "json"
    }
    output {
     if [type] == "avail" {
      if [push_index] {
        elasticsearch {
          index => "%{push_index}-%{push_type}-%{+YYYY.MM.dd}"
          hosts => ["192.168.0.230:9200"]
          flush_size => 50
          manage_template => false
          workers => 40
        }
      } else {
        elasticsearch {
          index => "log-%{type}-%{+YYYY.MM.dd}"
          hosts => ["192.168.0.230:9200"]
          flush_size => 50
          manage_template => false
          workers => 40
        }
      }
     }
   }

我已经为此工作了几个月,并且已经自动化了整个堆栈安装。我唯一的问题是性能很糟糕。

第二个 LogStash 服务器以 0.3 Load-Avg 运行,因此我相信它肯定可以处理 100+/messages/second 的热量。

我在单独的 2GB 服务器上使用 LogStash 2.1v、ES 2.1、Redis3。我真的很感激这方面的一些信息?

提前致谢。

尝试减少 elasticsearch 输出中的工作人员。

来自 blog post by elastic on Logstash optimization(强调我的):

...modify configuration variables on your output (most notably the “workers” option on the Elasticsearch output which will probably be best at the number of cores your machine has)...

文章提到的另一件事是瓶颈可能是你的elasticsearch。 2GB 的内存对于 elasticsearch 节点来说很小,问题可能出在资源阻塞的 elasticsearch 而不是配置错误的 logstash。