3 ms·
Well one misconception is that the code needs to be downloaded into the execution context every time. Which is different than a PHP file being loaded off disk (
by throwaway2016a 10y ago
Well one misconception is that the code needs to be downloaded into the execution context every time. Which is different than a PHP file being loaded off disk (or opcache as the case is more common in PHP). It's more like if you zipped up your PHP program and every time someone hit a page the zip file was downloaded and extracted onto the server.
However, Lambda takes that one step further. The entire app stays running in memory. No loading or recompiling code. The function is sent instructions via interprocess communication.
So you can take advantage of things that are difficult (though not impossible) to take advantage of in PHP such as connection pooling and shared memory.
- Matthias247 10y agoIf you are reusing the app for multiple function executions, how do you enforce things like isolation between functions and execution limits (processor time, etc.)? I think if 2 functions are running in parallel one can't kill the whole process if the first one exceeds limits, because the other one is still running. And in a runtime like node.js it's not possible to isolate different code pieces reliably from each other. Or is a special runtime and things like V8 isolates utilized?
- throwaway2016a 10y agoYou cannot do that. Each deployed function corresponds to exactly one entry point in code. You can however pipe multiple HTTP endpoints through the same entry function like a router. So let's say you do that. If two clients request the same function at the same time it will run the function in two different containers. One for each client. They are isolated (think multiple instances of Node running in multiple Docker containers). They might as well be on different machines entirely. The platform will not reuse the same container unless the previous request to that container has finished.