Contributing to Drupal could be fun! It amazing the way Drupalers collaborate online to as much as have Drupal, Drupal's contib modules, and now the Drupal redesign. The power of Drupal, to promote Drupal!
Working in the community and all of your sudden your horizon seems extended, you are connected with people you have never met before. You are working together as though you knew each other for so long.
Being with people brings you joy. It's amazing to discover the joy of being with them online! I am thoroughly enjoying collaborating online for Drupal.
The different channels you can collaborate on:
IRC: Drupal in IRC and Firefox addon for IRC, Discussions online, Groups, Google groups.
Join and contribute, Check out: Drupal Redesign Implementers page
Thursday, February 18, 2010
Monday, January 18, 2010
DRUPAL VIEWS - Important points and Optimization
This article highlights some important points to remember before creating a Drupal View. The concepts are explained with respect to a News paper site as example.
The Basic elements of a Drupal Views include:
- Base Tables - Node tables, Comment tables, user tables, etc.
- Fields - information that gets displayed
- Filters - the criteria based on which the information is querried
- Sort criteria - the criteria based on which the content is sorted and displayed.
- Arguments - variable filters that can be changed dynamically when the view is constructed.
- 'Relationship - integrating with custom tables
- Reuse Views and use FILTERS as ARGUMENTS - Using Filters as Arguments lets the view display contextual content. In a Newspaper site the same view can be used multiple times for various taxonomies, taxonomy being an argument. The BLOB size of the VIEWS TABLE is very large, reducing the number of views helps in maintainability and in Performance by reducing the View table size. A couple of use cases of Arguments in Views for a Newspaper site:
- In the home page of a Newspaper a Single view with multiple sub channels - a single view can be used, the result obtained by passing the corresponding sub channel taxonomy can be displayed sequentially.
- In an Article page, the article tags can be passed as arguments to the same view to display related content based on that particular article.
- Typical filters to include are
- NODE type == Published,
- Node Article Type,
- Node Created date.
- Always define what should happen if a view returns a 'Null value'. Typically define a message/page it should take you to and display a specific message.
- While defining Arguments, define what should happen if there were no arguments passed to the view. This could be 'All values' or a Page not found, etc.
- UNDERSTANDING the query associated with a VIEW: In Drupal 6 you can Preview a VIEW while you are still building it. In Drupal it's so easy to construct a view and most of the time take it for granted. Below are some key points that will help you understand the View Query and give some pointers as to what to look for.
- Pager Query - In this case there are 2 Queries that run - one to count the total number of records and build the pager, second the Query to obtain the first set of records for that page.
For a block/ page view with a count or limit there is only one Query.
- Based on the fields displayed, the filters selected and the sort criteria defined, the JOINS in the Query will be constructed. Some examples:
- If the filter is CCK field there will be a INNERJOIN to the corresponding CCK table
SELECT node.nid AS nid,node.title AS node_title,node_data_field_article_date.field_article_date_value AS node_data_field_article_date_field_article_date_value,node.sticky AS node_sticky, node_weight.sticky AS node_weight_stickyFROM node nodeLEFT JOIN term_node term_node ON node.vid = term_node.vidLEFT JOIN content_field_article_date node_data_field_article_date ON node.vid = node_data_field_article_date.vidLEFT JOIN node node_weight ON node.nid = node_weight.nidWHERE (node.type = 'article') AND (node.status <> 0) AND (term_node.tid = 4)ORDER BY node_data_field_article_date_field_article_date_value DESC, node_sticky ASC, node_weight_sticky DESC
- For a SORT criteria as most commented the INNERJOIN to the comment stats realted table
SELECT node.nid AS nid, node.title AS node_title,node_comment_statistics.comment_count AS node_comment_statistics_comment_countFROM node nodeINNER JOIN node_comment_statistics node_comment_statistics ON node.nid = node_comment_statistics.nidWHERE (node.type in ('article')) AND (node_comment_statistics.comment_count > 0) AND (node.status <> 0)ORDER BY node_comment_statistics_comment_count DESC
- OPTIMIZING the Queries:
- Make sure all the fields that are used for SORTING are indexed, especially if it is a custom table.
- If there is an explicit limit to the VIEW please define the same.
- If a part of the VIEW cache-able , then split the VIEW into Cache-able element that is stored in a cache table and Dynamic parts as a separate view.
- Use VIEWS' inbuilt time based caching mechanisms, or write custom cache code using Drupal's cache get and Cache set functions.
- The Query optimization is based on which tables are Large. Typically in Drupal some of the Large tables are the Node related tables, Comment related tables, Taxonomy related table, Files related tables, User related tables. This also depends on the site and it's purpose.
In the case of a large Node table - Option 1 will take less time to execute as the 'Where' clause filters the IDs in the Node table first and then filters based on the tid, which is stored in another table.
VIEW Query Option1:
SELECT node.nid AS nid, node.title AS node_title, node_data_field_article_date.field_article_date_value AS node_data_field_article_date_field_article_date_value, node.sticky AS node_sticky, node_weight.sticky AS node_weight_sticky FROM node node LEFT JOIN term_node term_node ON node.vid = term_node.vid LEFT JOIN content_field_article_date node_data_field_article_date ON node.vid = node_data_field_article_date.vid LEFT JOIN node node_weight ON node.nid = node_weight.nid WHERE (node.type = 'article') AND (node.status <> 0) AND (term_node.tid = 4) ORDER BY node_data_field_article_date_field_article_date_value DESC, node_sticky ASC, node_weight_sticky DESCVIEW Query Option 2:
SELECT node.nid AS nid, node.title AS node_title, node_data_field_article_date.field_article_date_value AS node_data_field_article_date_field_article_date_value, node.sticky AS node_sticky, node_weight.sticky AS node_weight_sticky FROM node node LEFT JOIN term_node term_node ON node.vid = term_node.vid LEFT JOIN content_field_article_date node_data_field_article_date ON node.vid = node_data_field_article_date.vid LEFT JOIN node node_weight ON node.nid = node_weight.nid WHERE (term_node.tid = 4) AND (node.type = 'article') AND (node.status <> 0) ORDER BY node_data_field_article_date_field_article_date_value DESC, node_sticky ASC, node_weight_sticky DESC Other Resources on Views
VIEWS Handbook page: http://drupal.org/node/109604
VIEWS useful links: http://www.lullabot.com/articles/hacking-views-part-1-basic-concepts
VIEWS 2 - Building Views with Fivestar and Voting API modules: http://www.lullabot.com/videocast/building-views-fivestar-and-votingapi
Labels:
drupal,
drupal-views,
optimization
Saturday, January 9, 2010
An Introduction to Drupal
An Introduction to Drupal - presented to students from engineering colleges at Free Software Foundation, Tamil Nadu meet at IFMR, Chennai. I was so excited to present Drupal to a bunch of FSF students, who where involved in presenting various Free softwares they were working on. I followed my presentation with a short Demo of installing Drupal.
Presentation path
Presentation path
- History of Drupal
- Principles of Drupal
- Drupal’s structure
- Key terminologies in Drupal
- Trends in Portals – Web 2.0 & Web 3.0
- Showcase websites in Drupal
Introduction To Drupal
View more presentations from rajaram shyamala.
Labels:
beginners,
drupal,
FSF,
FSFTN,
introduction
Tuesday, December 29, 2009
Drupal as an open source platform and its relevance to the Librarians
Abstract:
The focus would be to provide an overview and introduction to the key principles of Drupal as an open source platform and its relevance to the Librarians in terms of creating the next level of knowledge sharing and management options.
The main points that I will cover are:
(i) An introduction to Drupal as an Open Source Solution & Content Management System.
The role Drupal can play in building a strong, intuitive and user friendly interfaces
The role Drupal can play in building a strong, intuitive and user friendly interfaces
(ii) Drupal's relevance to Librarians and Library management in today’s context of Semantic web.
(iii) Drupal's capabilities in helping Librarians reach out to their community and bring them together.
Drupal will open out the Knowledge repositories and let visitors to interact with it in new and different ways. The Libraries can then leverage the social publishing capabilities of Drupal for commenting, social tagging, personalized collections, mashups and a wide variety of other Web 2.0 features.
Drupal for Libraries
View more presentations from shyamdrupal.
Tuesday, August 11, 2009
Performance and Drupal
As we worked towards some exciting performance gains, some of our learning
- Use Drupal's Page Cache
- Run Mysql tuner to understand how Mysql responds to your site
- 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.
- 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
- Queries with inner joins or distinct clause were also marked and reviewed
- We had large benefits by restricting the log size, periodic clearing of the session tables
- We did add a patch for Drupal look up path and url redirect, will have that appended to this list.
- We moved from Drupal search to Google search!
- USE of PHP accelerator is a must
Checkout:
Labels:
drupal,
performance
Subscribe to:
Posts (Atom)