How memory works in PHP and its hidden costs | Acro Commerce
Acro Commerce

Author

Acro Commerce

Posted in Digital Commerce, Drupal

April 19, 2018

How memory works in PHP and its hidden costs

DrupalCon Nashville 2018 Session

Join Shawn McCabe, Acro Commerce CTO, as he goes behind the scenes and teaches a bit about how PHP uses memory when it runs your code. PHP's ease of use and low barrier to entry also have some side effects on how memory is used, sometimes using memory differently and in places, you didn't expect. If you're doing small pages that load quickly, this probably won't even be noticeable for a low-traffic site unless things go quite wrong. Once you get into heavy pages on high traffic sites, or even worse, long-running background processes, then knowing a bit more about the memory you're using can help a lot.

Check Out Our High Five Drupal Web Series

In PHP, variables have a lot of metadata they need to store since they can be any size and of any type. They need all this metadata to store information like how much data they hold, what type of data it is and how it is stored. This "hidden" metadata cost will often use more memory than the actual info you are storing, although recent versions of PHP have improved on this.

The idea isn't to learn every low-level detail, just to have a little knowledge of what is happening with memory usage when you're programming so you can be cognizant of the choices you make and a bit more efficient in your usage.

Hopefully, this talk will be interesting to novice and experienced developers alike, but you only need some programming basics to follow along.

Talk to us

Acro Commerce is a Drupal Commerce development agency that specializes in enterprise-level ecommerce. We are committed to building strong strategic partnerships and using our ecommerce expertise to help clients create a dynamic web presence that engages audiences, generates revenue, and boosts brand awareness.

Contact us and learn more about our custom ecommerce solutions