]> source.dussan.org Git - sonarqube.git/commitdiff
SOANR-5007 - Perf driven ES configuration
authorStephane Gamard <stephane.gamard@searchbox.com>
Thu, 12 Jun 2014 15:24:06 +0000 (17:24 +0200)
committerStephane Gamard <stephane.gamard@searchbox.com>
Thu, 12 Jun 2014 17:19:41 +0000 (19:19 +0200)
sonar-server/src/main/java/org/sonar/server/search/BaseIndex.java
sonar-server/src/main/java/org/sonar/server/search/ESNode.java

index 883f9ef14f8c352b813fa13bfd20e41aa39e51f1..aa32d5fc7efb7849de964ef8c09b3cecebd8a208 100644 (file)
@@ -27,7 +27,6 @@ import org.elasticsearch.action.index.IndexRequest;
 import org.elasticsearch.action.search.SearchScrollRequestBuilder;
 import org.elasticsearch.action.update.UpdateRequest;
 import org.elasticsearch.client.Client;
-import org.elasticsearch.common.settings.ImmutableSettings;
 import org.elasticsearch.common.settings.Settings;
 import org.elasticsearch.common.unit.TimeValue;
 import org.elasticsearch.common.xcontent.XContentBuilder;
@@ -155,20 +154,20 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
   private void initializeManagementIndex() {
     LOG.debug("Setup of Management Index for ES");
 
-    String index = indexDefinition.getManagementIndex();
-
-    IndicesExistsResponse indexExistsResponse = getClient().admin().indices()
-      .prepareExists(index).execute().actionGet();
-
-    if (!indexExistsResponse.isExists()) {
-      getClient().admin().indices().prepareCreate(index)
-        .setSettings(ImmutableSettings.builder()
-          .put("mapper.dynamic", true)
-          .put("number_of_replicas", 1)
-          .put("number_of_shards", 1)
-          .build())
-        .get();
-    }
+//    String index = indexDefinition.getManagementIndex();
+//
+//    IndicesExistsResponse indexExistsResponse = getClient().admin().indices()
+//      .prepareExists(index).execute().actionGet();
+//
+//    if (!indexExistsResponse.isExists()) {
+//      getClient().admin().indices().prepareCreate(index)
+//        .setSettings(ImmutableSettings.builder()
+//          .put("mapper.dynamic", true)
+//          .put("number_of_replicas", 1)
+//          .put("number_of_shards", 1)
+//          .build())
+//        .get();
+//    }
   }
 
   protected void initializeIndex() {
@@ -391,6 +390,8 @@ public abstract class BaseIndex<DOMAIN, DTO extends Dto<KEY>, KEY extends Serial
       .admin()
       .indices()
       .prepareRefresh(this.getIndexName())
+      .setForce(false)
+      .setIndices(this.getIndexName())
       .get();
   }
 
index cd7c4fb3fdd1b2e1987cc72d4976e48ee37dcb6d..2abf70e2b956a496ab12b2c054f0c8877bcc26b6 100644 (file)
@@ -80,6 +80,12 @@ public class ESNode implements Startable {
       IndexProperties.ES_TYPE.DATA;
 
     ImmutableSettings.Builder esSettings = ImmutableSettings.settingsBuilder()
+      .put("index.merge.policy.max_merge_at_once", "200")
+      .put("index.merge.policy.segments_per_tier", "200")
+
+      .put("indices.store.throttle.type", "merge")
+      .put("indices.store.throttle.max_bytes_per_sec", "200mb")
+
       .put("script.default_lang", "native")
       .put("script.native." + ListUpdate.NAME + ".type", UpdateListScriptFactory.class.getName());
 
@@ -146,6 +152,7 @@ public class ESNode implements Startable {
       .put("node.name", "sonarqube-" + System.currentTimeMillis())
       .put("node.data", true)
       .put("node.local", true)
+      .put("index.store.type", "mmapfs")
       .put("cluster.name", "sonarqube")
       .put("index.number_of_shards", "1")
       .put("index.number_of_replicas", "0");