Strange memory usage #2589
-
Bug ReportVersionaxum v0.7.4 PlatformLinux [..] 6.7.2-arch1-2 #1 SMP PREEMPT_DYNAMIC Wed, 31 Jan 2024 09:22:15 +0000 x86_64 GNU/Linux Cratesaxum = "0.7.4" Descriptionsimplescreenrecorder-2024-02-07_03.49.11.webm My code:
Please let me know if I have made any errors in the design of the Bug Report. |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Started noticing this as well, memory increasing by ~100-200kb per request. |
Beta Was this translation helpful? Give feedback.
-
Its likely just that the allocator is not releasing memory back to the OS. |
Beta Was this translation helpful? Give feedback.
-
Try this https://docs.rs/mimalloc/latest/mimalloc/ Mimalloc allocator performed best with the axum in my projects. |
Beta Was this translation helpful? Give feedback.
-
I decided to put my app into a docker container and cap the memory at 50m. I used wrk to generate some load I just did 1 thread 1 conn for X minutes to watch it accumulate. I could get the memory usage right up to 99+% but could never get it to pass 50m and fall over. This was using mimalloc. On the host system which has 40gb of ram, I did the same request with same test configuration, but let it go further and eventually settled at 160M, I left both running taking no requests overnight say at least 6hr+ but neither the container or host reduced any further. It was same compiled binary in release mode, with identical requests and responses being received. It makes it really tricky to understand the behavior as you could ramp up from very low memory usage, to an unknown idle state or configure your minimum required memory. This makes it difficult to know when you should potentially scale your resources up or just general configuration. |
Beta Was this translation helpful? Give feedback.
Try this https://docs.rs/mimalloc/latest/mimalloc/
Mimalloc allocator performed best with the axum in my projects.