background processes

How to handle heavy calculations in the background in Drupal

Say you have a data warehouse or data mart in your Drupal installation and you have to make a quite heavy calculation on a node save, but you don't want the users to wait for too long. Then you have to add the process to the background.

One way of doing it is to set a flag and have a function called by hook_cron doing the job. But you might not want to wait for cron to run and you don't want to hammer the site with cron.