Luciano Mammino has posted six tips for blazing fast web applications to his site. These tips aren't as much specific to the code (though they're related) as they are general good practices around architecture, development work and common issues.
In this post I will try to highlight some of the most common principles that you have to take under consideration when you want to achieve a great level of performance while building a web application (specifically on the backend part). I believe the concepts discussed here can be applied to any language and framework even if, due to my specific experience, I will mention some examples, design patterns, conventions and tools that are mostly used in the PHP world.
His post lists out six main rules along with some description and links to other tools for each:
- Avoid premature optimization
- Do the minimum amount of work to solve the problem
- Defer the work you don't need to do immediately
- Use cache when you can
- Understand and avoid the N+1 query problem with relational databases
- Prepare your app for horizontal scalability when possible
There's lots of good tools mentioned here so find one that fits your needs and helps solve the issue. There's also some good articles mentioned, giving more information about a particular topic or other perspectives on how to solve it a different way.