Unit: Replacement for php-fpm's fastcgi_finish_request

Created on 5 Feb 2019  ·  8Comments  ·  Source: nginx/unit

Hello folks, the gist of my ask is if there is anything planned around supporting the same functionality as http://php.net/manual/en/function.fastcgi-finish-request.php
For us this is really important feature which helps us keep the end user latency low while doing in-request PHP work.

Let me know if you need more details on how we are using http://php.net/manual/en/function.fastcgi-finish-request.php

Thanks!

enhancement

Most helpful comment

Hi, I've implemented fastcgi_finish_request(). Please try this patch.
After thorough testing we will include it in the next release, that is highly likely to appear in November.

All 8 comments

The details about your particular use case and possible requirements should help.

What we do is allow developers to register "shutdown" functions by adding callables to a global array. Those shutdown functions, as we call them, are assigned a certain priority by the developers so we can execute them in certain order at the end of the request. By default these shutdown functions are assumed to be non-blocking for the user, aka they are done after the response has been flushed to the user via a call to fastcgi_finish_request(). We are using nginx and fastcgi_pass to php-fpm to achieve this currently. Pretty standard setup for most PHP installations out there :)

The important part is that we can use these shutdown functions to do operations to external systems without causing any slowdown in those systems affect the perceived latency of the user request. We are talking metrics/logs collections, etc.

Let me know if this explains the use case well.

@komapa Yes, it explains well. Thanks.

Just checking if this might get some attention soon from the team. Thanks in advance!

Hello @i4ki, is this feature planned any time soon? Thank you!

I also need this feature. any release plan about this, guys?

Hi, I've implemented fastcgi_finish_request(). Please try this patch.
After thorough testing we will include it in the next release, that is highly likely to appear in November.

thank you, @VBart. Looking forward to the release.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

yujinqiu picture yujinqiu  ·  5Comments

ElDarco picture ElDarco  ·  4Comments

Madhu1512 picture Madhu1512  ·  4Comments

naviens picture naviens  ·  3Comments

wind930 picture wind930  ·  6Comments