Re:Show HN: go-nbd – A Pure Go NBD Server and Client
by pojntfx on Wednesday March 29, 2023 @01:58PM
(#35360845)
Thanks, I had not heard of that package, I will be sure to check it out!
Re:Show HN: go-nbd – A Pure Go NBD Server and Client
by tptacek on Wednesday March 29, 2023 @03:13PM
(#35361863)
Probably wouldn't do this unless you really needed to; nbd workloads are probably easier than HTTP workloads (a single NBD "mount" might have lots of connections, but you're not adding and removing hundres of connections per second).
Re:Show HN: go-nbd – A Pure Go NBD Server and Client
by latchkey on Wednesday March 29, 2023 @04:39PM
(#35363225)
You might be right. Different workloads will definitely have different effects. That said, implementing the gnet api is pretty easy and doesn't require a huge context switch. It is worth a test to see which one performs better.
I used it for a tcp connection (json-rpc) workload and it was far better and the code was cleaner.
Re:Show HN: go-nbd – A Pure Go NBD Server and Client
by tptacek on Wednesday March 29, 2023 @04:53PM
(#35363450)
Right, I don't want to talk down gnet, it's neat, but you're basically writing non-idiomatic libevent-style networking code --- ie, very non-idiomatic Go code --- and it seems to me like most of the perf win here is minimizing the number of goroutines you have serving blocking operations, which is not really a problem you're going to have with an NBD implementation.
Re:Show HN: go-nbd – A Pure Go NBD Server and Client
by latchkey on Wednesday March 29, 2023 @05:19PM
(#35363849)
I see your point. In my case it was basically a proxy concentrator. On one side, accept and hold open a huge number of connections, then maintain a single open connection on the other side. It worked really well for this situation.
[0] https://github.com/panjf2000/gnet