Question: Memory Takes 170MB - 256MB usage?
Closed this issue · 2 comments
Hi There,
I am really excited of frankenphp, and I am already tried a lot this thing.
What I Do
I am trying the static binaries built, and when it run on my system it cost me a lot of RAM
When it started, the cost to run the binary is 170 MB RAM, and when the the request is coming, it starting to increase up until the memory limit from the docker
My Specs
Specification | Value |
---|---|
Model | MacBook Pro |
Screen Size | 15-inch |
Year | 2018 |
Processor | 2.6 GHz 6-Core Intel Core i7 |
Graphics | Intel UHD Graphics 630, 1536 MB |
Memory | 16 GB 2400 MHz DDR4 |
Serial Number | C02WX883JG5J |
macOS | Sequoia 15.11 |
Attempts
- I am already tried the
env
key in thephp_server
directive:env GOMEMLIMIT 128MiB
; it did not work - another try is that I am trying to set the
env
as argument when start the binaryenv GOMEMLIMIT=128MiB ./my-app php-server
; it did not work too
Static Builder Image
I am using image latest 3 weeks ago
~$: docker image ls | grep dunglas
dunglas/frankenphp static-builder-1.2.5 9e7334044930 3 weeks ago 4.72GB
Question
is there any way that the memory from the static binary can lower than 100MB?
When running a static binary, all the PHP dependency libraries are loaded into memory, unlike a non-static binary, where the libraries can use shared memory. This means the amount of memory used, as a baseline, on the static image, is directly related to the extensions that you have loaded. With shared libraries, the kernel can optimize the shared libraries to share their memory across running containers (assuming the shared libraries are from the same image and/or same layers in the docker file).
Yes, I just thinking about it, it load the extension into memory so that is why that the binary taking much memory
Thank you @withinboredom for your concise explanation. I mark this as closed