Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 28 16:36

    andig on master

    Add option to toggle extra work… (compare)

  • Sep 28 16:36
    andig closed #555
  • Sep 28 16:27
    Firehed commented #555
  • Sep 28 16:27
    Firehed synchronize #555
  • Sep 28 16:23
    Firehed synchronize #555
  • Sep 28 06:02
    andig commented #555
  • Sep 28 00:34
    Firehed opened #555
  • Sep 07 11:30
    starking8b commented #554
  • Sep 07 05:54
    starking8b commented #554
  • Sep 07 05:36
    andig closed #554
  • Sep 07 05:36
    andig commented #554
  • Sep 06 21:22
    starking8b opened #554
  • Sep 01 19:29
    zwirek synchronize #553
  • Aug 29 17:37
    andig commented #553
  • Aug 29 17:01
    zwirek synchronize #553
  • Aug 29 16:49
    zwirek commented #553
  • Aug 29 16:46
    zwirek synchronize #553
  • Aug 27 18:39
    andig commented #553
  • Aug 27 11:34
    zwirek opened #553
  • Jun 11 17:43
    keywan-ghadami-oxid commented #539
Franz Liedke
@franzliedke
okay...
Franz Liedke
@franzliedke
Can we start tagging some releases? The dev-master dependency messes with our minimum-stability...
Marc J. Schmidt
@marcj
we still wait for react/http.
alexlis
@alexlis
hi
Martin Lonský
@visitek
Marc. do you havy any idea, how to say nginx balancer that pm is dead for new requests? We have more production pms balanced by nginx. When i want to deploy them i need deploy it step by step by without terminating processes incomming before..when it is ready to kill, any new request shouldnt come to it. thats mean: two instances: eg 16 workers are alive. while deploing there are only 8. without loosing any request/reaponse
Is it clear?
Marc J. Schmidt
@marcj
@visitek depends highly on the architecture and deployment. if your new application version has db changes and is not compatible anymore you need to stop ppm completely. if you have few changes which are compatible you could rund two instances, each 8 worker and second instance is only alive while deploying. in that time you can restart instance one, after success you can stop instance 2. should be a graceful deployment then
Martin Lonský
@visitek
@marcj You do not understand. One worker could do some job. But any ozher request shouldnt come to masterprocess. While all jobs are done, we can restart master process. But, how to say nginx balancer, that masterprocess is preparing to be killed
Matthieu Napoli
@mnapoli
Hi everyone! Here is very vague question that may be related to PHP-PM :) Since the "cons" listed in PHP-PM are, for example, memory management, would it be possible to implement a FCGI server (or something similar) based on forking PHP processes to save the cost of file inclusion/framework bootstrap? Here is the idea: a PHP script starts and runs the bootstrap (autoload classes, init framework, etc.). Then it goes in a loop where it listens to incoming requests. Each time a new request comes in, the process creates a fork -> the fork handles the request and dies, while the original script loops and handles new requests.
The pros:
  • vs PHP-FPM: we save the bootstrap time
  • vs PHP-PM: applications don't need to be adapted to better manage their memory/global state since the "one process per request/scratch everything" is kept
