Comment by kgeist

Comment by kgeist 7 days ago

2 replies

Anything that unexpectedly blocks a process can bring down your entire PHP server because you will run out of worker processes. For example, imagine you experience a spike in requests while another server you're trying to call is timing out. You can't set the maximum worker count to a very high value because the operating system has an upper limit. Since the limit must remain low enough, you can quickly run out of your worker processes.

In contrast, Go can efficiently manage thousands of such blocked goroutines without issue. Sure, you can address this problem in PHP, but you need:

- understand PHP-FPM (or whatever you use) configs and their footguns

- understand NGINX configs and their footguns

- fiddle with PHP configs/optimizing your code to fit within PHP's maximum limits

- rent larger servers to have the same throughput

Implicated 7 days ago

True. I stand corrected.

This is a footgun, regardless of if it's a block from file systems or remote requests or whatever.

My claim that it's a configuration problem is just a 'fix' and there are ultimately an unlimited list of ways this same thing can come up to bite you. Well, outside of aggressive timeouts - and even then, with enough volume of requests that's even not going to save you :D