From fcaa105f62bebba9eebe6340880da6a895d9160c Mon Sep 17 00:00:00 2001 From: David Stevenson Date: Fri, 29 Aug 2025 11:03:39 -0700 Subject: [PATCH] Make memory_limit_bytes available as optional bosh property The code allows both a configurable % and byte limit for memory. Specifically the byte limit makes sense when you want to run log-cache on a really large VM, colocated with other things, but you don't want it to take up too much of the VM's memory. This optional property will do nothing until set, at which point it will override the memory % limit, as documented. --- jobs/log-cache/spec | 3 +++ jobs/log-cache/templates/bpm.yml.erb | 3 +++ 2 files changed, 6 insertions(+) diff --git a/jobs/log-cache/spec b/jobs/log-cache/spec index f7f58ef3..08e7d5ee 100644 --- a/jobs/log-cache/spec +++ b/jobs/log-cache/spec @@ -43,6 +43,9 @@ properties: description: "Percentage of system memory to use for the cache. Must be an integer." default: 50 + memory_limit_bytes: + description: "Overrides memory_limit_percent with a specific size cache in bytes." + max_per_source: description: "The maximum number of items stored in LogCache per source." default: 100000 diff --git a/jobs/log-cache/templates/bpm.yml.erb b/jobs/log-cache/templates/bpm.yml.erb index 7e9c6b7e..6d09c4cb 100644 --- a/jobs/log-cache/templates/bpm.yml.erb +++ b/jobs/log-cache/templates/bpm.yml.erb @@ -25,6 +25,9 @@ processes: env: ADDR: "<%= ":#{p('port')}" %>" MEMORY_LIMIT_PERCENT: "<%= p('memory_limit_percent') %>" +<%- if_p('memory_limit_bytes') do |memory_limit_bytes| %> + MEMORY_LIMIT_BYTES: "<%= memory_limit_bytes %>" +<% end -%> MAX_PER_SOURCE: "<%= p('max_per_source') %>" INGRESS_BUFFER_SIZE: "<%= p('ingress_buffer_size') %>" INGRESS_BUFFER_READ_BATCH_SIZE: "<%= p('ingress_buffer_read_batch_size') %>"