-
Notifications
You must be signed in to change notification settings - Fork 654
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Direct Memory grows from 5MB-1GB leading to application crash #3558
Comments
@abhishek-sharma-20 Is it possible that you see this issue spring-projects/spring-framework#29772 ? |
Hi @violetagg We did more analysis and we are seeing same issue in VMs as well, in VMs as we have shared memory hence we don't see any crashed but we observed reactor_netty_bytebuf_allocator_used_direct_memory gauge is going till 1.3 GB |
@abhishek-sharma-20 Can you specify your limit configuration for direct memory? |
Hi @violetagg We don't have any configuration for direct memory we have a memory limit for each pod which is 4GB. Our application starts with 3GB of heap size and when we run it on load direct memory reaches 1GB leading to pod memory limit break (3GB heap + 1GB direct memory) and pod restart Additional we have loop-resource=300 and each response size is 5MB which equate to 300*5MB =1.5GB(at peak) which is what we see direct memory used how ever if direct memory is getting pooled this should not reach 1.5GB as per our understanding (please correct) |
@abhishek-sharma-20 Then isn't this expected? |
You do not have sequential requests/responses (I assume)? The direct memory is used not only for the concrete data that comes with the request/response but also for internal implementation (TLS handshake, parsing HTTP etc.). Spring Framework uses it for decoding/encoding. |
Yes That is correct we wanted to understand that once the load(number of request or size of response) is reduced will the direct memory be released or not? In our case even after reduced load direct memory is not reduced. We are also running performance test with less number of loop resources and will share more insights once we are done with test |
Check this https://projectreactor.io/docs/netty/release/reference/http-client.html#metrics This will not be reduced |
We have a routing reactive application which take a request from client and then routes this request to a backend. We originally had a non-reactive solution now we are moving to reactive solution. We have a flow in which backend response is large (1MB-5MB) in these cases when running with 2-3TPS for a duration of 30mins to 1 hour we see application getting restarted automatically . On investigating we saw it is getting restarted because application is consuming more memory and hitting memory limit of pod and leading to restart. On observing memory usage patterns we saw direct memory was keep on growing from 5MB - 1024 MB and then leading to application restart.
Expected Behavior
Application should be able to support large response size and should not consume more memory than expected.
Actual Behavior
Application is consuming more memory than expected and leading to application restart.
Steps to Reproduce
###HttpConfig.java
###HttpWebClient.java
###ResponseController
Above are our classes used for this app and below is JVM arguments used for this application
-Xmx3072M -Xss256K -Xms3072M -XX:+HeapDumpOnOutOfMemoryError -verbose:gc -XX:+ParallelRefProcEnabled -XX:ParallelGCThreads=4 -XX:ConcGCThreads=2 -XX:MaxGCPauseMillis=500 -XX:MetaspaceSize=64m -XX:MaxMetaspaceSize=512m -XX:+DisableExplicitGC -XX:MaxJavaStackTraceDepth=15 -Dspring.config.location=optional:classpath:/,optional:classpath:/config/ -Dorg.springframework.boot.logging.LoggingSystem=none
Possible Solution
Your Environment
Below are system details
netty
, ...):java -version
):uname -a
):The text was updated successfully, but these errors were encountered: