The performance can be optimized in different tier or layer.for example,
in view layer, if you use javascript or ajax, definitely the performance will go up. Because the business logic has been distributed to each client machine. The client holds the business data and part of the business logic compared to the solution that server has to do all of the business logic alone, should be faster enough.
in web layer, you can set up load balance to distribute requests to clusters but this is normally supported by application server. it is a general solution to parallel your application and optimize your performance.
in business layer, you know what you gonne do and you can design a specific parallel solution for your application. The principle is as follow:
1. find out all the unit task you need to implement your business logic
2. check the sequence of these unit tasks. if they depend on each other, then you dont have luck.
if some tasks are independent from each other, then you can parallel them in different CPUs or different machines.
but Be careful of one point: the limit of your parallel solution is the communication among all these servers.
So finally if you finish all your unit tasks in different machines , they have to gather to one machine and continue their sequential tasks and it may lead to a situation that some results
have to wait for the other slow calculations.
in short, when you use parallel programming, you have to be clear that performance cannot be optimized endless. sometimes 1+1>2 which means u have more cpus but the performance is reduced.
3. in persistent layer, the best way is to let DB handle everything and optimize your SQL to fit for that DB SQL parser.
Because lots of DB interpret SQL ability are different. please check the reference and benchmark them.
at least in Oracle, better to call a stored procedure in your java code and let the real sql stay inside the stored procedure.
So that is the fastest way.