A client site that is growing fast recently complained that the site is slow when creating nodes or when commenting.

The slowness was very noticable, taking up to 30 seconds from the time "Submit" button is clicked, until the site comes back with a new page.

The site has approximately 14,000 nodes, 109,000 comments and 22,000 users.

After a lengthy investigation it turned out that it was the subscription module that was the cause for the slow down. Every time a comment or node is posted, subscriptions executes a set of queries and sends the emails to those subscribed to the nodes or taxonomies.

This takes a lot of time.

However, there is a workaround for this, right in subscriptions' settings.

The following options allow the emails to be sent when cron runs, not when nodes or comments are posted:

Use cron for notifications

Sends subscription notification when cron module runs. Default is to send upon node update.
Note: Currently only tested with MySQL.

There is a bit of a performance hit when cron runs, but it is not noticable. It is certainly better than thousands of users having delays when posting nodes or comments.

Comments

Mon, 2007/10/01 - 16:19

This is great info guys. Thanks for pointing it out.

I use the cron setting in subscriptions because it gives me time to moderate comments before they're forwarded to our userbase. It's pretty embarrassing when someone posts a Viagra advertisement as a comment and then Drupal forwards it to your subscribers.

Sure wish Subscriptions and Organic Groups checked to see if a comment or node were published before sending notifications.

Kevin

Fri, 2007/10/12 - 12:45

There is a module in the works (http://drupal.org/project/comment_notify) that is trying to correct this exact issue, Kevin. The author managed to get the core comment module patched to allow for a comment_notify to notify modules that a comment has been published (http://drupal.org/node/156475). This would effectively solve the problem you mentioned.

Jonathan

Is your Drupal or Backdrop CMS site slow?
Is it suffering from server resources shortages?
Is it experiencing outages?
Contact us for Drupal or Backdrop CMS Performance Optimization and Tuning Consulting