Hacker News new | past | comments | ask | show | jobs | submit login

> 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.

[1] https://www.swoole.co.uk/

[2] https://www.techempower.com/benchmarks/




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.

https://symfony.com/doc/current/configuration/micro_kernel_t...

Many other PHP projects, such as Laravel and Drupal pick-and-choose Symfony framework components in this way.


Sorry, I should have clarified "heavy" in terms of the level of OOP [1] insanity but yeah Symfony is very modular.

[1] e.g. "Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator"


> in terms of the level of OOP [1] insanity

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.


Look at what I was replying to. The guy commented about the amount of OOP in PHP.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: