Avoid running SQL queries inside a loop
SQL queries inside a loop seriously hinder performance, especially if the SQL server(s) are not on the local machine. That is because these servers are designed to handle several selections, insertions or modifications in one single query or transaction.
Wrongly used, these queries unnecessarily consume CPU power, RAM and bandwidth.
Employ asynchronous processing when possible
When the interaction with the user results in long and heavy processing by the server, employ asynchronous processing when possible. The idea is to encourage the user to trigger the processing and then reconnect once it is complete e.g. by receiving an email with a link.
This method allows processing to be done in batches, often more efficient in terms of resources than on-the-fly synchronous processing. This frees up the presentation servers so that they can handle other users while the processing is handled asynchronously server-side.