Memory usage continues to increase in ECS deployment (v1.18.0)
Self Checks
- [x] I have read the Contributing Guide and Language Policy.
- [x] This is only for bug report, if you would like to ask a question, please head to Discussions.
- [x] I have searched for existing issues search for existing issues, including closed ones.
- [x] I confirm that I am using English to submit this report, otherwise it will be closed.
- [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
- [x] Please do not modify this template :) and fill in all the required fields.
Dify version
1.18.0
Cloud or Self Hosted
Self Hosted (Source)
Steps to reproduce
Steps to Reproduce
Deploy Dify version 1.18.0 on AWS ECS using image 1.18.0 from docker hub Set up an application (e.g., a simple chatbot or a RAG application). Send some API requests to the application or use it through the web interface. Monitor the memory usage of the api and worker tasks in Amazon CloudWatch. Observe that the memory usage steadily climbs and does not return to a baseline level.
✔️ Expected Behavior
Memory usage should remain stable or return to a baseline level after requests are processed and tasks are completed. It should not increase indefinitely.
❌ Actual Behavior
No response
The chart climbs from about 95% to 99%, but it doesn’t show whether the same api or worker container kept growing. If this is the ECS service-level MemoryUtilization metric, it reports usage relative to the task definition and can use the soft reservation rather than the hard limit. A similar ECS report on v1.8.0 didn’t establish a cause that we can carry over to v1.18.0. [1]
Could you share separate memory-in-MB traces for api and worker, plus the ECS memory reservation and hard limit? If Container Insights with enhanced observability is enabled, use ContainerMemoryUtilized grouped by TaskId and ContainerName. Check whether the steps around Nov 30 and Dec 1 line up with task replacements, and include the ECS stopped reason if either task was killed. [2]
The most useful repro would be a fixed batch of requests to one app, followed by an idle period after requests and background jobs finish. Please note whether it’s plain chat or RAG and whether it uses streaming. If the same container’s idle baseline rises after each identical batch rather than leveling off, that’s a stronger signal to profile that process for retained memory.
To reply, just mention @dosu.
Docs are dead. Just use Dosu.
@vsvn-HoangTC Was tracing enabled for the affected app when you captured this graph (for example, a Langfuse integration), or was enterprise telemetry enabled? Was the app using knowledge retrieval (RAG) at the time?
I found a reason to ask in v1.18.0. In an isolated check of the trace queue, I submitted 250 retrieval traces with tracing enabled. The timer drained 100, then exited. After another 10 seconds idle, the remaining 150 traces still held references to their retrieved documents. With tracing and telemetry disabled, none of the 250 entered the queue. Knowing your configuration would help us tell whether this could explain the increase you saw. v1.18.0 queue implementation
If you have container-level metrics for that window, could you share memory usage in MB for api and worker separately, with the ECS task IDs distinguished? That would help identify which container stayed elevated after traffic subsided.