|
1 | 1 | [[memory-queue]] |
2 | | -=== Memory queue |
3 | | - |
4 | | -By default, Logstash uses in-memory bounded queues between pipeline stages |
5 | | -(inputs → pipeline workers) to buffer events. The size of these in-memory |
6 | | -queues is fixed and not configurable. If Logstash experiences a temporary |
7 | | -machine failure, the contents of the in-memory queue will be lost. Temporary machine |
8 | | -failures are scenarios where Logstash or its host machine are terminated |
9 | | -abnormally but are capable of being restarted. |
| 2 | +=== Memory queue |
| 3 | + |
| 4 | +By default, Logstash uses in-memory bounded queues between pipeline stages (inputs → pipeline workers) to buffer events. |
| 5 | +If Logstash experiences a temporary machine failure, the contents of the memory queue will be lost. |
| 6 | +Temporary machine failures are scenarios where Logstash or its host machine are terminated abnormally, but are capable of being restarted. |
| 7 | + |
| 8 | +[[mem-queue-benefits]] |
| 9 | +==== Benefits of memory queues |
| 10 | + |
| 11 | +The memory queue might be a good choice if you value throughput over data resiliency. |
| 12 | + |
| 13 | +* Easier configuration |
| 14 | +* Easier management and administration |
| 15 | +* Faster throughput |
| 16 | + |
| 17 | +[[mem-queue-limitations]] |
| 18 | +==== Limitations of memory queues |
| 19 | + |
| 20 | +* Can lose data in abnormal termination |
| 21 | +* Don't do well handling sudden bursts of data, where extra capacity in needed for {ls} to catch up |
| 22 | +* Not a good choice for data you can't afford to lose |
| 23 | + |
| 24 | +TIP: Consider using <<persistent-queues,persistent queues>> to avoid these limitations. |
| 25 | + |
| 26 | +[[sizing-mem-queue]] |
| 27 | +==== Memory queue size |
| 28 | + |
| 29 | +Memory queue size is not configured directly. |
| 30 | +Multiply the `pipeline.batch.size` and `pipeline.workers` values to get the size of the memory queue. |
| 31 | +This value is called the "inflight count." |
| 32 | + |
| 33 | +[[backpressure-mem-queue]] |
| 34 | +==== Back pressure |
| 35 | + |
| 36 | +When the queue is full, Logstash puts back pressure on the inputs to stall data |
| 37 | +flowing into Logstash. |
| 38 | +This mechanism helps Logstash control the rate of data flow at the input stage |
| 39 | +without overwhelming outputs like Elasticsearch. |
| 40 | + |
| 41 | +ToDo: Is the next paragraph accurate for MQ? |
| 42 | + |
| 43 | +Each input handles back pressure independently. |
| 44 | +For example, when the |
| 45 | +<<plugins-inputs-beats,beats input>> encounters back pressure, it no longer |
| 46 | +accepts new connections. |
| 47 | +It waits until the queue has space to accept more events. |
| 48 | +After the filter and output stages finish processing existing |
| 49 | +events in the queue and ACKs them, Logstash automatically starts accepting new |
| 50 | +events. |
10 | 51 |
|
0 commit comments