I'd love to hear what you think of that and if it's something you considered for PHP-PM, or if it's impossible.
Marc J. Schmidt
@marcj
The performance does not come from saving bootstrap time of declaring symbols, but from saving initializing those objects, loading config files, calling methods etc. Exampe: we tried resetting symfony's container
service container after each request: performance dropped to php-fpm speed
Matthieu Napoli
@mnapoli
ah sorry, by "bootstrap" I meant creating the container, parsing config files, pre-loading common services (event-dispatcher, maybe DB, etc.)
so I meant to do all that, and only then listen to incoming requests
so the bootstrap time is taken off the total response time
(autoloading of common files too would be avoided in the "response time")
Marc J. Schmidt
@marcj
yeah but then you have again memory issues in terms of the developer needs to be aware of having a service in memory over longer time
Matthieu Napoli
@mnapoli
but the services wouldn't do anything until the request comes in right?
Marc J. Schmidt
@marcj
yeah as right now in the current implementation
Matthieu Napoli
@mnapoli
OK I thought memory leaks were because the same process would handle many requests? Do you mean memory leaks happen if a process has just started (handled 0 request before) and is waiting for a request?
(by the way thanks a lot for answering those questions, it's been a very long time I wanted to find someone would could answer them :))
Marc J. Schmidt
@marcj
memory leaks only happen if the developer of a library/the application is not aware that the app is handling several request over linger time. php itself does t have issue with it
its completely user land related
you re welcome, i'm currently on the phone at a quite place xD
Matthieu Napoli
@mnapoli
right! OK then we are on the same page. And to me it seems like a big issue: it's hard to rewrite all frameworks, libraries and especially applications to work with PHP-PM. That's why I'm wondering if there's not a solution were we could keep the "1 process handles only 1 request" (so no memory issue/global shared) while also avoid bootstrap time in the response time
so the idea is basically let PHP scripts "do something" (bootstrap) before being made available to PHP-FPM (or any other handler)
Marc J. Schmidt
@marcj
one process = one request basically destroys the whole approach and the speed gain
and one process =one request is already what php-fpm is doing
Matthieu Napoli
@mnapoli
that's what I don't understand: the speed gain is due to the fact that we don't do the bootstrap of the application anymore right?
oh ok
now I'm lost again
I knew you could have one process = one request in PHP-PM but I thought it wasn't really the best setup, I need to re-read again the docs then
Marc J. Schmidt
@marcj
yeah the fact that all of your services are eager loaded, as in java for exame
Matthieu Napoli
@mnapoli
then I don't see where the memory leak is with PHP-PM if a process only handles one request
that's what you said above:
memory leaks only happen if the developer of a library/the application is not aware that the app is handling several request over linger time. php itself does t have issue with it
so if PHP-PM processes only handle 1 request no memory issue?
ahhhh nevermind!

and one process =one request is already what php-fpm is doing

I read that as php-pm

damn sorry!
Marc J. Schmidt
@marcj
php-pm itself has no memory leaks nor php has, but if your applications loads tons of services and never cleans up then you built memory leaks
Matthieu Napoli
@mnapoli
right
Marc J. Schmidt
@marcj
for example internal caches which could be useful for one process=one request use cases need to be resetted after each request in php-pm ( for example in the onTerminate event of symfony) but most user are not aware of this event
Matthieu Napoli
@mnapoli
yeah I definitely see what you mean
Marc J. Schmidt
@marcj
and thats how most memory leaks happen
Matthieu Napoli
@mnapoli

so do you think it would make sense to try to find a middleground between PHP-FPM and PHP-PM? Like this:

  • keep one process = one request (to simplify everything, avoid memory issues)
  • but keep the perf improvement by running the bootstrap before the process handles the request

?
I can see several options for how, but I want to make sure the premise is all right?

Marc J. Schmidt
@marcj
I tried hard but haven't found that golden way. the biggest improvement comes really when you work with php as you would with java where your whole apllication is in memory prepared waiting for incoming requests
Matthieu Napoli
@mnapoli
here are ideas, I have no idea if they are doable:
  1. add a new feature in PHP-FPM so that PHP scripts can be run when PHP processes are spawned, until a special instruction that signals to PHP-FPM that the process is now fully initialized and can be added to the pool of PHP processes (i.e. an inverse of fastcgi_finish_request(), maybe like fastcgi_request_ready()) -> PHP-FPM stops the process and waits for a request -> when a request comes in, PHP-FPM populates the global variables ($_GET, etc.) and resumes the execution of the PHP script right were it stopped
  2. implement a FCGI server (much like PHP-PM, that's why I'm asking you today) where the "LoadBalancer" process inits the framework, then loops for each incoming request -> on each request it forks -> the fork handles the request and then dies (1 process == 1 request), while the original process (LoadBalancer) waits for the next request
in both cases we keep one process == one request, but each process only handles 1 request so no memory issue (and we have the perf improvement because bootstrap is not part of the response time)
Matthieu Napoli
@mnapoli
I'm also wondering if there's a solution n°3 with pthreads, but I'll need to read more about that extension