[
https://issues.apache.org/jira/browse/SOLR-11892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16343843#comment-16343843
]
hamada commented on SOLR-11892:
-------------------------------
Few points about Exception cost:
* It can not be assumed that all JVM's are all optimized the same, therefore,
performance cost should not be ignored. General assumptions on cost should not
be based on one VM's optimization.
* Exception creation has associated cost, follow the stack on an exception
creation :
** public synchronized Throwable fillInStackTrace() {
if (stackTrace != null ||
backtrace != null /* Out of protocol state */ ) {
fillInStackTrace(0);
stackTrace = UNASSIGNED_STACK;
}
return this;
}
private native Throwable fillInStackTrace(int dummy);
** In addition to being synchronized, it has a memory cost, the exception, and
all stackelement strings
* Exceptions in the critical path will affect performance, and add to memory
pressure.
** In this use case it appears to be logic flow control, and not of the
Exception
In addition to the cpu and memory cost, the frequency of such an exception, the
absence of file name map entry is indicative of a race condition, a bug, or a
concurrency issue.
The general rule about exceptions, as they're named, they should be of the
exception, and not the norm.
> Avoid unnecessary exceptions in FSDirectory and RAMDirectory
> ------------------------------------------------------------
>
> Key: SOLR-11892
> URL: https://issues.apache.org/jira/browse/SOLR-11892
> Project: Solr
> Issue Type: Improvement
> Security Level: Public(Default Security Level. Issues are Public)
> Reporter: Erick Erickson
> Assignee: Erick Erickson
> Priority: Minor
> Attachments: Screen Shot 2018-01-24 at 9.09.55 PM.png, Screen Shot
> 2018-01-24 at 9.10.47 PM.png
>
>
> In privateDeleteFile, just use deleteIfExists.
> in RamDirectory we can declare a static exception and create it once.
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]