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

Throttle import #3795

Merged
merged 3 commits into from
Aug 22, 2015
Merged

Throttle import #3795

merged 3 commits into from
Aug 22, 2015

Conversation

corylanou
Copy link
Contributor

This adds the ability to throttle the import.

Currently, unthrottled on my machine it tops out at about 160k points per second importing. I have not been able to saturate the system so it may be that some people won't need this option.

To throttle, you use the following command:

influx -import -path=metrics-default.gz -compressed -pps 50000 > failures

Which is stating that you don't want MORE than 50,000 points per second to write to the database. Due to the processing that is taking place however, you will likely never get exactly 50,000 pps, more like 35,000 pps, etc.

I added a status message as well that will give you stats on the progress of the import that shows up like this:

2015/08/21 14:48:01 Processed 3100000 lines.  Time elapsed: 56.740578415s.  Points per second (PPS): 54634

@@ -146,7 +162,7 @@ func (i *Importer) processDML(scanner *bufio.Scanner) {
if strings.HasPrefix(line, "#") {
continue
}
i.batchAccumulator(line)
i.batchAccumulator(line, start)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Very minor, but I wouldn't bother with the variable. i.batchAccumulator(line, time.Now()). Purely cosmetic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This isn't cosmetic. It has to be at the beginning before the loop or it won't be able to calculate the total time lapsed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ah, OK, I misinterpreted the code. Thanks @corylanou

@otoolep
Copy link
Contributor

otoolep commented Aug 21, 2015

OK, I see how it works. There are lots of ways to do this kind of thing, this works. +1

corylanou added a commit that referenced this pull request Aug 22, 2015
@corylanou corylanou merged commit 3036940 into master Aug 22, 2015
@corylanou corylanou deleted the throttle-import branch August 22, 2015 14:04
@pauldix
Copy link
Member

pauldix commented Aug 22, 2015

cherry picked into 0.9.3

@corylanou
Copy link
Contributor Author

Yes pls!

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.

3 participants