Tag Archives: memory

PHP memory_limit – a *per-script* setting

What happens when your web host blames PHP memory_limit setting for memory usage issues on a Linux web server. This happened recently and although PHP’s memory limit was set to 1GB (very high) that does not mean that scripts were using 1GB. Let’s take a quick look at understanding PHP’s memory_limit setting. PHP memory_limit is a per-script […]

Linux Performance: Why You Should Almost Always Add Swap Space

We know that using swap space instead of RAM can severely slow down the performance of Linux. So then, one might ask, since I have more than enough RAM available, wouldn’t it better to remove swap space completely? The short answer is, No. There are performance benefits when swap is enabled, even when you have more than enough […]

Avoid This When Tuning MySQL Query Cache for Performance

One of the most misconfigured MySQL performance features, is MySQL Query Cache Size. Just last month I was optimizing a web server with 32 gigabytes of RAM where the existing config had MySQL’s query cache size set to 4 gigabytes. The thought behind it seems to be that more is better. Since the server has free RAM available, setting MySQL Query […]

Tuning MySQL: my.cnf, avoid this common pitfall!

Caution: Don’t overwrite your entire my.cnf at once when tuning MySQL. One or two changes per restart, benchmark, then continue. Take backups first and be careful! It took me some time to decide the title for this article. MariaDB has been fast replacing MySQL as a growing number of Linux distributions now default to MariaDB over MySQL. In […]

How to strip down Amazon Linux EC2 to maximize available RAM

Firstly, this article mainly applies to low memory Amazon Linux EC2 instance types such as t2.nano and t2.micro. The instructions below are also specific to Amazon Linux AMI, which like CentOS, is based on RHEL (Red Hat Enterprise Linux). Yum! Update all packages – yum package manager First, login to your new Amazon Linux EC2 instance […]

Are You Measuring Web Server Memory Usage “Correctly”?

Does the screen capture above from New Relic look familiar to you? Lets say you have a web server with 2 gigs of RAM or maybe 256 gigs. But your web applications are running slowly so you check New Relic and unfortunately don’t see any red flags. The swap may worry you a little bit but you say… “Hey, […]