openebs-archive / longhorn

We put storage on cows and move them around
Apache License 2.0
18 stars 12 forks source link

Avoid 'defer unlocks' in hot paths of longhorn #24

Closed ksatchit closed 4 years ago

ksatchit commented 6 years ago

There seems to be heavy overhead with usage of 'defer unlocks' in go code. This link says so: https://medium.com/i0exception/runtime-overhead-of-using-defer-in-go-7140d5c40e32

This issue is to convert 'defer unlocks' to just unlocks at all the required exit places in hot paths of longhorn.

ksatchit commented 6 years ago

cc: @payes @vishnuitta

klebervirgilio commented 6 years ago

Hi, if I got it correctly, we're talking about replacing: defer mu.Unlock() to just calling mu.Unlock() in the end of the function?

utkarshmani1997 commented 6 years ago

@klebervirgilio you are correct. This has to be handled optimally

klebervirgilio commented 6 years ago

Got it! Thanks @umamukkara

  1. Which are the hot paths?
  2. How can I start on this one and how would I know I'd have finished?
vishnuitta commented 6 years ago

@klebervirgilio .. thanks for showing interest in this Hot paths are related to IO paths. You can start from ReadAt, WriteAt functions in controller/control.go and follow the path to know IO path in controller side, and, similarly Handle() in rpc/server.go for replica side IO handling.

khushbuparakh commented 6 years ago

@vishnuitta @klebervirgilio If it's still up for grab. I would like to work on it?

utkarshmani1997 commented 6 years ago

Hi @khushbuparakh , Thanks for showing interest in this. Please go ahead and let us know if you need any help.

Happy Hacktoberfest :)