Skip to content

armgit / solr

Public Imported from GitHub
0

Apache Solr open-source search software

SOLR-17893: Use caching to remove Remote Proxy bottleneck (#3614)

Houston Putmanfda4c40f53c8
diff --git a/solr/CHANGES.txt b/solr/CHANGES.txt
index 27dbf74f6ce..0f5c32f3ffb 100644
--- a/solr/CHANGES.txt
+++ b/solr/CHANGES.txt
@@ -237,6 +237,8 @@ Improvements
---------------------
* SOLR-17860: DocBasedVersionConstraintsProcessorFactory now supports PULL replicas. (Houston Putman)
+* SOLR-17893: Speed up Remote Proxy for high QPS, utilizing ClusterState caching. (Houston Putman)
+
Optimizations
---------------------
(No changes)
diff --git a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
index b9f3842b820..c0b78fc1a9f 100644
--- a/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
+++ b/solr/core/src/java/org/apache/solr/servlet/HttpSolrCall.java
@@ -327,7 +327,7 @@ public class HttpSolrCall {
}
ZkStateReader zkStateReader = cores.getZkController().getZkStateReader();
Supplier<DocCollection> logic =
- () -> zkStateReader.getClusterState().getCollectionOrNull(collectionName);
+ () -> zkStateReader.getClusterState().getCollectionOrNull(collectionName, true);
DocCollection docCollection = logic.get();
if (docCollection != null) {
@@ -930,7 +930,7 @@ public class HttpSolrCall {
protected String getRemoteCoreUrl(String collectionName) throws SolrException {
ClusterState clusterState = cores.getZkController().getClusterState();
- final DocCollection docCollection = clusterState.getCollectionOrNull(collectionName);
+ final DocCollection docCollection = clusterState.getCollectionOrNull(collectionName, true);
if (docCollection == null) {
return null;
}
diff --git a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
index 41fa9139a8f..36fd30e9b6e 100644
--- a/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
+++ b/solr/solrj-zookeeper/src/java/org/apache/solr/common/cloud/ZkStateReader.java
@@ -764,6 +764,7 @@ public class ZkStateReader implements SolrCloseable {
Stat freshStats = null;
try {
freshStats = zkClient.exists(DocCollection.getCollectionPath(collName), null, true);
+ lastUpdateTime = System.nanoTime();
} catch (Exception e) {
}
if (freshStats != null