You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 13, 2025. It is now read-only.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
As John De Goes Said: "I'd rewrite that code to be "bare metal" and wrap the entire process in ZIO, for higher performance." It certainly doable but If you perform ZIO-NIO read() - it's an effect and you need to wait till it finishes to perform SSLEngin.unwrap() - which is another effect, so at least we have two effects chained together anyway. Not much for bare metal optimization. Also, primitive ByteBuffer ops, for example compact() are made as effects too. So, why not to present wrap()/unwrap() as a standalone effects in that case. Also, that approach allows to build SSLSocket on top of regular ZIO-NIO socket. If this to be made a "bare metal", there will be a code duplication with dubious performance benefit. Or maybe we don't use ZIO-NIO at all, and just work with NIO completion routines: bare metal and consider ZIO to be a high-level wrapper. Anyway. Here was an idea to use ZIO fibers as parallel primitives for paralel HTTP alike server. Not sure, if this good idea, but that what I was trying to achieve. It makes possible running parallel IO effects on just one CPU core. ( at least in theory ).
Also... It may be interpreted that ZIO-NIO itself is too low level to be used with ZIO IO model ???
this is just FYI. The way TLS Support is designed it supports arbitrary buffer sizes, if you read extra data and cannot decrypt it right away it will be saved in carryover buffer for next read. Basically, we use ZIO fibers as a parallel supervisor and here we managed to avoid using two layered IO model, which is used for example in Blazer/https4s. This is in some sense a "poor man" parallel server IO. But to me it was worth trying.
Looks like that code won't find a place inside of ZIO-NIO. But I cannot externalize it, without removing protected qualifiers on some functions like bufferRead/Write in ZIO-NIO.
It will be very likely that I just cut and paste ZIO-NIO's "wrap()" and implement everything separately. So, maybe this is a reason to think about how to make ZIO-NIO more open to third party access based on Java NIO ByteBuffers. In other words: if ZIO-NIO had native java NIO Buffer interface it would be much easier to use it as low level asynchronous scheduler for Java NIO completion routines.
But from what I learned, ZIO is considered to be more of a high level engine. And maybe this is what drives design decisions on ZIO-NIO as well.
Just thoughts...
Thank you Przemyslaw Wierzbicki, @quelgar, @jdegoes for your time and comments.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
None yet
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
test fix, ignore