-
Notifications
You must be signed in to change notification settings - Fork 27
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
[148] Transfer settings optimizer #219
Conversation
} | ||
} | ||
|
||
public long TotalMemory |
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.
is this in bytes or a different unit? Would be helpful to name variable as such
{ | ||
get | ||
{ | ||
return (long)(Convert.ToUInt64(File.ReadLines(ProcMemInfo).First(line => line.StartsWith("MemTotal")).Split(' ', StringSplitOptions.RemoveEmptyEntries)[1]) * 1024); |
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.
Could Convert.ToInt64 instead of casting ulong as long? Also could store this in a static variable so the file system is only used once
private readonly ISystemInfoProvider systemInfoProvider; | ||
private const double MemoryBufferCapacityFactor = 0.4; // 40% of total memory | ||
private const long MaxMemoryBufferSizeInBytes = BlobSizeUtils.GiB * 2; // 2 GiB of total memory | ||
private const int MaxNumberOfWorkingOfThreads = 90; |
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.
maybe rename to MaxWorkingThreadsCount. I'm surprised it's not valuable to vary this based on core count?
private BlobPipelineOptions CreateOptimizedOptions(BlobPipelineOptions options) | ||
{ | ||
var blockSize = GetBlockSize(options.BlockSizeBytes); | ||
var bufferCapacity = GetOptimizedMemoryBufferCapacity(blockSize); |
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.
what unit is this? If bytes, helpful to have variable name include it
|
||
private BlobPipelineOptions CreateOptimizedOptions(BlobPipelineOptions options) | ||
{ | ||
var blockSize = GetBlockSize(options.BlockSizeBytes); |
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.
unit?
return ToTens((int)(Convert.ToInt64(memoryBuffer) / blockSize)); | ||
} | ||
|
||
private int ToTens(int value) |
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.
RoundDownToNearestTen() might be more descriptive
{ | ||
get | ||
{ | ||
return File.ReadLines(ProcCpuInfo).Count(line => line.StartsWith("processor")); |
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.
maybe just do this once, and then store it in a static variable, since this will never change in the process lifetime, and multiple invocations of the file system isn't ideal?
This PR includes: