Question

We are having a portlet application which uses Spring 3.1.0.Final and deployed on WAS 6.1.

We have multiple portlets using Spring MVC in past. This is the first portlet with Spring 3. I am using annotations and autowiring in most of the places in the code.

When this application is deployed in server the base heap usage jumped by 25+ MB.

I did profiling using Jprofiler and found that StringHTTPMessageConverter is loading all charsets in memory which occupies around 14 MB of memory (com.ibm.nio.charset.Charset takes up memory)

Since it is a portlet app I have org.springframework.web.portlet.mvc.annotation.Ann otationMethodHandlerAdapter bean explicity defined in my configuration and not org.springframework.web.servlet.mvc.annotation.Ann otationMethodHandlerAdapter

This is what I have tried doing so far

1) Change StringHttpMessageConvertor settings

Defined the following bean in my configuration

<bean class = "org.springframework.web.servlet.mvc.annotation.An notationMethodHandlerAdapter">
<property name = "messageConverters">
<list>
<bean class = "org.springframework.http.converter.StringHttpMess ageConverter">
<property name = "supportedMediaTypes">
<list>
   text/plain;charset=UTF-8
</list>
</property>
</bean>
 </list>
</property>

No luck with this.

2) I have defined in my config file. As suggested in some posts I also tried the above configuration by commenting out the tag. But no luck.

3) As suggested in some forums I Tried to write BeanPostProcessor but it could not find the StringHttpMessageConverter class.

Do I need to explicitly define org.springframework.web.servlet.mvc.annotation.Ann otationMethodHandlerAdapter in my configuration?

My questions are

1) Is there any way to avoid all charsets loading up in memory?

2) Also Is the 25 MB jump in base heap justifiable ? What is the usual memory foot print of Spring 3.1.0 ?

I am running out of ideas Any help regarding fine tuning the Spring framework would be highly appreciated.

Thanks and Regards

RaviG

Was it helpful?

Solution

Update: Problem Solved, removed tag from the configuration. We are using Portlet MVC Annotation Handler adapters so Servlet MVC Annotation handler Adapters were unnecessary and are not needed at all. The StringHttpMessageConvertor was pulled in by Servlet MVC Annotation Handler tag. The StringHttpMessageConvertor in its constructor has code to pull in the charsets in the memory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top