Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread robert engels
100% (the argument is simpler though if you focus on UDP rather than TCP). If you think usecs matter that much you need to be hardware based or you’ve already lost. Most people that are concerned about usecs have other latency killers that are in the 100’s of milliseconds - but they never

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread Amnon
Go is designed to maximize throughput, rather than minimize latency. Where does latency come from? 0) serialization delay reading the NIC (packet length/network speed) 1) when a packet arrives the NIC DMA's its contents into memory 2) the NIC then waits to see if more packets arrive (about

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread robert engels
It is probably not the data in the cache - it is the code - whether yours or the kernel. Did you try “hot threading” with polling in the C code? Did you see the same results? Typically a context switch on modern linux is 6 usecs - so I am doubting that is the source of your latency. > On Jul

[go-nuts] Short destination error with unicode.Transform

2022-07-29 Thread Joe Schafer
I had a curious bug appear in my server logs when using a unicode Transformer: transform unicode "wind-Pa\x00\x00\x00" to ascii: transform: short destination buffer Here's the simplified code that caused the error (Gist and

Re: [go-nuts] How runtime.schedule gets its processor runq

2022-07-29 Thread Ian Lance Taylor
On Fri, Jul 29, 2022 at 7:34 AM Olevs Olevs wrote: > > According to source code, schedule() function represents one round of > scheduling. From here we are looking for local p queue (or sometimes global > from sched for fairness), then find runnable g and execute it. As a > standalone

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread TH
In case of cache miss, I assume there's no way to tell CPU to keep the data in the cache? The structs related to processing is all below cache line size. (the test code is very crude one, not really much processing done) On the dedicated thread polling sockets... could I move away net and use

Re: [go-nuts] Minimizing net latency?

2022-07-29 Thread robert engels
Since the net IO is abstracted away from you, the answer is ’not usually’. The usual solution is dedicated threads that constantly poll the sockets, or hardware support + real-time threads, etc. BUT, typically this is not what you are experiencing. More likely, the cpu cache gets cold - so the

[go-nuts] Minimizing net latency?

2022-07-29 Thread TH
Hey, Bit confused on how stdlib net is implemented, but I'm noticing round trip >150µs latencies on idle connections (loopback). Round trip latency will drop to <20µs if sent packets constantly. I assume that this latency is caused by kernel / syscall wakeup to indicate that new data has

Re: [go-nuts] Re: Generic error handling with panic, recover, and defer

2022-07-29 Thread 'Sean Liao' via golang-nuts
or https://github.com/dsnet/try - sean On Fri, Jul 29, 2022, 23:01 Nathaniel Lehrer wrote: > This is similar, maybe this one is better to use? > https://github.com/lainio/err2 > > On Tuesday, September 21, 2021 at 1:57:38 PM UTC-7 mces...@gmail.com > wrote: > >> With go 1.18 generics

[go-nuts] Re: Generic error handling with panic, recover, and defer

2022-07-29 Thread Nathaniel Lehrer
Hi mcesar, thanks for putting this together! I'm thinking about using this for our project... Curious if anyone would like to share their experience employing this library? On Tuesday, September 21, 2021 at 1:57:38 PM UTC-7 mces...@gmail.com wrote: > With go 1.18 generics implementation it is

[go-nuts] Re: Generic error handling with panic, recover, and defer

2022-07-29 Thread Nathaniel Lehrer
This is similar, maybe this one is better to use? https://github.com/lainio/err2 On Tuesday, September 21, 2021 at 1:57:38 PM UTC-7 mces...@gmail.com wrote: > With go 1.18 generics implementation it is now possible to provide error > handling functions in a fashion similar to the "try"

[go-nuts] How runtime.schedule gets its processor runq

2022-07-29 Thread Olevs Olevs
According to source code, schedule() function represents one round of scheduling. From here we are looking for local p queue (or sometimes global from sched for fairness), then find runnable g and execute it. As a standalone function, how do this function knows inside which p to perform a