-
Notifications
You must be signed in to change notification settings - Fork 682
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
A new stat for bytes read off the disk #1702
Changes from 11 commits
fd60128
6d99c50
40e12f9
bb8fd0f
00d9e54
6a6bca4
3d77ee3
a950955
230159d
54590cc
14beae4
b1ef31f
342884d
4181e23
aae6b86
05c5ea1
6284a48
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 |
---|---|---|
|
@@ -387,13 +387,23 @@ func (s *Scorch) Batch(batch *index.Batch) (err error) { | |
analysisResults := make([]index.Document, int(numUpdates)) | ||
var itemsDeQueued uint64 | ||
var totalAnalysisSize int | ||
analysisBytes := func(tokMap index.TokenFrequencies) (rv uint64) { | ||
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. Should we add a flag here to calculate this only when the flag is set? Feel like this is something we don't always necessarily need to do - hope none of this calculation shows up in CPU profiles? 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. Not sure if this is enough, we've to record copies - stored values and doc values. Also term vectors. I don't see you doing this in your zap PR. 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. Just to close the thread, these two changes are going to be included in upcoming PRs. |
||
for k := range tokMap { | ||
rv += uint64(len(k)) | ||
} | ||
return rv | ||
} | ||
for itemsDeQueued < numUpdates { | ||
result := <-resultChan | ||
resultSize := result.Size() | ||
atomic.AddUint64(&s.iStats.analysisBytesAdded, uint64(resultSize)) | ||
totalAnalysisSize += resultSize | ||
analysisResults[itemsDeQueued] = result | ||
itemsDeQueued++ | ||
result.VisitFields(func(f index.Field) { | ||
atomic.AddUint64(&s.stats.TotIndexedAnalysisBytes, | ||
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. better stats wordings TotBytesIndexedAfterAnalysis? so that both stats share the same prefix. 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. done. |
||
analysisBytes(f.AnalyzedTokenFrequencies())) | ||
}) | ||
} | ||
close(resultChan) | ||
defer atomic.AddUint64(&s.iStats.analysisBytesRemoved, uint64(totalAnalysisSize)) | ||
|
@@ -525,6 +535,14 @@ func (s *Scorch) Stats() json.Marshaler { | |
return &s.stats | ||
} | ||
|
||
func (s *Scorch) BytesRead() uint64 { | ||
Thejas-bhat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
return s.stats.TotBytesReadQueryTime | ||
} | ||
|
||
func (s *Scorch) SetBytesRead(val uint64) { | ||
atomic.StoreUint64(&s.stats.TotBytesReadQueryTime, val) | ||
} | ||
|
||
func (s *Scorch) diskFileStats(rootSegmentPaths map[string]struct{}) (uint64, | ||
uint64, uint64) { | ||
var numFilesOnDisk, numBytesUsedDisk, numBytesOnDiskByRoot uint64 | ||
|
@@ -582,7 +600,9 @@ func (s *Scorch) StatsMap() map[string]interface{} { | |
m["index_time"] = m["TotIndexTime"] | ||
m["term_searchers_started"] = m["TotTermSearchersStarted"] | ||
m["term_searchers_finished"] = m["TotTermSearchersFinished"] | ||
m["num_bytes_read_query_time"] = m["TotBytesReadQueryTime"] | ||
m["num_plain_text_bytes_indexed"] = m["TotIndexedPlainTextBytes"] | ||
m["num_analysis_bytes_indexed"] = m["TotIndexedAnalysisBytes"] | ||
Thejas-bhat marked this conversation as resolved.
Show resolved
Hide resolved
|
||
m["num_items_introduced"] = m["TotIntroducedItems"] | ||
m["num_items_persisted"] = m["TotPersistedItems"] | ||
m["num_recs_to_persist"] = m["TotItemsToPersist"] | ||
|
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.
var rv uint64?
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.
done.