Performance: What do You think about writing nodes and blocks to static files for special purposes ...?
Hi
There are already some initiatives on this site, which point to the same direction:
Focus A: server load / response times
Focus B: integration with outer pages and content, even toher sites.
About Focus A:
How to avoid that high load situations get to much of a burden for the site engine?
Lets see:
under normal conditions every page and block produces several MySQL-requests, which is softened by different caching approaches: the general drupal cache and the new block cache for example.
But even these will produce database requests - eventhough less than "normal".
In a tough situation, where the bottleneck may not be the server itself, but the database connection, alternatives may be valuable, in order to reduce the overall load on the system.
So here is the thought I would like to share and eventuelly request not only Your opinion, but also some hand for coding the solution - which I can not do, because I am not a programmer.
Payment can be discussed.
1) Bottleneck nodes / feeds:
It was a simple excercise to see the impact in this topic.
The more modules and the more languages You install, the slower is the response.
Just for curiosity, we setup some 50 modules, plus some 20 languages, and almost fell asleep during while pages where produced and loaded : average times of over 67 seconds where no exception,
Serverload for node and feed request on shared hosting is therefore a hot topic.
Lets face it: what kind of worth can a CMS have by the variety and diversity of modules and functions, when these are almost unusable in real life situations.
Approaches:
There was a shy intent to have a module saving whole sites as static html versions on the server, and then only request the database, when certain conditions appy (aged, outdated pages, etc.) .
I do not know if this approach was totally abandoned, or if there is somebody working on it.
Question:
How difficult would it be, to just produce a plain html or text version of every page and every node or block so it can be referenced from within or eventually event from outside the server.
This seems specially important also for feeds and sitemaps, as they produce database queries with every request.
2) Bottleneck blocks:
In this point I would like to differentiate normal block operations, which we already can cache.
The other topic is integration of DRUPAL with none Drupal parts of a site or a site network.
Please see this scenario:
1) transition of sites: many sites have a history which is "no database" but a start with static pages.
Those sites many times have already implemented lots of solutions - may it be CGI/Perl or PHP from different sources.
To move such a old big site completely into Drupal seems to be a kind of adventure and especially a very complex, time consuming and most likely expensive task.
Why ?
Maybe not all functionality can be produced upfront by Drupal, so we have a problem.
So You may what to stick with some older scripts (agenda, links, etc.).
How to "join" such sites - step by step ?
The linking parts between the sections or parts of a site or site network are basically questions of
(A) menues / links and
(B) design / CSS.
Both joins can be done, for example with files or pieces of code which are inserted as needed in either version:
---- Drupal (The new site) would produce blocks or nodes, sitemaps as static elements.
---- HTML static old site would call those blocks or nodes to insert them as needed within the old structure.
By this approach You can move slowly, as needed. Maybe add blogs to an old static site, whithout the need to redo everything from scratch.
Additionally:
Under really high load, or a broken server, the system could be switched to static pages, so that server operation can continue somehow, whithout loosing contacts.
RESUMEE
imho it would be really great to have the option to save pages (themed or unthemed), nodes, feeds and blocks as static elements in a special directory structure - maybe we call it "/static/., so they can be called by what ever process a webmaster may need or create in oder to join different parts and versions of his site.
How difficult would this be and how much would it cost to make such a solution ?
Best regards,
Roland
Centroamerica.TV
A project that envisions partnership and
cooperation among media professionals.

