On Thursday, March 15, 2018 at 4:23:41 AM UTC+8, Bakul Shah wrote:
>
>
> You will need 10K*64KiB*2 = 1.22GiB kernel bufferspace at a 
> minimum in any case.  That is still one datagram's worth of 
> buffering per UDP socket so you can still lose some packets. 
> This is in addition to any user level buffering passd in to 
> recv() or read(). So you need at least 2.48GiB! 
>

Yeah, there's no way to avoid the kernel buffer waste. For the UDP socket 
I'm fine losing a few packets from time to time because it does not promise 
reliable delivery anyway.

 

> I did such a custom poller for a network proxy. It was a pain 
> to get right (I only did the Eww!poll version). In my case all 
> the traffic was via tcp. It has been a while now but IIRC my 
> reason was not to save memory but to gain flexibility over Go 
> runtime's networking. I don't remember the details now though. 
>

I tried and it was indeed a lot of work. So I'm trying to see if there's a 
middle ground that could keep using goroutine (2kb stack is acceptable) but 
avoid the data buffer waste. Please see my previous reply about exposing a 
tiny bit of information from the internal poller to address the issue. I'd 
like to see if there's any downside of that. Thanks! :) 

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

Reply via email to