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

Russell Black commented on SOLR-16982:
--------------------------------------

I've attached a file showing an alternate approach to this problem, which 
implements the circuit breaker as a search component, and truly protects 
servers against high CPU, even in sharded environments.  The file is called 
CircuitBreakerSearchComponent.java.  Attaching it here in case it helps anyone 
else.  


/**
* Circuit Breaker Search Component
** This component monitors CPU usage and can trip a circuit breaker
* to prevent further processing if the CPU usage exceeds a specified threshold.
* It is designed to be used in Solr to protect against high CPU usage
* that could lead to performance degradation or system instability.
* It can be configured in the solrconfig.xml file.
*
* It is intended to be configured as the first search component
*
* Example configuration:
*
* <pre>
* <searchComponent name="circuitBreaker" 
class="com.yoursite.CircuitBreakerSearchComponent">
* <double name="cpuThreshold">95</double>
*. </searchComponent>
*
* <requestHandler name="circuitBreakerHandler" 
class="org.apache.solr.handler.component.SearchHandler">
* ...
* <arr name="first-components">
* <str>circuitBreaker</str>
* </arr>
* </requestHandler>
* </pre>
*
* This component checks the CPU usage before processing a request.
* If the CPU usage exceeds the configured threshold, it will throw an exception
* to prevent further processing.
*
* The exception thrown is ExitableDirectoryReader.ExitingReaderException,
* which is the same exception used by Solr when the timeAllowed parameter is 
exceeded.
*/
 

> Trip a Circuit Breaker only for external requests
> -------------------------------------------------
>
>                 Key: SOLR-16982
>                 URL: https://issues.apache.org/jira/browse/SOLR-16982
>             Project: Solr
>          Issue Type: Improvement
>          Components: Circuit Breakers
>            Reporter: Jan Høydahl
>            Assignee: Jan Høydahl
>            Priority: Major
>             Fix For: 9.4
>
>         Attachments: CircuitBreakerSearchComponent.java
>
>          Time Spent: 1h
>  Remaining Estimate: 0h
>
> In a sharded system, Circuit Breakers may now break a shard-request, failing 
> the entire query request and in worst-case cause data loss (?) in an update 
> request.
> We should see whether we can skip CB checking for the internal requests.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to