You some links
Search for: http://drupal.org/search/node/static+pages
Dies: http://drupal.org/handbook/modules/page
and some more
http://drupal.org/node/23128
http://drupal.org/node/27882
http://drupal.org/node/52989
http://drupal.org/node/88364
Drupal with filecache system testing now
After posting the above, I found the versions of Drupal 472 / cvs.
So we are basically reinstalling a massive test scenario : aprox 20 Langauges, 50 modules and will go for some testing with little, and with lots of content.
Hopefuilly will report to You about outcomes.
Any tipp, suggestion, experience etc. is highly welcome.
Regards
Roland
Forget Flat Files
Believe me, I fully understand the frustrations of running Drupal on a shared hosting site and dealing with potential performance issues. I have a reseller hosting account and couldn't recommend any of the shared hosting plans I offer for Drupal. However, the performance issues are more due to what is (or what is not) being offered by the shared hosting company than it is with Drupal. What you propose about static pages is something I likely would have proposed more than a year ago. However, after spending a year with Drupal I think it's a crummy idea.
I'm just about to complete a significant project I've been working on with osCommerce, a shopping cart CMS. While storage of the products and module configuration is database driven, about everything else related to the site (especially theming) is based on flat files. While I finally have gotten osCommerce figured out, what takes me 10 minutes to change in osCommerce only takes only seconds in Drupal. To top all that, since osCommerce is not a complete CMS...I'm having to embed or link piece meal static pages into the site that I would never have to do with Drupal. While the client will likely be happy with the site and the end product is good...to me it's one ugly beast afraid to let go of the past.
Drupal is light years ahead of the game. Do yourself and your users a favor...and dive into Drupal with both feet. I'm telling you what you propose will give you more head aches than if you would have just spend the time migrating properly to a full Drupal site.
Consider me as "Been there, done that, and ticked off other CMS applications can't be more like Drupal!"
-Bryan
CMSReport
Thanks for the info and advice ...
Hi Bryan
Thank Your for Your great response.
I actually feel You are right with everything You say. Beginning with the quality "light years ahead", which is why I like this software and its handling.
Actually a simple solution would be to get onto a stronger hosting account or best5 - set up my very own server, with RAID support etc.
But even then, there are interesting aspects to cover, which could be done best from within Drupal, and maybe with some good reasons.
1) Transition from or Integration with other applications and sites, whoich may or maybe not php / mysql driven.
2) Simple security in operations. As far as I have seen, php/Mysql sites are vulnerable. Static pages are almost not vulnerable at all.
3) Simple business calculation of cost and opportunity. Cost is cost of operation. Opportunity referes to the opportunity to get the message out and only spend additional "power" for everything really interactive.
It does not make much sense to produce the same content over and over again, producing somewhat slower hits to databases, than simply get the page and throw it out.
Now ofcause I know, that this is easier to say than to make happen. But by now, I am happy - as You - with many wonderful things that can be done with Drupal. This tools is producing enormous appetite - but when it comes to real life operation whith sites which may receive or are proyected to receive a million hits per day, You may have problems even on You own server, as long as You are "vasting" huge amount of resources - as Drupal forces You to do at this time.
May be a simple set of features and options, not to difficult to program for real programmes, would bring much peace of mind:
1) every node, page, image or block should have a "switch" where You can save it directly to disk and get it from there, while the switch is on or while a certain condition is met, for example until updating.
This way You can reference the parts of Your site either way - as You see fit, and even integrate blocks with other external applications on the same server or others.
WHile I tried quite a lot with the cool devel.module recently, I got some idea on how and which blocks and piece I defenitely would like to have "static".
I also tried the somewhat forgotten Drupal Version called "filecache-cvs". Even totally overloaded installations get more speed, as long as You do not request something interactive.
Also, the piece of code that seems to requires most queries and loadtime seems to be i18n.
Well, I hope that next version really will bring some feature that allows a webmaster to produce a static version - at least partially.
Thanks again for Your thought and comments.
Roland
PHP caching
I have always recommended people look at setting their Drupal sites on a virtual private server (VPS). In that way you have some control for tweaking your server just for Drupal.
For myself, I use eAccelerator on a VPS which address most of the performance issues I've seen with Drupal. I've also heard a lot of good things about APC from other Drupal users. Perhaps if you want to stick with shared hosting, you may be able to find a hosting company that provides PHP caching. Anyone able to proivde such a list?
I know this doesn't address your need for "flat flies" and other festures you discuss. However, I know others will read this post looking for solutions to tweak Drupal performance and I think PHP caching is likely one of the better solutions. A list of PCP caches can be found at Drupal: http://drupal.org/node/2603 . Also, on a seldom visited blog of mine I talked a little about eAccelerator and the Zend optimizer. Jeff Moore (from the PHP crowd) responded and better explained to me what the Zend optimizer does and doesn't do. His comments are a must read and filled my puny brain with lots of good stuff.
Bryan
CMSReport