-
Notifications
You must be signed in to change notification settings - Fork 193
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore: little refactor of perf_optimization code #870
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -99,14 +99,16 @@ func (d *Driver) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolumeRe | |
return nil, status.Errorf(codes.Internal, "Failed to get perf attributes for %s. Error: %v", source, err) | ||
} | ||
|
||
if d.getDeviceHelper().DiskSupportsPerfOptimization(profile, accountType) { | ||
err = d.getDeviceHelper().OptimizeDiskPerformance(d.getNodeInfo(), d.getDiskSkuInfoMap(), source, profile, accountType, | ||
diskSizeGibStr, diskIopsStr, diskBwMbpsStr) | ||
if err != nil { | ||
return nil, status.Errorf(codes.Internal, "Failed to optimize device performance for target(%s) error(%s)", source, err) | ||
if isPerfTuningEnabled(profile) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is redundant. We call this in disksupportsperfoptimization and it doesn't need to be called on unsupported platforms. |
||
// save one logging since perfTuning is disabled by default | ||
if d.getDeviceHelper().DiskSupportsPerfOptimization(profile, accountType) { | ||
if err := d.getDeviceHelper().OptimizeDiskPerformance(d.getNodeInfo(), d.getDiskSkuInfoMap(), source, profile, accountType, | ||
diskSizeGibStr, diskIopsStr, diskBwMbpsStr); err != nil { | ||
return nil, status.Errorf(codes.Internal, "Failed to optimize device performance for target(%s) error(%s)", source, err) | ||
} | ||
} else { | ||
klog.V(2).Infof("NodeStageVolume: perf optimization is disabled for %s. perfProfile %s accountType %s", source, profile, accountType) | ||
} | ||
} else { | ||
klog.V(2).Infof("NodeStageVolume: perf optimization is disabled for %s. perfProfile %s accountType %s", source, profile, accountType) | ||
} | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,14 +85,16 @@ func (d *DriverV2) NodeStageVolume(ctx context.Context, req *csi.NodeStageVolume | |
return nil, status.Errorf(codes.Internal, "Failed to get perf attributes for %s. Error: %v", source, err) | ||
} | ||
|
||
if d.getDeviceHelper().DiskSupportsPerfOptimization(profile, accountType) { | ||
err = d.getDeviceHelper().OptimizeDiskPerformance(d.getNodeInfo(), d.getDiskSkuInfoMap(), source, profile, accountType, | ||
diskSizeGibStr, diskIopsStr, diskBwMbpsStr) | ||
if err != nil { | ||
return nil, status.Errorf(codes.Internal, "Failed to optimize device performance for target(%s) error(%s)", source, err) | ||
if isPerfTuningEnabled(profile) { | ||
// save one logging since perfTuning is disabled by default | ||
if d.getDeviceHelper().DiskSupportsPerfOptimization(profile, accountType) { | ||
if err := d.getDeviceHelper().OptimizeDiskPerformance(d.getNodeInfo(), d.getDiskSkuInfoMap(), source, profile, accountType, | ||
diskSizeGibStr, diskIopsStr, diskBwMbpsStr); err != nil { | ||
return nil, status.Errorf(codes.Internal, "Failed to optimize device performance for target(%s) error(%s)", source, err) | ||
} | ||
} else { | ||
klog.V(2).Infof("NodeStageVolume: perf optimization is disabled for %s. perfProfile %s accountType %s", source, profile, accountType) | ||
} | ||
} else { | ||
klog.V(2).Infof("NodeStageVolume: perf optimization is disabled for %s. perfProfile %s accountType %s", source, profile, accountType) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a single log line per attach which tells me if all the properties made it to volume attributes. Will allow us to easily confirm if the perf optimization was not done on disk. I think we should leave it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if one feature is not enabled in storage class by user, no need to mention again in logs There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is a good amount of code which goes in and parses the attributes from storage class then moves I to volume and then parses it from attribute. Even if we see something in storage class and StageVolume request may never translate in to perf optimization, this single log line tells me if optimization happened for my target. For what its worth I open my log and look for this straightaway. What you're suggesting is a round about way of determining the same. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I mean if it's
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In windows, you're going to see even if perfProfile is basic or anything else in storage class, then also we will not optimize. Point is even if storage class carries some value we run some logic to determine if optimization is enabled, which is bound to evolve over time. This line captures that logic and tell me the answer I would be looking for in the logs, without having to look at other things in code etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. anyway, I reverted, let's move forward. |
||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V(2)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to print two logs since last log already has enough info:
I am trying to reduce logs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was pointing out the V(12), I thought it was a typo and the highest was V(5)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
V(12) is for debugging, no need to print every log in our driver by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Understood that part. Should we set this to v(5)? or v(12) is what we use?
https://github.com/kubernetes/community/blob/master/contributors/devel/sig-instrumentation/logging.md
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we still print v(5) logs by default now, set as v(6 or bigger) would not print now.