Skip to Main Content
High Performance Drupal
book

High Performance Drupal

by Jeff Sheltren, Narayan Newton, Nathaniel Catchpole
October 2013
Intermediate to advanced content levelIntermediate to advanced
261 pages
7h 4m
English
O'Reilly Media, Inc.
Content preview from High Performance Drupal

Chapter 4. Drupal Coding for Optimal Performance

One of the great things about Drupal is the ease with which you can extend or override core functionality in order to customize it for your specific needs. However, if you are not careful with how you code, you may introduce a huge performance bottleneck into your contributed or custom module. This chapter will give an overview of Drupal APIs relevant to performance and scalability, common coding best practices, and pitfalls to be aware of when trying to approach common tasks.

Context Matters

Before discussing the APIs and patterns that Drupal provides, it’s worth discussing which types of issues are often introduced when writing Drupal code.

Performance and scalability issues in code can affect CPU, memory, filesystem, database, and network usage, either individually or in combination. All code uses at least some CPU and memory, and all sites will access the database and filesystem and potentially make network requests. Whether any of these turns out to be a performance bottleneck is always down to context.

There are no hard and fast rules about what makes code “fast” or “slow”—exactly the same code could be acceptable in one situation but not in another, and performance often needs to be balanced against other programming issues such as testability, readability, and maintainability.

When writing or reviewing code, it’s important to think of the context the code will be executed in—both the immediate use case and whether it might also ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Drupal 8: Enterprise Web Development

Drupal 8: Enterprise Web Development

Nick Abbott, Richard Jones, Matt Glaman, Chaz Chumley
Mastering Drupal 8

Mastering Drupal 8

Chaz Chumley, William Hurley

Publisher Resources

ISBN: 9781449358013Errata PageSupplemental Content