Reputation: 581
I was getting following exception while using Web Client.
org.springframework.core.io.buffer.DataBufferLimitException: Exceeded limit on max bytes to buffer : 262144
which indicated that codec limit has to be increased via MaxInMemorySize property.
I wanted to understand if MaxInMemorySize is set to X, does that mean for every request our application puts aside X amount of memory for buffering upfront or that the memory is assigned dynamically as per the response size of each request.
Upvotes: 2
Views: 5756
Reputation: 1590
I faced a similar error updating the below property in spring-boot application.yml helped resolve this error.
spring:
codec:
max-in-memory-size: 700KB
you can change the default DataBufferLimit using the above property.
You can find more answers here
Upvotes: 0
Reputation: 11
Spring maintains some amount of buffer which is MaxInMemorySize (around 250KB). This can be modified by adding a property to the application.properties / application.yml.
example:
spring.codec.max-in-memory-size: 10MB
By adding this, the max in memory size will be increased to 10MB.
Coming to your question, since this is a predefined value, the spring internally creates some buffer rather than creating individually for each request.
Upvotes: 1