ok2c commented on PR #516: URL: https://github.com/apache/httpcomponents-core/pull/516#issuecomment-2708326779
> I question why the application thread is doing this work at all though. The general design of this library seems to treat each connection as a single threaded environment. With that in mind, it seems like the application thread should simply give the response producer to the stream handler, then set the IO flag and have the IO thread do all the writing and state management. That would remove this issue entirely. This is exactly how HttpCore 4.x works. The approach when the i/o dispatch thread does all i/o work is really appealing from the complexity perspective as it requires no synchronization in the protocol layer. The problem is that the complexity gets pushed up the stack the application layer. This is the reason there are virtually just a handful of known cases of HttpCore 4.4.x being used in complex scenarios. Most users just buffer everything in memory. It was a conscious decision to make it easier to produce / consumer messages using dedicated worker threads when necessary. Besides, writing directly to the underlying i/o channel _should_ be a bit faster than registering output interest and then waiting for the i/o dispatch thread to react to it. -- 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: dev-unsubscr...@hc.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org For additional commands, e-mail: dev-h...@hc.apache.org