-
Notifications
You must be signed in to change notification settings - Fork 284
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add function to finalize HTTPServerResponse stream manually #424
Comments
Why not use |
There will always be some resources that are only freed when the request callback returns (a lot would have to be changed otherwise), but |
Will |
No, the request callback will continue and return normally after the new task has been issued, causing the connection to be free for new requests (or closed). The new task will continue to run in the background. The only gotcha is that the task is not allowed to access the request/response objects, or any data contained in them, because at least with |
OK, I see. Yes, in that case |
Yes, but that's really minor, except if I'll leave it open because there are some things that are not yet optimal (e.g. there is |
OK, thanks.
I think that |
Sorry, I didn't get what you mean with 1000 tasks. Can you try to explain with different words? I general I don't see a problem with the task approach. But if (non-vibe.d based) blocking APIs are used, the work needs to happen in a different thread, response finalization doesn't help there either. |
If I understand Vibe.d fiber model correctly, Vibe.d have own scheduling for Or, maybe, we have |
Oh I see, no all of those 1000 tasks will be scheduled implicitly by the OS kernel based on the order of finished I/O operations. If the CPU load is below 100% (i.e. the application is I/O bound or partially idle), the new task should be processed more or less immediately and it's overall run time depends on how it competes for I/O resources with the other tasks. Also, the task will start to execute immediately during |
OK, thanks for explanation. |
This function should finalize
HTTPServerResponse.bodyWriter
and free all HTTPServerResponse resources like (keep-alive) connection. It can help to avoid unnecessary client waiting if we need to run some tasks after response to the client (like save information into DB, save information into file, send an e-mail, save information to the log and etc.).It allows to process the same number of connections as without this feature, but client will receive response faster.
Note that FastCGI supports this option and php-fpm implements it.
See also: http://forum.rejectedsoftware.com/groups/rejectedsoftware.vibed/thread/8086/
The text was updated successfully, but these errors were encountered: