←back to thread

116 points doekenorg | 1 comments | | HN request time: 0.001s | source
Show context
pachico ◴[] No.44498693[source]
I don't write PHP code anymore. I had a great time doing so for years but now I mostly write in Go for a company that writes a lot in PHP.

What I see from PHP is a missed opportunity for not having any native lightweight multi thread capabilities not a robust HTTP server.

I wish the situation changed.

replies(4): >>44498763 #>>44498778 #>>44499135 #>>44499373 #
cardanome ◴[] No.44498778[source]
I work daily with PHP and honestly nearly all my code I write is synchronous.

The shared-nothing architecture of PHP makes that really a non-issue for me. Requests never share any state with each other. Something like RabbitMQ can handle communication between systems.

replies(2): >>44498884 #>>44501438 #
zelphirkalt ◴[] No.44498884[source]
That's in no way lightweight though, and most languages can easily do the same. Just launch multiple instances/VMs/processes. That's having multiple separate OS processes, each having everything that is needed to run PHP, and having no way to communicate with each other, other than what you implement. No channels, no task distribution, no queue on which to sync and take tasks from, no signaling of all processes being done and then accumulating the results. That is why you then need something like RabbitMQ or other things, and it does not mitigate the heaviness of the approach.

It is kinda funny, that you mention RabbitMQ, which is written in Erlang, which is famous for its lightweight processes. But also compare the approach with thread pools built into the standard libraries in other languages. And even many of those are heavy weight compared to Erlang's lightweight processes.

replies(2): >>44498943 #>>44499146 #
ckbkr10 ◴[] No.44498943{3}[source]
PHP is not about lightweight, it's about rapid development. A lot of implementations in PHP are dead simple and can be debugged even by beginners.

You generally do not implement efficient systems in php, they are easy to debug, fast to code and quick to fix though.

replies(1): >>44500074 #
1. sroussey ◴[] No.44500074{4}[source]
Most of the time you don’t really need to think about memory management either as the memory for the process is simply reset on every request.