PHP Performance: Additional CPU cores vs Faster CPU cores

Originally published at: PHP Performance: Additional CPU cores vs Faster CPU cores

Some time ago, I received an email from a client experiencing slow performance issues with a LEMP (Linux, Nginx, MySQL, and PHP webserver). During a full audit, I found that the server’s load average was pretty low (see above screenshot). However, the website was indeed very slow. There were some misconfigurations, but one of the…

1 Like

Thanks for this great post!

I’ve got a related question that I hope you know something about.

Vps servers give you a vcpu, which is a single cpu thread - at best (this seems to be aws and Google’s policy 2 vcpus per physical core, but many other providers oversubscribe the physical cores since they’re not all active at the same time). Lscpu shows this in your article - 8 cores, with 1 thread per core.

But if we have a bare metal server, we have the actual physical cores and Lscpu would show the threads per core.

My question is - how would we get php-fpm or lsphp on a litespeed server to use threads rather than physical cores - as is done on a vps server? The idea being that the php processes aren’t computing at all times, since they wait for db and other file I/O. So, in essence, php processes that are running “multithreaded” on a vps server should be able to outperform truly singled threaded bare metal php processes.

Or am I missing something? I can’t find any info on this anywhere, and your site is one of the better resources on this sort of info!


1 Like

First of all, welcome to the forums.

Multithreading is the ability of a central processing unit (CPU) (or a single core in a multi-core processor) to provide multiple threads of execution concurrently, supported by the operating system.

PHP does not come with built-in multithreading support. However, you can try Pthreading. Pthreads is an object-orientated API that provides all of the tools needed for multithreading in PHP. but it is usually not worth it. :face_with_diagonal_mouth:

Beyond this, hardware is king :crown: for PHP. What is the clock speed of your cores? How fast is your storage.

If this is a production environment with high traffic, I can offer you a free trial of our INSANE by invite only cloud platform (, which we upgrade complimentary every 1 to 2 years before they burn out due to overclocking and forcing currently 3.9 GHz CPUs and everything else to always run at MAX.

1 Like