Ah, well, having wrestled with performance stuff an awful lot myself (always related to stressing out the MySQL server too much) I could give some tips probably.
1. Don’t over use embeds.
They are pretty light on the SQL server (generally speaking) but I’ve seen people go way overboard on them and then they bog things down.
2. Pay special attention to parsing order and conditionals.
Especially important with conditionals (simple versus not simple). Simple conditionals will parse before whatever they enclose. But I’ve seen many of them in close proximity cause EE to get confused and still parse the stuff inside first. Just ran into this this week actually and it caused serious problems as suddenly I had roughly twice the number of queries occurring.
3. Use as few entries tags as possible and keep the sorting and order parameters to the indexed columns (entry_date, entry_id, weblog, etc…)
The custom fields aren’t indexed which means sorting on them requires MySQL to work harder in order to figure out which entries to show.
When your table of entries gets big enough even things like selecting entries off of categories (which are fully indexed but in a separate table) can start making the SQL server work pretty hard.
4. Try to be very careful and smart about how you use caching.
You can make things worse using tag caching and page caching too much.
Tag and page caching are both URL based. Meaning if you Page cache an embed and it exists on 100 different URLs a cache gets saved for each URL not just for the one instance of an embed. Same goes for Tag caching. End result (if your site is busy enough) is that you end up with a new performance problem due to the GIGANTIC cache clearing and being rebuilt too often. Likewise writing to/and deleting from the disk can also create a new bottleneck.
Finding ways to use Page and Tag caching that don’t create multiple caches each time the page gets called in a different URL are pretty helpful.
5. Take a look at Solspace’s Template Morsels module. It solves the multiple cache issue and the disk write/delete issues. But introduces it’s own as it completely ignores the URL so things like pagination can’t be used unless you get kind of hackish with your usage. I’m using it in ways it wasn’t intended and it sometimes backfires one me as a result.
6. Keep in mind that solving one bottleneck often causes you to discover a new one.
It’s frustrating but fixing one issue sometimes just causes another one as your new found performance allows the traffic to push another aspect of your server harder than it could before.
Look at large sites struggles even with Memcached (which is so efficient compared to other types of caching that it’s ridiculous) but sites like Facebook and Twitter have managed to find ways in which it will bog down too.
I’m sure all of this has been written about before though and I actually seem to remember a WIKI article already existing on this. Maybe I’m wrong though.
Jamie