jason810496 commented on PR #49470:
URL: https://github.com/apache/airflow/pull/49470#issuecomment-2930184615

   > Nice, thanks for the benchmark, the memory improvement seems promising.
   > 
   > Do you know why it looks like the total response time is much longer after 
refactoring? Is that inherent to the stream solution? Also I'm not sure we care 
that much because the user will be able to see logs after the first chunck 
retrieval, wich might still be faster.
   
   Yes, that's correct — the longer total response time is due to the use of 
[StreamingResponse](https://fastapi.tiangolo.com/advanced/custom-response/#streamingresponse)
 instead of returning a full JSON response.
   
   > the user will be able to see logs after the first chunk retrieval
   
   Exactly. Even though the total response time might be longer, the user can 
start seeing logs immediately after the first chunk is streamed. Combined with 
[#50746 (virtualized rendering)](https://github.com/apache/airflow/pull/50746) 
on the UI side, this approach should maintain — or even improve — the user 
experience while significantly stabilizing the API server under high-load or 
large-log scenarios.
   
   As for improving response time further, I experimented with adding a read 
buffer on the log reader (e.g. yielding per X log lines). While it showed a 
slight improvement for large logs, it actually delayed the appearance of the 
*first* log line for smaller logs. So, I’ve removed the buffered reader from 
the final PR to optimize for initial responsiveness.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to