Monday, July 27, 2009

liferay performance-tuning

----------------------------------------------------------------
Performance Improvement
----------------------------------------------------------------

a) Memory - garbage collection thru Admin interface

b) Parameters to JVM while starting tomcat
-Xms128m -Xmx1024m -XX:MaxPermSize=128m

c) DBCP instances - increase it in ROOT.xml

d) Properties file changes
last.modified.check=false
theme.css.fast.load=true
javascript.fast.load=true

e) Servlet Filters

Total of 15 filters. Disable the ones that are not required. eg.

CompressionFilter
StripFilter

Open web.xml and comment the entries for these filters.

Similarly for,

CASFilter
NtlmFilter
VirtualHostFilter

The fewer servlet filters you are running, the less processing power is needed.

f) Portlet

Edit the following files to disable certain portlets from getting deployed to the portal server.

portlet.xml
liferay-portlet.xml

Restart the server

g) Database design

Ensure all the search colums are indiced properly.
Do periodic house-keeping on the database indices.
Proper design of the database tables keeping in mind the normalization techniques.

h) Get the cache-ing enabled for database objects.

By default only the User_ table is cached. Cache other tables as well that will be frequenly accessed.

Refer to the place where you can do this setting.

i) Application Layer

Write your code in such a way that you make lesser database / hibernate calls.

Remember, every call to the persistence layer is going to take time. So be very careful using them. Never use persistence layer calls inside loops.

Write optimized queries when you put them in custom-sql files.

j) UI design

place fewer portlets on a portal page.

when you use images / flash objects make sure that they are very small.

If you write custom css / javascript compress them using YUI compressor so that they get downloaded to the browser pretty fast.

Replace Tinymce in the place of FCKEditor.

k) Setting logging mode to ERROR.

1 comment :

Saurav Suman said...

Hi Arun,

We are creating an application which uses CMS portlet exhaustively. While testing with 10 users with 20 MB of file the system throws a heap space problem.

I am using tomcat 6.0.20 and my java_opts are JAVA_OPTS="$JAVA_OPTS -XX:NewSize=700m -XX:MaxNewSize=700m -Xms4096m
-Xmx4096m -XX:MaxPermSize=128m -XX:+UseParNewGC -XX:+UseConcMarkSweepGC -XX:
+CMSParallelRemarkEnabled -XX:SurvivorRatio=20 -XX:ParallelGCThreads=8"

any pointers would be appreciated.

Thanks,
Saurav