views:

46

answers:

2

I'm working in J2EE web project, which has lots of Java, SQL scripts, JS, AJAX stuff. Its been 5 years for project still running fine.

I have assigned with work of performance evaluation on the project as there might be some memory usage issues, DB fetching logic delays and other similar weak performance areas. From where should I begin?

Any best practices to make project better?

A: 

The best things is to measure where your bottle-necks are? Things like jprofiler etc. are needed for such work.

khmarbaise
A: 

Typically when someone pays for system performance improvement he knows almost exactly what he/she is not happy with. So first compose the list of what problems are. The fact that the system is "slow" is not a problem because "slow" is always relative to something "fast" (like system cannot keep up with incoming traffic). Once you have a list, roughly identify components being "slow". Then work with logging (make sure each message is prefixed with millisecond-granularity timestamp, reconfigure logger if required). Check what is logged for "slow" operation, how much time does the system spend in each component. Once you roughly identified the slow component, increase logging verbosity for this particular component and try to figure out what is wrong with it (slow DB, poor code, etc.)

If you just need to make the system faster, you can find out the first place to optimize by repeatedly running "jstack" on the process running under maximum load (some call this method "monte carlo profiling"). By comparing subsequent stack dumps you can find where the application spends the most of its time statistically and improve corresponding block.

It is also useful to connect with jconsole to the running project and track memory consumption while looking in the log files to find out who allocates the most memory.

bobah