On a project that I am working on we encountered some performance problems.
We decided to drop hibernate in favor of plain Jdbc to gain database performance.
By converting our code to Jdbc we achieved the performance that we aimed for but the code quality seems to have deteriorated. And it took us three months to implement the system, which has me wondering if throwing in more hardware would've been less expensive.
What would you do to optimize your application in a manner that limits side affects on architecture and complexity? (Mainly interested in answers from perspective of web applications but other perspective are welcome)