Read this article to understand how response chunking works and how it might benefit your app.
To send a string as a chunk
$response->chunk($str);To flush the contents of the output buffer as a response chunk
$response->chunk();After calling chunk(), views will be chunked too
$response->render('mytemplate.phtml');Note: calling $response->chunk() for the first time sets the appropriate header (Transfer-Encoding: chunked).