[ 
https://issues.apache.org/jira/browse/SOLR-15301?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17423179#comment-17423179
 ] 

Andras Salamon commented on SOLR-15301:
---------------------------------------

Asking only for specific metrics instead of all the metrics is a good practice, 
but sometimes clients ask for all the possible metrics. And if someone asks for 
three index size metrics (for whatever reason), it is not too good to repeat 
the index size calculation.

My first idea was also to use a timestamp and some deadline for the expiration 
but choose ThreadLocal because of two reasons:
 * I was not able to find a good deadline. It depends on the speed of the index 
size calculation, and the frequency of the metrics call, which is different for 
each scenario. If I hardwire one second and the index size calculation is 
slower it will repeat the calculations. The slower the calculation the more 
likely we will repeat.
 * Without this commit (or with the timestamp expiration solution) the values 
returned by a single metrics call are not consistent. Right now we calculate 
the index size three times, and the three calculations might return different 
values. So now it's possible that we return the raw size 100000 (byes) and the 
human readable for 200Kb. The ThreadLocal ensures that the values returned in a 
single call are consistent.

> Eliminate repetitive index size calculation for Solr metrics
> ------------------------------------------------------------
>
>                 Key: SOLR-15301
>                 URL: https://issues.apache.org/jira/browse/SOLR-15301
>             Project: Solr
>          Issue Type: Improvement
>          Components: metrics
>            Reporter: Andras Salamon
>            Assignee: Andras Salamon
>            Priority: Minor
>             Fix For: main (9.0)
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> During metrics calculation Solr asks for core indexSize three times. Twice in 
> SolrCore and once in ReplicationHandler. It slows down metrics calculation 
> and it is also possible that these three reported values are not exactly the 
> same if size changes during calculation.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@solr.apache.org
For additional commands, e-mail: issues-h...@solr.apache.org

Reply via email to