back

Knowlegde

Knowledge Centre

Memory consumption on Drupal websites

by editor | 19.07.2014

Memory consumption on Drupal websites

I think we can split Drupal websites in two main categories using the memory consumption criteria: those that require anonymous browsing and those that require the user to be logged in to see/perform/edit certain tasks. If you are expecting to have a high traffic website in either of these two categories, here is what to do.

 

Memory consumption is one of the main issues affecting the scalability of a Drupal website. A typical request to the Apache server will consume somewhere between 30 - 60 MB per request, sometimes even 90 MB depending on the number of modules activated. The main factors that contribute to this high memory usage are the memory used by Bootstrap procedure which loads all the modules and the memory used by blocks. Sometimes, if you use AJAX website with blocks being loaded separately, one user opening a page can trigger x times the memory usage for that page due to the separate loading calls for the elements using AJAX functions.

 

Going back to the criteria from the top of the article: here are your solutions. If your main traffic is going to be anonymous than install Boost or any other related caching solution you prefer (Varnish, etc). Be sure to configure correctly your .htaccess file so that the static files are being served and not pages generated again. Because these type of caching creates static copies of your actual pages, these solutions can deliver many requests without a lot of memory footprint.

 

If you are on the second case than the scalability of your website is going to be limited by the available memory and the performance of your server. For example, if you have a server with a 4 GB of memory, from which around 700-800 MB will be used by the OS (any flavor of it), there will be left 3,2 GB memory for requests. If your page consumes 50 MB per request than your server will be able to serve maximum 64 requests at the same time. As I said before, performance of the machine is a factor and from our tests as not all the requests tend to take the same amount of time to process, in this scenario probably the server will be able to handle 100 to 150 logged-in users in the exact same time until the memory will run out and your server crash.

 

What else to do? First, try to reduce the memory consumption by checking that only the necessary modules are loaded. Check that you do not have any module that uses an insane amount of memory but provides little functionality (you might rewrite that part of the portal). Check that your server is fast! Use NGINX to limit the load on the server, use eAccelerator and FCGI if you prefer Apache. Check that memory caching is adequate and the HDD speed is good enough to provide results in a crisis situation.

 

For more information on Drupal performance and scalability, please contact us.

1049523915.jpg
Top
default
  • Knowlegde
    Knowledge Centre
    Replace a field's content based on another field using AJAX
    editor
  • Knowlegde
    Knowledge Centre
    Port your sites to Drupal 9
    editor
  • Knowlegde
    Knowledge Centre
    Drupal 8 or Drupal 9
    editor

Post a Comment.