3 ms·
For a practical example, you can try speed test on this page: https://www.lambdaphp.host/ https://www.lambdaphp.host/ (hosted with AWS Lambda). It does use exte
by superasn 9y ago
For a practical example, you can try speed test on this page: https://www.lambdaphp.host/ https://www.lambdaphp.host/ (hosted with AWS Lambda). It does use external CDN for CSS framework (cdn.rawgit.com) so you will have to factor loading time for that as well[1].
Yes, PHP opcache and optimizations don't work since it gets cold started every time.
[1] Pingdom speed test results: https://i.imgur.com/9zg9l3g.png https://i.imgur.com/9zg9l3g.png
- fahrradflucht 9y agoWhy is that? Couldn't you keep php running for the lambda lifetime? That way only when the lambda cold starts there would be no cache.
- superasn 9y agoI'll try to research this. Another user suggested it to me before so maybe that's possible..
- mjb 9y agoI'm not sure how PHP integrates with common web servers today, because I've been pretty disconnected from that world for a decade, but at least you should be able to use the same mechanism to call the PHP runtime from your Node shim while keeping it alive. If PHP supports fastcgi, for example, there are modules in NPM that can do the Node side of it.
- CurleighBraces 9y agoIt would be cool if you could launch php-fpm but it doesn't look like lambda supports port binding/sockets. Seems like other people have had this idea in the past too! https://forums.aws.amazon.com/message.jspa?messageID=624889 https://forums.aws.amazon.com/message.jspa?messageID=624889 Are there any workarounds allowing something similar?
- CurleighBraces 9y agoI was wrong. From what I've read, port binding == no, sockets == yes. So should be able to use fpm to achieve this.
- superasn 9y agoThis is the best pointer I have recieved from anyone. A lot of people have told me to do it but nobody can tell me how to get started. This looks something worthwhile that I can research and implement. Thanks!
- 52-6F-62 9y agoThe guestbook demo resultant text file is a hilarious nightmare: https://s3.amazonaws.com/sanchit-uploads/guestbook.txt https://s3.amazonaws.com/sanchit-uploads/guestbook.txt It looks like some Russian bots found your input. I know it's just a demo, but might want to add at least a honeypot on there or something.
- superasn 9y agoYes that was pretty quick. Right now it is all going to a text file (just wanted to demo that file_put/read_contents automatically writes to S3) but never expected this! God knows what they're doing with the file upload demo :/
- 52-6F-62 9y agoHaha— tread carefully. Anyway, this is pretty slick and snappy. Neat idea.