php (not fpm) with BREF_LOOP_MAX=1 is 2x slower than php-fpm #1820
Unanswered
allan-simon
asked this question in
Support
Replies: 2 comments 1 reply
-
Hi, this is expected because the function runtime (without the loop) restarts a new PHP process on every request. That's not really efficient for synchronous use-cases: https://bref.sh/docs/environment/performances#bref-for-event-driven-functions PHP-FPM does not restart a process, it's highly optimized and wipes the process' memory basically. For your scenario why not keep using FPM? |
Beta Was this translation helpful? Give feedback.
1 reply
-
No worry, thanks for the explanation it makes sense, if I understand correctly it's basically because when the lambda is hot php-fpm has already a process ready while with the loop set to 1 we wait each for the process to start and for the process to stop "cleanly" ?
THen my mental model was wrong , I thought that the "php" layer was one with less layer of abstraction , like directly "php running bref , directly booting symfony in the same process" , while php-fpm was kind of "php running bref, starting a php-fpm process that itself pop a php process with symfony" . And in that mental model it made no sense that php was slower with less inter-process communication. But now I see clearer 🙂
I will try to dig more into the php-fpm issue then , this bug has been waiting for far too long :P
…________________________________
From: Matthieu Napoli ***@***.***>
Sent: Saturday, June 8, 2024 7:31 PM
To: brefphp/bref ***@***.***>
Cc: Allan Simon ***@***.***>; Author ***@***.***>
Subject: Re: [brefphp/bref] php (not fpm) with BREF_LOOP_MAX=1 is 2x slower than php-fpm (Discussion #1820)
Oh sorry just noticed the intro. Might be worth trying to fix the original issue then, maybe by playing with the php-fpm.conf settings.
—
Reply to this email directly, view it on GitHub<#1820 (reply in thread)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AABUBL6AILVWD6MVCGYCUU3ZGM5XTAVCNFSM6AAAAABJAEWEUKVHI2DSMVQWIX3LMV43SRDJONRXK43TNFXW4Q3PNVWWK3TUHM4TOMJVGQ2DO>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description:
Due to the issue #1369 , we've switched our "web" lambda (with symfony) from php-fpm layer to php (the same we use for symfony commands / messenger)
We've noticed a significant increase in response time as you can see on our monitoring, (you can see the before/after switching very clearly on the response percentile graph) so it does not seems related to a specific kind of request
we're currently using with BREF_LOOP_MAX=1 due to some symfony service being too stateful and not reset-ing correctly between two requests.
However my understanding would be that bref without php-fpm should be at least as fast as with php-fpm (and faster when reusing the same kernel ) so I can't wrap my head on why it's two times slower.
Any idea on where I can dig to find the core issue ?
Beta Was this translation helpful? Give feedback.
All reactions