mirror of
https://github.com/kevinveenbirkenbach/computer-playbook.git
synced 2026-11-08 11:46:35 +00:00
fix(search): give the search engines half of their container as heap
The central Elasticsearch, Zammad's Elasticsearch and Magento's
OpenSearch ran with a literal heap beside a mem_limit four times its
size: 1g in 4g, 512m in 2g and 512m in 2g. The heap is now half of the
limit through lookup('service_memory_mb'), which makes it 2048, 1024
and 1024 MiB and lets it follow the limit when that changes.
Xms equals Xmx, so these containers hold that much more memory from
the start.
Zammad's memcached size and Magento's PHP_MEMORY_LIMIT take the same
lookup and keep their values, 256 and 768M.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
0f7fb92e12
commit
a7db89ac0b
7 files changed
+8
-5
No files matched your search
@@ -6,4 +6,4 @@ xpack.security.enabled=true
|
||||
xpack.security.http.ssl.enabled=false
|
||||
xpack.security.transport.ssl.enabled=false
|
||||
bootstrap.memory_lock=true
|
||||
ES_JAVA_OPTS=-Xms1g -Xmx1g
|
||||
ES_JAVA_OPTS=-Xms{{ ELASTICSEARCH_HEAP_MB }}m -Xmx{{ ELASTICSEARCH_HEAP_MB }}m
|
||||
@@ -10,6 +10,7 @@ ELASTICSEARCH_PASSWORD: "{{ lookup('config', application_id, 'secrets.credential
|
||||
ELASTICSEARCH_EXPOSE_LOCAL: true
|
||||
ELASTICSEARCH_LOCAL_HOST: "127.0.0.1"
|
||||
ELASTICSEARCH_INTERNAL_PORT: "{{ lookup('config', application_id, 'services.elasticsearch.ports.internal.elasticsearch') }}"
|
||||
ELASTICSEARCH_HEAP_MB: "{{ lookup('service_memory_mb', application_id, entity_name, 0.5) }}"
|
||||
ELASTICSEARCH_RETRIES: 5
|
||||
ELASTICSEARCH_DELAY: 2
|
||||
ELASTICSEARCH_API_BASE: "http://{{ ELASTICSEARCH_LOCAL_HOST }}:{{ ELASTICSEARCH_INTERNAL_PORT }}"
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
- plugins.security.disabled=true
|
||||
- OPENSEARCH_JAVA_OPTS=-Xms512m -Xmx512m
|
||||
- OPENSEARCH_JAVA_OPTS=-Xms{{ MAGENTO_SEARCH_HEAP_MB }}m -Xmx{{ MAGENTO_SEARCH_HEAP_MB }}m
|
||||
{{ lookup('container_healthcheck', service_name) | indent(4) }}
|
||||
{{ lookup('container_extra_hosts') | indent(4) }}
|
||||
{{ lookup('container_networks') | indent(4) }}
|
||||
|
||||
@@ -41,6 +41,6 @@ MAGENTO_REMOTE_STORAGE_REGION={{ lookup('objstore', application_id, 'region') }}
|
||||
MAGENTO_REMOTE_STORAGE_PATH_STYLE=1
|
||||
{% endif %}
|
||||
|
||||
PHP_MEMORY_LIMIT=768M
|
||||
PHP_MEMORY_LIMIT={{ lookup('service_memory_mb', application_id, 'php', 0.75) }}M
|
||||
|
||||
APACHE_SERVERNAME={{ MAGENTO_DOMAIN }}
|
||||
@@ -19,6 +19,7 @@ MAGENTO_PHP_FPM_CONF_PATH: "{{ [ lookup('container', application_id, 'directorie
|
||||
MAGENTO_OBJSTORE_ENABLED: "{{ lookup('objstore', application_id, 'enabled') }}"
|
||||
|
||||
MAGENTO_SEARCH_CONTAINER: "{{ lookup('config', application_id, 'services.search.name') }}"
|
||||
MAGENTO_SEARCH_HEAP_MB: "{{ lookup('service_memory_mb', application_id, 'search', 0.5) }}"
|
||||
|
||||
MAGENTO_PHP_CONTAINER: "{{ lookup('config', application_id, 'services.php.name') }}"
|
||||
MAGENTO_PHP_CONTAINER_ADDRESS: "{{ lookup('container_address', application_id, 'php') }}"
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
environment:
|
||||
- discovery.type=single-node
|
||||
- xpack.security.enabled=false
|
||||
- ES_JAVA_OPTS=-Xms512m -Xmx512m
|
||||
- ES_JAVA_OPTS=-Xms{{ ZAMMAD_SEARCH_HEAP_MB }}m -Xmx{{ ZAMMAD_SEARCH_HEAP_MB }}m
|
||||
{{ lookup('container_volumes', service_name) | indent(4) }}
|
||||
{{ lookup('container_extra_hosts') | indent(4) }}
|
||||
{{ lookup('container_networks') | indent(4) }}
|
||||
@@ -65,7 +65,7 @@
|
||||
{{ lookup('container_image', 'svc-db-memcached', 'memcached') }}
|
||||
{{ lookup('compose_only', 'container_name', ZAMMAD_MEMCACHED_CONTAINER) }}
|
||||
{% include 'roles/sys-svc-container/templates/base.yml.j2' %}
|
||||
command: ["memcached", "-m", "256"]
|
||||
command: ["memcached", "-m", "{{ lookup('service_memory_mb', application_id, service_name, 0.125) }}"]
|
||||
{{ lookup('container_extra_hosts') | indent(4) }}
|
||||
{{ lookup('container_networks') | indent(4) }}
|
||||
{% endif %}
|
||||
|
||||
@@ -22,6 +22,7 @@ ZAMMAD_MEMCACHED_CONTAINER: "{{ lookup('engine', 'memcached', application_id, 'c
|
||||
ZAMMAD_RAILS_PORT: "{{ lookup('config', application_id, 'services.' ~ ZAMMAD_RAILS_SERVICE ~ '.ports.internal.http') }}"
|
||||
ZAMMAD_WEBSOCKET_PORT: "{{ lookup('config', application_id, 'services.' ~ ZAMMAD_WEBSOCKET_SERVICE ~ '.ports.internal.http') }}"
|
||||
ZAMMAD_SEARCH_PORT: "{{ lookup('config', application_id, 'services.' ~ ZAMMAD_SEARCH_SERVICE ~ '.ports.internal.http') }}"
|
||||
ZAMMAD_SEARCH_HEAP_MB: "{{ lookup('service_memory_mb', application_id, ZAMMAD_SEARCH_SERVICE, 0.5) }}"
|
||||
|
||||
# Exception: env.j2 must never set DATABASE_URL. The image's config/pre_initializers/database_url.rb
|
||||
# builds it from POSTGRESQL_* only while DATABASE_URL is blank, so presetting it drops
|
||||
|
||||
Reference in new issue
Block a user