Well, I think one does not keep a web server request alive because the PHP processes are reused by incoming requests in a standard web server, if you can deploy your own CLI server (note that this does not scale properly and have other flaws) you can simulate sending the HTTP request (headers/body) while keeping the process alive.
Well, I'm using shell exec to avoid that issue but Im looking for something a little bit more "clean".
Can the CLI server share some classes from my web server app (phalcon) or share memory with it?.
Basically, it's a rest api. I have to send the response asap then do some heavy processing.
I know I have different options to accomplish that but I wanted to see what the phalcon community is going to suggest.
I think what you need is a message/queue server, when you process the API response and send a message to the worker, then via cron or a process in background you get the messages from the queue and process the heavy tasks.