I want to scale my Drupal site and I was wondering how to approach it with Drupal and Amazon EC2. This is a bit related to How to use Drupal in the cloud with on demand instances.

With Amazon, I can monitor my server and if certain metrics are hit then it can launch a new instance that is load-balanced. My questions are then:

  • Does Drupal create specific files as users do stuff? Is everything on the database? (I have a separate database server that all my nodes point to.)
  • Are sessions local or is it on the database as well? I'm thinking of situations where user connects to server A and then gets moved to server B. Would the user lose anything?

If it helps, I'm using Drupal 6.

2 Answers 2

  • Drupal core code creates files only when a user uploads a file. With third-party modules, files could be created in other cases. For example, if you are using Apache Solr Search Integration some files could be created; if you are using a module that implements an alternative caching system, some files could be created as well.

  • sess_write() saves the session ID in the "{sessions}" table, together the value of $user->cache, the IP address used by the user to connect, and the current timestamp.

db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, isset($user->cache) ? $user->cache : '', ip_address(), $value, time(), $key);
if (db_affected_rows()) {
  // Last access time is updated no more frequently than once every 180 seconds.
  // This reduces contention in the users table.
  if ($user->uid && time() - $user->access > variable_get('session_write_interval', 180)) {
    db_query("UPDATE {users} SET access = %d WHERE uid = %d", time(), $user->uid);

In 2018, Bitnami is a good option for installing Drupal 8 on AWS EC2 with Debian Linux & a LAMP stack with all of the required components. Use Drush & Composer to manage the CMS, Git for version control. It is required to use AWS RDS with Elastic Beanstalk as the load balancer for the database synchronization when using MySQL or MariaDB in cluster server configurations.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.