From 293eee16115f7c344ba21703bcdbc6fe6eba7cd4 Mon Sep 17 00:00:00 2001 From: balmukundblr Date: Wed, 10 Feb 2021 06:30:37 +0000 Subject: [PATCH 1/2] Added FlushIndexTask to flush data at index thread level. --- .../indexing-flush-by-RAM-multithreaded.alg | 3 +- .../byTask/tasks/FlushIndexTask.java | 37 +++++++++++++++++++ 2 files changed, 39 insertions(+), 1 deletion(-) create mode 100755 lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/FlushIndexTask.java diff --git a/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg b/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg index c25c9c3fac91..d2aaba4c218a 100644 --- a/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg +++ b/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg @@ -53,7 +53,8 @@ log.queries=true { "Populate" CreateIndex - [{ "MAddDocs" AddDoc } : 5000] : 4 + #[{ "MAddDocs" AddDoc } : 5000] : 4 + [{ {{"MAddDocs" AddDoc } : 5000} FlushIndex } ] : 20 ForceMerge(1) CloseIndex } diff --git a/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/FlushIndexTask.java b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/FlushIndexTask.java new file mode 100755 index 000000000000..d951413cccd2 --- /dev/null +++ b/lucene/benchmark/src/java/org/apache/lucene/benchmark/byTask/tasks/FlushIndexTask.java @@ -0,0 +1,37 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.lucene.benchmark.byTask.tasks; + +import org.apache.lucene.benchmark.byTask.PerfRunData; +import org.apache.lucene.index.IndexWriter; + +/** Flush Index Task uses flushNextBuffer() to flush documents at thread level */ +public class FlushIndexTask extends PerfTask { + + public FlushIndexTask(PerfRunData runData) { + super(runData); + } + + @Override + public int doLogic() throws Exception { + IndexWriter iw = getRunData().getIndexWriter(); + if (iw != null) { + iw.flushNextBuffer(); + } + return 1; + } +} From 1a5c86ddc400f58a2f4f8647aa87bc19034c74dc Mon Sep 17 00:00:00 2001 From: balmukundblr Date: Tue, 2 Mar 2021 07:14:14 +0000 Subject: [PATCH 2/2] Removed commented code.Also, changed the num of thread to 8 to work with typical box. --- lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg b/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg index d2aaba4c218a..55bc0b08bdd3 100644 --- a/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg +++ b/lucene/benchmark/conf/indexing-flush-by-RAM-multithreaded.alg @@ -53,8 +53,7 @@ log.queries=true { "Populate" CreateIndex - #[{ "MAddDocs" AddDoc } : 5000] : 4 - [{ {{"MAddDocs" AddDoc } : 5000} FlushIndex } ] : 20 + [{ {{"MAddDocs" AddDoc } : 5000} FlushIndex } ] : 8 ForceMerge(1) CloseIndex }