Using nodejs to optimize Drupal background tasks


Most of the time when a Drupal site needs to do background processing, we use cron. But that's not always optimal: It runs all cron hooks at the same time, it requires bootstrapping Drupal on each run, it's limited to a certain timeout, and it's hard to do efficient non-blocking network requests in PHP. If you encounter these problems, some people will tell you to learn a whole new programming language for your background processing. But as a Drupal developer, you probably already know JavaScript.

node.js is a platform that runs JavaScript on the server, instead of in a web-browser. It's a great match for Drupal, since it's good at precisely the things where Drupal can struggle: Long-running processes, fast startup, and asynchronous networking. We'll look at what you'll need to know to get started using node.js together with Drupal:

  • node.js basics
  • Asynchronous networking
  • Writing long-running servers
  • Communicating between node.js and Drupal

Session Track

Coding and Development

Experience Level


Drupal Version