Drupal coder

performance

Performance and SEO impact of not rewriting your urls to use or not use www

Here's a quick tip which will influence your performance and SEO. It's just about uncommenting 2 lines of code in the .htaccess file that ships with Drupal (and replacing some text), but I've seen a lot of sites that tend to forget this.

Suppose your domain is something like yourdomain.com. Check now if you can access your site by prefixing your domain with www. and by not doing it. So check if http://www.yourdomain.com is accessible and if http://yourdomain.com is (without redirection to one of the two). If so, this article is for you.

December 20, 2010Drupal, performance, SEO, url rewriting

Three things we learned from indexing a Drupal site with millions of nodes in Apache SOLR

For one of our clients, we are running a Drupal site with about a millions of nodes. Before launch, those nodes are imported from another database and then indexed into Apache SOLR. The total time to index all of these nodes in an empty SOLR instance is measured in days rather than hours or minutes.

A bit too long to do this import regularly. So me and my (XDebug) profiler delved into the Apache SOLR module code to look where we could scrape of a few hours/days of the execution time.

Seemed like in our case, there were 3 components responsible for a large share of the execution time. Let's have a look.

BTW. We are using the latest dev build of version 2 of the Apache SOLR module.

September 06, 2010Apache Solr, Drupal, performance, search

An overview of Drupal's cache_clear_all uses

Drupal has a very simple, yet powerful (low level) caching system. It provides 3 functions that should please all you caching needs: cache_get, cache_set and cache_clear_all. The first two are pretty straight forward to use, but the third one might take some time to wrap your head around.

It accepts 3 argument: a cache ID, table cache and a wilcard boolean. Each combination of these 3 has a very different result. Here's an overview of all combinations.

May 19, 2010Drupal, performance

Performance tip : disable Drupal's core search indexer when using Apache Solr

Here's a quick tip for people using the (simply awesome) Apache Solr Search Integration module.

The Apache Solr module depends on Drupal's core Search module. This means the Search module will be enabled too when the Solr module is installed. As soon as the core Search module is enabled it starts to index all your nodes and stuff too. This not only takes time to run, but also fills up your database (search_dataset, search_index, ... tables).

Most of the time when you are installing the Apache Solr Search module, you don't need Drupal's core search form and replace the search form with the Apache Solr one using the Apache Solr module setting "Make Apache Solr Search the default:". You have now disabled the core Search module's form, but you have not disabled the indexing. To disable the indexing and save some CPU cycles and database space, just go to your site's search settings page (admin/settings/search) and set the "Number of items to index per cron run" to 0.

search-index-limit.png

Spread your cron schedule on machines running multiple Drupal sites

Here's a quick tip for people running multiple Drupal instances on one server: don't run cron for all sites on the same moment but try to spread it.

Suppose I have 5 sites: site1.tld, site2.tld, ... and I want to run cron each 12 hours. I would enter the following using crontab:

March 05, 2010cron, Drupal, performance