Wednesday, December 12, 2007

LinuxPerformance Tuning(apache,tomcat,linux) and related

Web profiling
-- HTTPAnalyzer --
-- YSlow --CSS,Javascript report , time/size measurement for individual component is good.
-- FireBug -- Net performance, for a quick analysis.
--Open STA
Tomcat profiling
-- JProfiler
-- Hot spots ,JDBC queries(J2ee components), object instance count are useful.

--Database connection pooling with optimal values.
Connection leakage in DBCP can be easily detected by settin logAbandoned=true in resource configuration (server.xml). This is a very nice feature and throws up the exact location of the code which is not closing the connection. These connection issues normally come up during load testing.Also the jndi resource configuration for DBCP should have ideal settings. The one used for our project is below:

[GlobalNamingResources]
[Resource
name="jdbc/cmpPubPool"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:oci:@[TNSNAME]"
removeAbandoned="true"
logAbandoned="true"
maxActive="2"
maxIdle="2"
initialSize="2"
maxWait="-1"
username="[USER_NAME]"
password="[USER_PASSWORD]"
validationQuery=”select 1 from dual” /]
[/GlobalNamingResources]


JVM Tuning
Modify the heap size in JAVA_OPTS.


Apache tuning
prefork or worker module can be used.
prefork is non thread based.
Worker module is multi threaded and may yield a better performance.

Linux
--$top -- to check CPU status

top


Top has probably hundreds of keys to do whatever you want. A few are most useful for me.


The > key sorts by the next column (%MEM) instead of the default (%CPU). < sorts by the previous column.


Hit c
to toggle the display of command line arguments. Useful for me when I
have a lot of processes that otherwise just show up as “java”





Typing A
brings up the alternate display, showing processes sorted by different
fields with different columns. One section shows a nice memory-centric
view, for example.
Hitting z turns on colors. Z brings you to a color selection screen where you can pick colors you want. B turns on bold for some fields.
Hit W to save all your configuration changes to ~/.toprc where it will be loaded next time.
Type k allows you to kill a process without exiting top.

-- kill -3 <TOMCAT_PID> will log the threads running/inactive details useful for troubleshooting performance issues.
On windows use CTRL +Break.

Hardware
-Linux memory size can be checked using
cat /proc/meminfo --Gives RAM size
free -m -- Gives RAM size in MB (-k for kb)
df -H -- Human readable format of hard disk size


Useful links
http://jha.rajeev.googlepages.com/web2push



Powered by ScribeFire.

No comments: