Skip to content
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

Make disk persistence capacity configurable #2329

Merged
merged 5 commits into from
Jun 20, 2022
Merged

Conversation

heyams
Copy link
Contributor

@heyams heyams commented Jun 15, 2022

No description provided.

@@ -304,6 +304,9 @@ public static class PreviewConfiguration {
// telemetry (they are much smaller so a larger queue size is ok)
public int metricsExportQueueCapacity = 65536;

// disk persistence has a default capacity of 50MB
public int diskPersistenceMaxSizeMb = 50;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2.x SDK enforces a limit of 1 GB:

I'm not really sure the reason, can you see if Application Insights .NET SDK has a max capacity that users can configure? if they do, we may want to implement that max too

also, I wonder if we should allow 0, meaning disable disk persistency, which users on read-only filesystems could use (and then we wouldn't need to log warning for those users)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet is default to 50MB as well. they use 30 seconds as the default sending interval. same as us.. it's not configured. we could ignore value that is less than 50? and document it?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet source code

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dotnet is default to 50MB as well

do they allow user to configure this? and if so, do they have a maximum value that the user can set?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's fixed. no configuration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

but wait, is it exposed to customers though? is it available in the public interface?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, does the .Net SDK impose any limit on how large the user can configure it to be?

Only limit is the maximum value of long itself.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks like it's public API. based on the code, it can be any number.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

awesome, thx all 👍

Copy link
Contributor Author

@heyams heyams Jun 17, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/microsoft/Telemetry-Collection-Spec/pull/83 we can use that pr to propose a solution.

Comment on lines +56 to +58
// send persisted telemetries from local disk every 30 seconds by default.
// if diskPersistenceMaxSizeMb is greater than 50, it will get changed to 10 seconds.
long intervalSeconds = diskPersistenceMaxSizeMb > 50 ? 10 : 30;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

estimating how long this will take to send a large number of batches from disk:

600 characters per telemetry

  • 512 telemetry per batch
    = ~300kb per batch

1gb of telemetry will be ~3000 batches

so sending 1 batch per 10 seconds, this will take 8 hours

which is not bad

(we can always revisit this detail when spec'ing it out with other langs)

Copy link
Contributor Author

@heyams heyams Jun 16, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i can add a todo to revisit this interval.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@trask We allow (in .NET) users to configure how many parallel sends can occur. (Default is 10). They can increase it to a large number, increasing the throughput heavily, subject to physical limitations of the network itself.

While scenarios like load testing, by increasing the senders, user could send HUGE amounts of data.

@heyams heyams marked this pull request as ready for review June 16, 2022 00:03
@heyams heyams requested a review from jeanbisutti as a code owner June 16, 2022 00:03
LocalFileCache localFileCache,
File telemetryFolder,
LocalStorageStats stats,
boolean suppressWarnings) { // used to suppress warnings from statsbeat
this.telemetryFolder = telemetryFolder;
this.localFileCache = localFileCache;
this.stats = stats;
this.diskPersistenceMaxSizeBytes = diskPersistenceMaxSizeMb * 1024L * 1024L;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it would not be an issue in terms of allocation, it may be worth introducing a DiskPersistenceMaxSize object type. It would have advantages:

  • A method could be added to the DiskPersistenceMaxSize object type to encapsulate this kind of code: diskPersistenceMaxSizeMb * 1024L * 1024L;
  • This would remove the need to add comments (for example in AzureMonitorExporterBuilder for this PR)
  • This would strengthen the code checks at compilation

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment is only for default value. creating an object for a primitive type with super simple arithmetic is not worthy in my opinion.

@trask trask merged commit c7783a8 into main Jun 20, 2022
@trask trask deleted the heya/expose-disk-limit branch June 20, 2022 18:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants