1 package org.apache.lucene.benchmark.byTask.programmatic;
4 * Copyright 2005 The Apache Software Foundation
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
19 import java.io.IOException;
20 import java.util.Properties;
22 import org.apache.lucene.benchmark.byTask.PerfRunData;
23 import org.apache.lucene.benchmark.byTask.tasks.AddDocTask;
24 import org.apache.lucene.benchmark.byTask.tasks.CloseIndexTask;
25 import org.apache.lucene.benchmark.byTask.tasks.CreateIndexTask;
26 import org.apache.lucene.benchmark.byTask.tasks.RepSumByNameTask;
27 import org.apache.lucene.benchmark.byTask.tasks.TaskSequence;
28 import org.apache.lucene.benchmark.byTask.utils.Config;
31 * Sample performance test written programmatically - no algorithm file is needed here.
40 public static void main(String[] args) throws Exception {
41 Properties p = initProps();
42 Config conf = new Config(p);
43 PerfRunData runData = new PerfRunData(conf);
46 TaskSequence top = new TaskSequence(runData,null,null,false); // top level, not parallel
48 // 2. task to create the index
49 CreateIndexTask create = new CreateIndexTask(runData);
52 // 3. task seq to add 500 docs (order matters - top to bottom - add seq to top, only then add to seq)
53 TaskSequence seq1 = new TaskSequence(runData,"AddDocs",top,false);
54 seq1.setRepetitions(500);
55 seq1.setNoChildReport();
58 // 4. task to add the doc
59 AddDocTask addDoc = new AddDocTask(runData);
60 //addDoc.setParams("1200"); // doc size limit if supported
61 seq1.addTask(addDoc); // order matters 9see comment above)
63 // 5. task to close the index
64 CloseIndexTask close = new CloseIndexTask(runData);
68 RepSumByNameTask rep = new RepSumByNameTask(runData);
72 System.out.println(top.toString());
79 // Sample programmatic settings. Could also read from file.
80 private static Properties initProps() {
81 Properties p = new Properties();
82 p.setProperty ( "task.max.depth.log" , "3" );
83 p.setProperty ( "max.buffered" , "buf:10:10:100:100:10:10:100:100" );
84 p.setProperty ( "doc.maker" , "org.apache.lucene.benchmark.byTask.feeds.ReutersContentSource" );
85 p.setProperty ( "log.step" , "2000" );
86 p.setProperty ( "doc.delete.step" , "8" );
87 p.setProperty ( "analyzer" , "org.apache.lucene.analysis.standard.StandardAnalyzer" );
88 p.setProperty ( "doc.term.vector" , "false" );
89 p.setProperty ( "directory" , "FSDirectory" );
90 p.setProperty ( "query.maker" , "org.apache.lucene.benchmark.byTask.feeds.ReutersQueryMaker" );
91 p.setProperty ( "doc.stored" , "true" );
92 p.setProperty ( "docs.dir" , "reuters-out" );
93 p.setProperty ( "compound" , "cmpnd:true:true:true:true:false:false:false:false" );
94 p.setProperty ( "doc.tokenized" , "true" );
95 p.setProperty ( "merge.factor" , "mrg:10:100:10:100:10:100:10:100" );