Hi, I heard a lot of similar questions about drupal performance. Can agree that we are not able to create facebook using drupal, should mention that even pure php is not very suitable for this purpose. (As you know facebook created own php extension which compiles php code in c and execute it faster then native php interpreter.) Drupal is disigned for sites which have mostly anonymous users as main audience. There are sites like examiner.com which designed for logged in users. Such sites use drupal with mongo as db engine, but there are not too many of them.
Yes drupal is slow, but
- Drupal gives real security,
- Drupal collect knowledge of thousands of developers all over the world,
- Even non technical user can create simple site using drupal,
- Drupal support multiple db engines (it is one of the reasons why it is slow),
- Drupal caching system can provide performance raise,
- Multiple modules can be used to increase performance,
So let's discuss how to make drupal faster.
1) In my practise I have worked with rather well known sites which was developed in an awful way. Why a lot of drupal developers resolve issues by installing dozens of new modules? I have an answer: because they don't know drupal api and php. Sometimes to resolve small issue we need to write custom module (only one small custom module), but if we don't know api or at least php it is impossible and we install and install modules and theirs dependencies (each module can add cron jobs, db tables, multiple hooks called on each page request). It is good that drupal community have a lot of modules but most of them have too many features. So let's create first and as I think one of the most important statements.
If you want to create fast drupal project, please learn drupal api and php (if not don't say that drupal is so slow);
2) Drupal caching is rather complicated question, anyone who visited yoursite.com/admin/config/development/performance page saw few performance settings. But not everyone really understand what they means. Let's discuss them in details.
Cache pages for anonymous users - This is simple, when we check it anonymous users will see cached page which is stored into cache_page table. It means that there will be no page rendering and no db queries to load entites only query to get page cache. We definitely need this setting checked.
Cache blocks - if we check it all blocks which have enabled caching will be stored in cache_blocks table and no resources will be wasted on theirs rendering. If we want nice performance this check box should be checked.
Minimum cache lifetime - is a time which cache will live after any cache clearing event will occur (among of this event are cron run, cache clear and content editing). This setting description says "Cached pages will not be re-created until at least this much time has elapsed" + after cache clearing event. It doesn't mean that if your mimimun cache lifetime is set to 5 minutes your page cache will be regenerated every 5 minutes.
Expiration of cached pages - "The maximum time an external cache can use an old version of a page." Like external cache can be used Varnish. This setting means that expernal cache will live not less then specified period of time and when you will flush drupal cache external cache will not be flushed. There are different modules which flush Varnish cache on some events among of them I can recommend acquia_purge module. Acquia purge is designed for acquia cloud environment and it use expire module. Expire module is very usefull when your Minimum cache lifetime is much greater then none.
I can recommend you wonderful article about caching in drupal.
If you want to create fast drupal project, please learn about drupal caching (if not don't say that drupal is so slow);
3) Views module
Everyone who used drupal heard about wonderfull views module. This module is really great because it allows us to create wonderful pages without mysql or without drupal db api knowledge. It is good but ... As everything good and complicated it cause performance issues. For example when we use custom code to get node id and then make node_load() and node_view() custom block will be executed approximately three times faster then similar views. Views add huge not optimized queries and a lot of php processing.
One more thing about views. Default views pager use count query before main query execution. As we know in innodb storage count queries are very slow. To avoid them we can use views_litepager module. You just need to enable it and choose among pagers in your views settings.
There are one thing which can make views faster. It's views built in caching.
If you want to create fast drupal project (and use views), please learn about views caching and use liepager module (if not don't say that drupal (and/or views) is so slow);
4) Sometimes modules should be updated and updates can be related to performance enhacements, so to keep your drupal site fast:
Please keep all modules updated to latest stable versions.
5) When we are going to install new module we should always look at its issues, especially at performance issues. Any module which set session for user breakes cache for anonymous users.
Please look at module issues before installing it on your drupal site.
6) Before releasing sites we should monitor sql queries performance and provide php profiling. For both purposes devel module is very usefull. You can monitor sql queries simply by enabling Display query log setting at this page yoursite.com.com/admin/config/development/devel. Query log will be displayed at the bottom of the each loaded page. For php profiling best solution is xhprof php extension. It is available for Mac and Linux. Here is very nice article about xhprof installation and integration with drupal. I will provide some example, recently I used xhprof to profile on of our sites. If you will look at example you will see that xhprof is very usefull.
Please use queries log and php profiling to find bottlenecks.
8) The most important thing to make your site faster and better.
Please contribute into drupal community. Create patches, contribute modules, themes. Together we can make drupal better.
So lets make some summary:
1) learn drupal api, and do not install to much unneeded modules;
2) Learn how to use drupal caching;
3) Do not use views without caching and use views_litepager module;
4) keep your modules updated;
5) Look at performance issues before installing new module;
6) Provide sql queries analysis and php profiling to find bottlenecks;
7) Use pressflow for high performance;
8) Contribute into drupal community.
So thats all, thank you for reading! Continue doing drupal!