Skip to content
This repository has been archived by the owner on Oct 29, 2021. It is now read-only.

InfluxDBStore: add proper point-batching support based on memory constraint #157

Closed

Conversation

emidoots
Copy link
Member

Based on #156 for simplicity.

func (in *InfluxDBStore) Close() error {
close(in.flusherStopChan)
if err := in.flush(); err != nil {
return err
Copy link
Member

Choose a reason for hiding this comment

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

should Close return an error if flush fails? I'd expect it to have a similiar behaviour as above, and just cause a log. Also as this stands, if the flush fails, the server doesn't close.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point. WIll fix.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed by c9dba40

@keegancsmith
Copy link
Member

A few inline comments, otherwise LGTM

Stephen Gutekanst and others added 14 commits April 27, 2016 11:26
traceapp: add trace permalinks which encode the trace within the URL
…onfig

around / within the InfluxDBStore struct directly.
Note: `conf.Data.QueryLogEnabled = false` is intentionally removed. It is
not needed because it is the default already.
- Introduced by `094b22`
- `i` was renamed to `rowIndex` in that commit, but `results[i].Slowest = append(results[i].Slowest, id)`
  was not updated to reflect this.

Confirmed fix by visiting the Dashboard page (no more panic).
What these fields mean:

- In [PR #113](#113) both `FlushTimeout`
  and `MaxQueueSize` were added as fields to `ChunkedCollector`.
- `MaxQueueSize` effectively imposes a memory constraint on the queue such that it
  cannot grow above the given size, ever. In the event that it tries to (i.e. Flush
  / the underlying Collector is not collecting quick enough), the entire queue is
  dropped within `ChunkedCollector.Collect`.
- `FlushTimeout` gives an assurance that the `Flush` operation does not exceed a
  given timeframe. This is useful because when stopping a `ChunkedCollector` via
  `Stop` you typically also want to call `Flush` prior (for a graceful shutdown).

Why the change:

- As stated above `FlushTimeout` is good for the scenario of graceful shutdowns of
  a `ChunkedCollector`. However, for the case of preventing memory buildup, it does
  not provide much usefulness (rather, `MaxQueueSize` addresses that).
- The prior default for `FlushTimeout` is too over-zealous because it doesn't account
  for network latency, data marshaling, etc. In the case of `InfluxDBStore` this
  becomes even more apparent.
- Change the default to a nice, loose, default value of 2s such that `FlushTimeout`
  is really only providing a guarantee that `Flush` in the case of graceful shutdown
  does eventually happen if the underlying `Collector` isn't responding. Again, for
  the case of preventing memory buildup, `MaxQueueSize` exists works well.
Because this log is currently always initialized to os.Stderr and
cannot be nil.
…eturning

otherwise we potentially do not close the store.
@emidoots emidoots force-pushed the sg/5-influx-batching branch from 3417fb2 to c9dba40 Compare April 27, 2016 18:42
@emidoots
Copy link
Member Author

Merged into master.

@emidoots emidoots closed this Apr 27, 2016
@emidoots emidoots deleted the sg/5-influx-batching branch April 27, 2016 18:54
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants