Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Scaling Drupal [closed]

I am working on a Drupal based site and notice there are a lot of seperate CSS and js files. Wading though some of the code I can also see quite a few cases where many queries are used too.

What techniques have you tried to improve the performance of Drupal and what modules (if any) do you use to improve the performance of Drupal 'out of the box'?

like image 518
Ben Avatar asked Feb 21 '09 16:02

Ben


People also ask

How scalable is Drupal?

Drupal 8 and later versions, like most modern web frameworks, can scale well to millions of users if it's optimised well. Conversely, a poorly optimised site can be slow to load for a single user.

What is server scaling?

Server scaling describes adjusting the computing power of servers, usually to increase power by “scaling up”. This can be done either by scaling vertically or horizontally. Vertical scaling involves replacing the server with a larger, more powerful one.

Why is my Drupal site slow?

Reasons Your Drupal Website is Slow Loading File size and total number of files both play a role in the overall performance of your Drupal website. If you have too many large images or other media your website is more than likely going to be slow. Uncompressed large image files can easily slow down your Drupal website.


2 Answers

Going to the admin/settings/performance page, turning on CSS and JS aggregation, and page caching with a minimum lifetime of 1 minute, will give you an immediate boost on a high traffic site. If you're writing your own code and doing any queries, consider writing your own discrete caching for expensive functions. The linked article covers Drupal 5, not 6, but the only change in d6 is the elimiation of the serialization requirement and the function signature for the cache_set() and cache_get() functions. (Both noted in comments on the article)

On large scale sites also consider dropping a memcached server onto the network: Using the memcached module, you can entirely bypass the drupal database for cached data. If you have huge amounts of content and search is a hot spot, you can also consider using lucene/solr as your search indexer instead of drupal's built-in search indexer. It's nice for a built-in indexer but it's not designed for heavy loads (hundreds or thousands of new pieces of content an hour, say, with heavy faceted searching). The apache solr module can tie in with that.

If you're making heavy use of Views, be sure that you've checked the queries it generates for unindexed fields; sorting and filtering by CCK fields in particular can be slow, because CCK doesn't automatically add indexes beyond the primary keys. In D6, preview the View in the admin screen, copy the text of the query, and run it through EXPLAIN in mysql or whatever query analysis tools you have.

Tools like YSlow and Firebug can also help you spot slow stuff like massive image files, JS hosted on remote servers, and so on.

like image 187
Eaton Avatar answered Oct 14 '22 19:10

Eaton


Drupal 6, out-of-the-box, provides css and javascript aggregation --- most css and js files will be combined into a single file (and thus a single HTTP request), and are also whitespace-shortened (to reduce bandwidth consumption). You can enable this under /admin/settings/performance .

Also on that screen are controls for Drupal's (very effective) cache, which helps reduce the number of database queries.

Additionally, because Drupal (and all the modules you'll probably have installed) has a ton of PHP source, using a PHP opcode cache such as APC helps significantly decrease the request time.

like image 38
smokris Avatar answered Oct 14 '22 19:10

smokris