Skip to content

Commit c78711b

Browse files
ps48julianocosta89
andauthored
Reduce OpenSearch container memory footprint (#2587)
* Reduce OpenSearch container memory footprint Signed-off-by: ps48 <[email protected]> * update changelog Signed-off-by: ps48 <[email protected]> --------- Signed-off-by: ps48 <[email protected]> Co-authored-by: Juliano Costa <[email protected]>
1 parent fe0458c commit c78711b

File tree

4 files changed

+47
-3
lines changed

4 files changed

+47
-3
lines changed

.env

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ GRAFANA_IMAGE=grafana/grafana:12.1.0
1515
JAEGERTRACING_IMAGE=jaegertracing/jaeger:2.10.0
1616
# must also update version field in src/grafana/provisioning/datasources/opensearch.yaml
1717
OPENSEARCH_IMAGE=opensearchproject/opensearch:3.2.0
18+
OPENSEARCH_DOCKERFILE=./src/opensearch/Dockerfile
1819
POSTGRES_IMAGE=postgres:17.6 # used only for TraceTest
1920
PROMETHEUS_IMAGE=quay.io/prometheus/prometheus:v3.5.0
2021
VALKEY_IMAGE=valkey/valkey:8.1.3-alpine

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ the release.
99

1010
* Align env vars
1111
([#2582](https://github.com/open-telemetry/opentelemetry-demo/pull/2582))
12+
* [opensearch] Reduce OpenSearch container memory footprint
13+
([#2587](https://github.com/open-telemetry/opentelemetry-demo/pull/2587))
1214

1315
## 2.1.0
1416

docker-compose.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -847,19 +847,21 @@ services:
847847

848848
# OpenSearch
849849
opensearch:
850-
image: ${OPENSEARCH_IMAGE}
851850
container_name: opensearch
851+
build:
852+
context: ./
853+
dockerfile: ${OPENSEARCH_DOCKERFILE}
852854
deploy:
853855
resources:
854856
limits:
855-
memory: 1.1G
857+
memory: 800M
856858
restart: unless-stopped
857859
environment:
858860
- cluster.name=demo-cluster
859861
- node.name=demo-node
860862
- bootstrap.memory_lock=true
861863
- discovery.type=single-node
862-
- OPENSEARCH_JAVA_OPTS=-Xms300m -Xmx300m
864+
- OPENSEARCH_JAVA_OPTS=-Xms400m -Xmx400m
863865
- DISABLE_INSTALL_DEMO_CONFIG=true
864866
- DISABLE_SECURITY_PLUGIN=true
865867
# Workaround on OSX for https://bugs.openjdk.org/browse/JDK-8345296

src/opensearch/Dockerfile

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# Copyright The OpenTelemetry Authors
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
FROM opensearchproject/opensearch:3.2.0
5+
6+
USER 0
7+
8+
# Remove plugins in dependency order - remove dependent plugins first
9+
# These plugins are not needed for basic log storage and retrieval in the demo
10+
RUN /usr/share/opensearch/bin/opensearch-plugin remove opensearch-security-analytics && \
11+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-alerting && \
12+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-anomaly-detection && \
13+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-asynchronous-search && \
14+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-cross-cluster-replication && \
15+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-custom-codecs && \
16+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-flow-framework && \
17+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-geospatial && \
18+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-neural-search && \
19+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-knn && \
20+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-ltr && \
21+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-skills && \
22+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-ml && \
23+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-notifications && \
24+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-notifications-core && \
25+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-observability && \
26+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-performance-analyzer && \
27+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-reports-scheduler && \
28+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-search-relevance && \
29+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-system-templates && \
30+
/usr/share/opensearch/bin/opensearch-plugin remove opensearch-ubi && \
31+
/usr/share/opensearch/bin/opensearch-plugin remove query-insights
32+
33+
# Keep only these essential plugins:
34+
# - opensearch-security (authentication/authorization) - already disabled via env var
35+
# - opensearch-index-management (index lifecycle management)
36+
# - opensearch-sql (SQL query support for Grafana PPL queries)
37+
# - opensearch-job-scheduler (task scheduling)
38+
39+
USER 1000

0 commit comments

Comments
 (0)