Showing posts with label performance. Show all posts
Showing posts with label performance. Show all posts

Monday, November 14, 2011

Implementing High Performance Drupal Sites

The Main Aspect covered during the Session:

  1. What is “Performance”?
  2. Different Layers of Performance
  3. How to configure Drupal for Performance
  4. Writing Drupal Modules for High Performance
  5. Some Advanced Techniques & Caching Systems
  6. Event Based Caching
  7. Drupal 6 vs Drupal 7
  8. Performance in Drupal 8

Questions Asked after the Session:

Q: Why did you use Panels for the Deccan Chronicle Home, though Panels could be a performance hazard?

A: Panels with the support of Ctools provides us many features to build a page or mini panel with drag and drop, create own layout, etc. These abstractions/features make panels a heavy module to use. Yes absolutely true, but we need to balance user experience and requirement with performance. Hence Panels was to give better user experience to the Editor who manages the site. Being aware of the implication on performance, we planned the cache very effectively by using time based (tradition) and event based cache clearing systems. We enabled the cache in all panes and pages in the panels.

Q: Is  Boost a good option?

A: Boost is a good option for anonymous users and hosting is in shared environment, where you will not have option to install other advanced cache support modules like memecache or varnish. Boost will serve the cached static html files for the configured cache lifetime, once the lifetime expired static html page will be regenerated. When we compare Boost and Varnish, Boost caches the content and delivers it without disturbing MySql. Varnish works at a layer above Apache. Another difference is Boost uses the file system (disk) where as varnish uses RAM. Refer  http://groups.drupal.org/node/46042, http://cruncht.com/95/drupal-caching/. The benchmarking helps to decide that varnish is better than Boost. As the time old concept RAM is faster than Disk. So if you have infrastructure to install Varnish then Varnish is the better option.

Q: Writing custom query to get required information from node vs using node load

A: This question was in many of the developer's mind. node_load is a function which loads or constructs the node object by querying the database. This function uses static variable so if the node object is constructed once, then from next time it will be serving the node object from the static variable (static variable life time only limited to a single page load). Now we see how to decide on node_load or querying the table, this is depends on the use case I suggest. The Answer is written with Drupal 6 in mind.

In a page if you want to list ten other titles written by the author of the node we are viewing, then go for Querying the table. This is because we only need to query a single table to get this information. Node load will be a overhead, considering there will joins with the node revision table, CCK fields table.

In other case you want to display list of node snippets (set of fields like title, teaser, date of node, configured fields etc. ) In this case we should use node_load, because node_load not only loads the node object from the database, it runs required on the node object. Some examples could be alternation in the teaser length or changing the date format etc.

Q: Do we use cache_clear_all() or clear the cache based on CID?

A: While writing code to clear the cache in our module always prefer to call Cache_clear_all by passing the CID and table name, by this only the cache content of the CID in the table will be get cleared. Or if you want to clear many rows you may use the wildcard option provided in the function.. In other case if you call cache_clear_all without CID and table, all expired cache content from cache_block and cache_page tables will get cleared (In case you have not assigned minimum cache lifetime then all temporary cache will get deleted). If you are storing the cache in other tables it is required to specify the table name.

We used this concept while creating event based caching system with in our application.

Note: Use Cache_clear_all() with out arguments only if required, as if not used properly it may defeat the purpose of caching.

Q: How do we show the dynamic content when we cache?

A: When we cache the content for a lifetime 10 mins, then your user will get the static content from cache for first 10 mins. After the expiry of the lifetime 10 mins, cache will be rebuilt and new content will be shown. If you don't want your user to wait for 10 mins to get the new content, then may choose from other available option is using Ajax to load the dynamic content considering the impact.

Tuesday, August 11, 2009

Performance and Drupal

As we worked towards some exciting performance gains, some of our learning

  1. Use Drupal's Page Cache
  2. Run Mysql tuner to understand how Mysql responds to your site
  3. We never had in our page/panel or block a code rendered directly from a view, all our view results were cached. The lullabot article on caching, The Beginners guide to caching could be a very good starting point.
  4. Do not panic by large no of queries, the queries with longer execution time are critical - we focused on the ones on our large tables - NODE, session, user, log, taxonomy tables
  5. Queries with inner joins or distinct clause were also marked and reviewed
  6. We had large benefits by restricting the log size, periodic clearing of the session tables
  7. We did add a patch for Drupal look up path and url redirect, will have that appended to this list.
  8. We moved from Drupal search to Google search!
  9. USE of PHP accelerator is a must

Checkout:
  1. Server tuning considerations: http://drupal.org/node/2601
  2. http://2bits.com/articles/performance-logging-module-log-performance-statistics-drupal.html
  3. http://blamcast.net/articles/speed-up-drupal
  4. http://buytaert.net/drupal-performance

Sunday, October 12, 2008

Nagarajan in Drupal Chennai

I am proud to announce that my colleague Nagarajan has started a Drupal Blog. He has expert knowledge in various aspects of Drupal! For a very informative nice article on Performance improvement guidelines for Drupal sites, visit: http://nagarajan-drupal.blogspot.com/

Thursday, July 3, 2008

DRUPAL SITE PERFORMANCE

Terminologies

Load balancing
: Is the technique of sharing work load among many resources so no single resource gets over loaded!
e.g DNS Load balancing -is to distribute requests to different servers though resolving the domain name to different IP addresses of servers, Database Load balancing - is to balance database access requests among cluster of database servers, in order to achieve database scalability and high availability

memcached
: High performance, memory-object caching, used in speeding up dynamic web applications by reducing the number of time the database has to be read.

Must reads on Drupal Performance
1. Essential performance tuning for Drupal web sites by Nadeau software consulting -- This article is FAB! Just what we need to do for a drupal site!!
2. Drupal performance by Dries Buytaert
3. Scaling with MySQL replication
4. Optimizing Apache and PHP
5. Server tuning Consideration - from Drupal Handbook

Search This Blog

Chennai Drupal Community

drupal.org - Community plumbing

Shyamala's Drupal SEO