Re: garbage-free java.nio

2018-03-12 Thread John Hening
Thanks! :)

W dniu niedziela, 11 marca 2018 21:25:32 UTC+1 użytkownik John Hening 
napisał:
>
> Hello,
>
> recently I am interested in non-blokcing java api for networking. It seems 
> to be great. However, I would like to implement garbage-free solution. I am 
> trying to do it only for learning purpose (I know that I don't implement a 
> "better" solution). Especially, my solution is going to be garbage-free. 
>
> How to start? I see that jdk implementation is not garbage-free. And what? 
> My only idea is to implement a small native library (only for Linux) and 
> implement something like "facade" and a lot of stuff around that in Java 
> (but, garbage-free).
> I suppose that it can be very hard to integrate it with selectors for 
> example (if possible). But, I don't see another solution and this is why I 
> wrote here. What do you think? What is the best approach?
>

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mechanical-sympathy+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: garbage-free java.nio

2018-03-12 Thread Roman Leventov
one.nio.net package of one-nio library (
https://github.com/odnoklassniki/one-nio/tree/master/src/one/nio/net) is
basically a reimplementation of java.nio. It does less locking, and, I
suppose, allocates less garbage. You may find it useful.

On 12 March 2018 at 15:38, Michael Guyver  wrote:

> On Sunday, March 11, 2018 at 8:25:32 PM UTC, John Hening wrote:
>>
>> recently I am interested in non-blokcing java api for networking. It
>> seems to be great. However, I would like to implement garbage-free
>> solution. I am trying to do it only for learning purpose (I know that I
>> don't implement a "better" solution). Especially, my solution is going to
>> be garbage-free.
>>
>
>  Hi John,
>
> I've looked intot this as part of a toy project and as Martin says you end
> up with JNI. At that point you could just as easily hand-off the networking
> layer to something like libev and be done with it, depending on your needs.
>
> Of course, a 0-GC TLS (client) in Java is a real ask. ;)
>
> Regards
>
> Mike
>
> --
> You received this message because you are subscribed to the Google Groups
> "mechanical-sympathy" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mechanical-sympathy+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mechanical-sympathy+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: garbage-free java.nio

2018-03-12 Thread Michael Guyver
On Sunday, March 11, 2018 at 8:25:32 PM UTC, John Hening wrote:
>
> recently I am interested in non-blokcing java api for networking. It seems 
> to be great. However, I would like to implement garbage-free solution. I am 
> trying to do it only for learning purpose (I know that I don't implement a 
> "better" solution). Especially, my solution is going to be garbage-free. 
>

 Hi John,

I've looked intot this as part of a toy project and as Martin says you end 
up with JNI. At that point you could just as easily hand-off the networking 
layer to something like libev and be done with it, depending on your needs. 

Of course, a 0-GC TLS (client) in Java is a real ask. ;)

Regards

Mike

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mechanical-sympathy+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: garbage-free java.nio

2018-03-12 Thread Martin Thompson
There are challenges with implementing a communications system (messaging 
or RPC) on top of NIO with Java but it can be done. If you want to learn 
about this you could study code bases that have done this. Aeron and Netty 
are two examples. For reference Aeron is garbage free once connections are 
established regardless of the number of messages exchanged. To achieve this 
you have to do some ugly things with NIO to work around its weaknesses.

On Sunday, 11 March 2018 20:25:32 UTC, John Hening wrote:
>
> Hello,
>
> recently I am interested in non-blokcing java api for networking. It seems 
> to be great. However, I would like to implement garbage-free solution. I am 
> trying to do it only for learning purpose (I know that I don't implement a 
> "better" solution). Especially, my solution is going to be garbage-free. 
>
> How to start? I see that jdk implementation is not garbage-free. And what? 
> My only idea is to implement a small native library (only for Linux) and 
> implement something like "facade" and a lot of stuff around that in Java 
> (but, garbage-free).
> I suppose that it can be very hard to integrate it with selectors for 
> example (if possible). But, I don't see another solution and this is why I 
> wrote here. What do you think? What is the best approach?
>

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mechanical-sympathy+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


garbage-free java.nio

2018-03-11 Thread John Hening
Hello,

recently I am interested in non-blokcing java api for networking. It seems 
to be great. However, I would like to implement garbage-free solution. I am 
trying to do it only for learning purpose (I know that I don't implement a 
"better" solution). Especially, my solution is going to be garbage-free. 

How to start? I see that jdk implementation is not garbage-free. And what? 
My only idea is to implement a small native library (only for Linux) and 
implement something like "facade" and a lot of stuff around that in Java 
(but, garbage-free).
I suppose that it can be very hard to integrate it with selectors for 
example (if possible). But, I don't see another solution and this is why I 
wrote here. What do you think? What is the best approach?

-- 
You received this message because you are subscribed to the Google Groups 
"mechanical-sympathy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mechanical-sympathy+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.