try to optimize getting all zfcp controllers#1659
Conversation
Pull Request Test Coverage Report for Build 11243278108Details
💛 - Coveralls |
| for wwpn in wwpns { | ||
| tasks.push(( | ||
| wwpn.clone(), | ||
| tokio::spawn(get_luns(controller_id.to_string(), wwpn.clone())), |
There was a problem hiding this comment.
Instead of spawning all those processes, I would suggest giving join_all a try.
There was a problem hiding this comment.
Tokio has JoinSet, which might be interesting too.
There was a problem hiding this comment.
thanks for suggestion. I plan to have it as experiment first and this tokio spawn is suggested way in that linkedin rust training, so it is the first that I would like to give a try.
There was a problem hiding this comment.
and testing shows that my change somehow does not work, but as it is just learning/research project I will put it a bit on hold and focus on planned stuff and return to it probably next week.
There was a problem hiding this comment.
ok, I cannot sleep without debugging it...so now it is fixed and time is improved to 6.3 second..so already it goes down from 10.8 to 6.3 and I think it can be even better if I parallel also getting wwpns for controller. And then I can start playing with join_all and JoinSet
| let mut tasks = vec![]; | ||
| for (_path, partial_controller) in &devices { | ||
| tasks.push( | ||
| tokio::spawn(get_luns_map(partial_controller.channel.clone())) |
There was a problem hiding this comment.
with this additional paralellization time is reduced to 5.3 seconds. So basically for two controllers with 3 LUNS in total it is gets to half of time. I expect that for bigger systems it will be even more significant.
Problem
Getting zfcp controllers is very slow call.
Solution
Try thread approach without dbus calls for this specific http call.
Testing
original time on our testing s390