> Is the "your app gets initialized and torn down for every request" true for frameworks like Laravel and Symfony?
Yes, though heavy optimization in opcode caching and JIT keeps it fast and the primary process manager today (php-fpm) generally keeps a pool of PHP processes persistent. Each request is initialized from scratch but there's no disk nor interpreter hit after the first.
There are, of course, frameworks that simply handle HTTP requests directly (amphp, swoole) that operate as persistent application servers, so state is maintained.
> Does this model uses OS threads? Does it uses green threads?
No. PHP webserver backends are generally a long-lived forking model.
> I feel like the Go model is a way better model for server software than async
Swoole [1] offers a coroutine and channel model. It's incredibly fast and the techempower benchmarks [2] attest to the raw speed.
> It feels a bit weird to see how full of objects PHP is
Agreed. It's often way over the top with Java-esque OOP complexity. It does depend on the libraries in question but the popular ones are very heavy (Symfony). You can of course write very simple imperative code just fine too.
I don't agree with Symfony being inherently "very heavy". As set of framework components, you can any part you find useful, and wire to together yourself, if necessary. e.g.
I would have to question how relevant a piece of core plumbing is to a regular user of the framework, as a regular user of the framework would likely never come across this class.
Also if you're working in the domain as a Symfony core developer, the idea of a ContainerConfigurator is not so insane, if you're developing a dependency injection container.
Yes, though heavy optimization in opcode caching and JIT keeps it fast and the primary process manager today (php-fpm) generally keeps a pool of PHP processes persistent. Each request is initialized from scratch but there's no disk nor interpreter hit after the first.
There are, of course, frameworks that simply handle HTTP requests directly (amphp, swoole) that operate as persistent application servers, so state is maintained.
> Does this model uses OS threads? Does it uses green threads?
No. PHP webserver backends are generally a long-lived forking model.
> I feel like the Go model is a way better model for server software than async
Swoole [1] offers a coroutine and channel model. It's incredibly fast and the techempower benchmarks [2] attest to the raw speed.
> It feels a bit weird to see how full of objects PHP is
Agreed. It's often way over the top with Java-esque OOP complexity. It does depend on the libraries in question but the popular ones are very heavy (Symfony). You can of course write very simple imperative code just fine too.
[1] https://www.swoole.co.uk/
[2] https://www.techempower.com/benchmarks/