SOLR-12353: SolrDispatchFilter expensive non-conditional debug line degrades performance

This commit is contained in:
Erick Erickson 2020-03-19 15:26:44 -04:00
parent e36733d01d
commit 5fd55d77e9
2 changed files with 14 additions and 8 deletions

View File

@ -86,6 +86,8 @@ Other Changes
* SOLR-13944: Remove redundant checks in SpellCheckCollator and add tests for spellcheck with collapse * SOLR-13944: Remove redundant checks in SpellCheckCollator and add tests for spellcheck with collapse
(Stefan, Munendra S N, Tomas Eduardo Fernandez Lobbe) (Stefan, Munendra S N, Tomas Eduardo Fernandez Lobbe)
* SOLR-12353: SolrDispatchFilter expensive non-conditional debug line degrades performance (Pascal Proulx via Erick Erickson)
================== 8.5.0 ================== ================== 8.5.0 ==================
Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release. Consult the LUCENE_CHANGES.txt file for additional, low level, changes in this release.

View File

@ -146,7 +146,9 @@ public class SolrDispatchFilter extends BaseSolrFilter {
public void init(FilterConfig config) throws ServletException public void init(FilterConfig config) throws ServletException
{ {
SSLConfigurationsFactory.current().init(); SSLConfigurationsFactory.current().init();
log.trace("SolrDispatchFilter.init(): {}", this.getClass().getClassLoader()); if (log.isTraceEnabled()) {
log.trace("SolrDispatchFilter.init(): {}", this.getClass().getClassLoader());
}
CoreContainer coresInit = null; CoreContainer coresInit = null;
try{ try{
@ -161,7 +163,7 @@ public class SolrDispatchFilter extends BaseSolrFilter {
} }
String logLevel = System.getProperty(SOLR_LOG_LEVEL); String logLevel = System.getProperty(SOLR_LOG_LEVEL);
if (logLevel != null) { if (logLevel != null) {
log.info("Log level override, property solr.log.level=" + logLevel); log.info("Log level override, property solr.log.level={}", logLevel);
StartupLoggingUtils.changeLogLevel(logLevel); StartupLoggingUtils.changeLogLevel(logLevel);
} }
@ -184,7 +186,9 @@ public class SolrDispatchFilter extends BaseSolrFilter {
SolrPaths.ensureUserFilesDataDir(solrHomePath); SolrPaths.ensureUserFilesDataDir(solrHomePath);
this.httpClient = coresInit.getUpdateShardHandler().getDefaultHttpClient(); this.httpClient = coresInit.getUpdateShardHandler().getDefaultHttpClient();
setupJvmMetrics(coresInit); setupJvmMetrics(coresInit);
log.debug("user.dir=" + System.getProperty("user.dir")); if (log.isDebugEnabled()) {
log.debug("user.dir={}", System.getProperty("user.dir"));
}
} }
catch( Throwable t ) { catch( Throwable t ) {
// catch this so our filter still works // catch this so our filter still works
@ -485,21 +489,21 @@ public class SolrDispatchFilter extends BaseSolrFilter {
// /admin/info/key must be always open. see SOLR-9188 // /admin/info/key must be always open. see SOLR-9188
String requestPath = ServletUtils.getPathAfterContext(request); String requestPath = ServletUtils.getPathAfterContext(request);
if (PublicKeyHandler.PATH.equals(requestPath)) { if (PublicKeyHandler.PATH.equals(requestPath)) {
if (log.isDebugEnabled()) log.debug("Pass through PKI authentication endpoint");
log.debug("Pass through PKI authentication endpoint");
return true; return true;
} }
// /solr/ (Admin UI) must be always open to allow displaying Admin UI with login page // /solr/ (Admin UI) must be always open to allow displaying Admin UI with login page
if ("/solr/".equals(requestPath) || "/".equals(requestPath)) { if ("/solr/".equals(requestPath) || "/".equals(requestPath)) {
if (log.isDebugEnabled()) log.debug("Pass through Admin UI entry point");
log.debug("Pass through Admin UI entry point");
return true; return true;
} }
String header = request.getHeader(PKIAuthenticationPlugin.HEADER); String header = request.getHeader(PKIAuthenticationPlugin.HEADER);
if (header != null && cores.getPkiAuthenticationPlugin() != null) if (header != null && cores.getPkiAuthenticationPlugin() != null)
authenticationPlugin = cores.getPkiAuthenticationPlugin(); authenticationPlugin = cores.getPkiAuthenticationPlugin();
try { try {
log.debug("Request to authenticate: {}, domain: {}, port: {}", request, request.getLocalName(), request.getLocalPort()); if (log.isDebugEnabled()) {
log.debug("Request to authenticate: {}, domain: {}, port: {}", request, request.getLocalName(), request.getLocalPort());
}
// upon successful authentication, this should call the chain's next filter. // upon successful authentication, this should call the chain's next filter.
requestContinues = authenticationPlugin.authenticate(request, response, (req, rsp) -> { requestContinues = authenticationPlugin.authenticate(request, response, (req, rsp) -> {
isAuthenticated.set(true); isAuthenticated.set(true);