6 ms·
What do you mean by "scales to a reasonable degree"? How does others take over?
by NightlyDev 9y ago
What do you mean by "scales to a reasonable degree"? How does others take over?
- tyingq 9y agoFastCGI vs, for example, node.js and their pretty nice async model where the engine is warm for every request. With php, I have to do stuff like caching responses with apcu to get something similar, but inferior. Which doesn't scale beyond a single server host. I can serve a lot of requests with apcu, but the curve does drop off at some point.
- andrewmackrodt 9y agoHave you tried a node/express like PHP framework such as amp/aerys?
- tyingq 9y agoHave not, will check out aeyrs though.
- NightlyDev 9y agoNodejs out of the box would ofc. be faster than PHP on something nodejs is born to do. But lets say we needed to do a bit of CPU work on each of these requests, then nodejs might struggle compared to PHP. Both should be able to scale well in a "create a website and return the HTML"-scenario, and it's not unlikely that a PHP setup would be faster. In a single page app thats mostly based on fetching data from an API nodejs would probably be faster. About APCu: It's damn fast and very unlikely to slow you down, other stuff will probably bottleneck you way before APCu becomes a problem. Use PHP as PHP, and nodejs as nodejs. If you really need async in PHP or want to use PHP somewhat like nodejs then you should probably go for an extension and serve requests directly from PHP. I've had great experiences with that, serving over 500K simple HTTP req/s on a low end server. But again, if max performance on a single server is so important then you should probably go for a compiled language anyways.
- tyingq 9y agoGreat observations, and better stated than what I said. Often the answer is "it depends". Which is usually unsatisfactory for the HN crowd. I just hate uninformed and unnuanced PHP hating. There are use cases where it's actually the best answer by a large degree.
- tylerjwilk00 9y agoMost projects never reach a point where PHP can't handle the scale the project will reach.