⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 package-summary.html

📁  Lucene是apache软件基金会[4] jakarta项目组的一个子项目
💻 HTML
📖 第 1 页 / 共 2 页
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_04) on Wed Feb 14 11:49:15 EST 2007 -->
<TITLE>
org.apache.lucene.benchmark.byTask (Lucene 2.1.0 API)
</TITLE>

<META NAME="keywords" CONTENT="org.apache.lucene.benchmark.byTask package">

<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../../stylesheet.css" TITLE="Style">

<SCRIPT type="text/javascript">
function windowTitle()
{
    parent.document.title="org.apache.lucene.benchmark.byTask (Lucene 2.1.0 API)";
}
</SCRIPT>

</HEAD>

<BODY BGCOLOR="white" onload="windowTitle();">

<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A><A HREF="#skip-navbar_top" title="Skip navigation links"></A><TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A><TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
  <TR ALIGN="center" VALIGN="top">
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Package</B></FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <FONT CLASS="NavBarFont1">Class</FONT>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-use.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
  <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1">    <A HREF="../../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
  </TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>

<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
&nbsp;<A HREF="../../../../../org/apache/lucene/benchmark/package-summary.html"><B>PREV PACKAGE</B></A>&nbsp;
&nbsp;<A HREF="../../../../../org/apache/lucene/benchmark/byTask/feeds/package-summary.html"><B>NEXT PACKAGE</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
  <A HREF="../../../../../index.html" target="_top"><B>FRAMES</B></A>  &nbsp;
&nbsp;<A HREF="package-summary.html" target="_top"><B>NO FRAMES</B></A>  &nbsp;
&nbsp;<SCRIPT type="text/javascript">
  <!--
  if(window==top) {
    document.writeln('<A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>');
  }
  //-->
</SCRIPT>
<NOSCRIPT>
  <A HREF="../../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A><!-- ========= END OF TOP NAVBAR ========= -->

<HR>
<H2>
Package org.apache.lucene.benchmark.byTask
</H2>
<DIV>
Benchmarking Lucene By Tasks.
<P>
<B>See:</B>
<BR>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF="#package_description"><B>Description</B></A>
<P>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Class Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../org/apache/lucene/benchmark/byTask/Benchmark.html" title="class in org.apache.lucene.benchmark.byTask">Benchmark</A></B></TD>
<TD>Run the benchmark algorithm.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD WIDTH="15%"><B><A HREF="../../../../../org/apache/lucene/benchmark/byTask/PerfRunData.html" title="class in org.apache.lucene.benchmark.byTask">PerfRunData</A></B></TD>
<TD>Data maintained by a performance test run.</TD>
</TR>
</TABLE>
&nbsp;

<P>
<A NAME="package_description"><!-- --></A><H2>
Package org.apache.lucene.benchmark.byTask Description
</H2>

<P>
<DIV>
Benchmarking Lucene By Tasks.
<p>
This package provides "task based" performance benchmarking of Lucene.
One can use the predefined benchmarks, or create new ones.
</p>
<p>
Contained packages:
</p>

<table border=1 cellpadding=4>
 <tr>
   <td><b>Package</b></td>
   <td><b>Description</b></td>
 </tr>
 <tr>
   <td><a href="stats/package-summary.html">stats</a></td>
   <td>Statistics maintained when running benchmark tasks.</td>
 </tr>
 <tr>
   <td><a href="tasks/package-summary.html">tasks</a></td>
   <td>Benchmark tasks.</td>
 </tr>
 <tr>
   <td><a href="feeds/package-summary.html">feeds</a></td>
   <td>Sources for benchmark inputs: documents and queries.</td>
 </tr>
 <tr>
   <td><a href="utils/package-summary.html">utils</a></td>
   <td>Utilities used for the benchmark, and for the reports.</td>
 </tr>
 <tr>
   <td><a href="programmatic/package-summary.html">programmatic</a></td>
   <td>Sample performance test written programatically.</td>
 </tr>
</table>

<h2>Table Of Contents</h2>
<p>
    <ol>
        <li><a href="#concept">Benchmarking By Tasks</a></li>
        <li><a href="#usage">How to use</a></li>
        <li><a href="#algorithm">Benchmark "algorithm"</a></li>
        <li><a href="#tasks">Supported tasks/commands</a></li>
        <li><a href="#properties">Benchmark properties</a></li>
        <li><a href="#example">Example input algorithm and the result benchmark report.</a></li>
    </ol>
</p>
<a name="concept"></a>
<h2>Benchmarking By Tasks</h2>
<p>
Benchmark Lucene using task primitives.
</p>

<p>
A benchmark is composed of some predefined tasks, allowing for creating an index, adding documents,
optimizing, searching, generating reports, and more. A benchmark run takes an "algorithm" file
that contains a description of the sequence of tasks making up the run, and some properties defining a few
additional characteristics of the benchmark run.
</p>

<a name="usage"></a>
<h2>How to use</h2>
<p>
Easiest way to run a benchmarks is using the predefined ant task:
<ul>
 <li>ant run-task
     <br>- would run the <code>micro-standard.alg</code> "algorithm".
 </li>
 <li>ant run-task -Dtask.alg=conf/compound-penalty.alg
     <br>- would run the <code>compound-penalty.alg</code> "algorithm".
 </li>
 <li>ant run-task -Dtask.alg=[full-path-to-your-alg-file]
     <br>- would run <code>your perf test</code> "algorithm".
 </li>
 <li>java org.apache.lucene.benchmark.byTask.programmatic.Sample
     <br>- would run a performance test programmatically - without using an alg file.
     This is less readable, and less convinient, but possible.
 </li>
</ul>
</p>

<p>
You may find existing tasks sufficient for defining the benchmark <i>you</i> need,
otherwise, you can extend the framework to meet your needs, as explained herein.
</p>

<p>
Each benchmark run has a DocMaker and a QueryMaker. These two should usually match, so
that "meaningful" queries are used for a certain collection.
Properties set at the header of the alg file define which "makers" should be used.
You can also specify your own makers, implementing the DocMaker and QureyMaker interfaces.
</p>

<p>
Benchmark .alg file contains the benchmark "algorithm". The syntax is described below.
Within the algorithm, you can specify groups of commands, assign them names,
specify commands that should be repeated,
do commands in serial or in parallel,
and also control the speed of "firing" the commands.
</p>

<p>
This allows, for instance, to specify
that an index should be opened for update,
documents should be added to it one by one but not faster than 20 docs a minute,
and, in parallel with this,
some N queries should be searched against that index,
again, no more than 2 queries a second.
You can have the searches all share an index searcher,
or have them each open its own searcher and close it afterwords.
</p>

<p>
If the commands available for use in the algorithm do not meet your needs,
you can add commands by adding a new task under
org.apache.lucene.benchmark.byTask.tasks -
you should extend the PerfTask abstract class.
Make sure that your new task class name is suffixed by Task.
Assume you added the class "WonderfulTask" - doing so also enables the
command "Wonderful" to be used in the algorithm.
</p>

<a name="algorithm"></a>
<h2>Benchmark "algorithm"</h2>

<p>
The following is an informal description of the supported syntax.
</p>

<ol>
 <li>
 <b>Measuring</b>: When a command is executed, statistics for the elapsed execution time and memory consumption are collected.
 At any time, those statistics can be printed, using one of the available ReportTasks.
 </li>
 <li>
 <b>Comments</b> start with '<font color="#FF0066">#</font>'.
 </li>
 <li>
 <b>Serial</b> sequences are enclosed within '<font color="#FF0066">{ }</font>'.
 </li>
 <li>
 <b>Parallel</b> sequences are enclosed within '<font color="#FF0066">[ ]</font>'
 </li>
 <li>
 <b>Sequence naming:</b> To name a sequence, put '<font color="#FF0066">"name"</font>' just after '<font color="#FF0066">{</font>' or '<font color="#FF0066">[</font>'.
 <br>Example - <font color="#FF0066">{ "ManyAdds" AddDoc } : 1000000</font> - would
 name the sequence of 1M add docs "ManyAdds", and this name would later appear in statistic reports.
 If you don't specify a name for a sequence, it is given one: you can see it as the
 algorithm is printed just before benchmark execution starts.
 </li>
 <li>
 <b>Repeating</b>:
 To repeat sequence tasks N times, add '<font color="#FF0066">: N</font>' just after the
 sequence closing tag - '<font color="#FF0066">}</font>' or '<font color="#FF0066">]</font>' or '<font color="#FF0066">></font>'.
 <br>Example -  <font color="#FF0066">[ AddDoc ] : 4</font>  - would do 4 addDoc in parallel, spawning 4 threads at once.
 <br>Example -  <font color="#FF0066">[ AddDoc AddDoc ] : 4</font>  - would do 8 addDoc in parallel, spawning 8 threads at once.
 <br>Example -  <font color="#FF0066">{ AddDoc } : 30</font> - would do addDoc 30 times in a row.
 <br>Example -  <font color="#FF0066">{ AddDoc AddDoc } : 30</font> - would do addDoc 60 times in a row.
 </li>
 <li>
 <b>Command parameter</b>: a command can take a single parameter.
 If the certain command does not support a parameter, or if the parameter is of the wrong type,
 reading the algorithm will fail with an exception and the test would not start.
 Currently only AddDoc supports a (numeric) parameter, which indicates the required size of added document.
 If the DocMaker implementation used in the test does not support makeDoc(size), an exception would be thrown and the test would fail.
 <br>Example - <font color="#FF0066">AddDoc(2000)</font> - would add a document of size 2000 (~bytes).
 <br>See conf/task-sample.alg for how this can be used, for instance, to check which is faster, adding
 many smaller documents, or few larger documents.
 Next candidates for supporting a parameter may be the Search tasks, for controlling the qurey size.
 </li>
 <li>
 <b>Statistic recording elimination</b>: - a sequence can also end with '<font color="#FF0066">></font>',
 in which case child tasks would not store their statistics.
 This can be useful to avoid exploding stats data, for adding say 1M docs.
 <br>Example - <font color="#FF0066">{ "ManyAdds" AddDoc > : 1000000</font> -
 would add million docs, measure that total, but not save stats for each addDoc.
 <br>Notice that the granularity of System.currentTimeMillis() (which is used here) is system dependant,
 and in some systems an operation that takes 5 ms to complete may show 0 ms latency time in performance measurements.
 Therefore it is sometimes more accurate to look at the elapsed time of a larger sequence, as demonstrated here.
 </li>
 <li>
 <b>Rate</b>:
 To set a rate (ops/sec or ops/min) for a sequence, add '<font color="#FF0066">: N : R</font>' just after sequence closing tag.
 This would specify repetition of N with rate of R operations/sec.
 Use '<font color="#FF0066">R/sec</font>' or '<font color="#FF0066">R/min</font>'
 to explicitely specify that the rate is per second or per minute.
 The default is per second,
 <br>Example -  <font color="#FF0066">[ AddDoc ] : 400 : 3</font> - would do 400 addDoc in parallel, starting up to 3 threads per second.
 <br>Example -  <font color="#FF0066">{ AddDoc } : 100 : 200/min</font> - would do 100 addDoc serially,
 waiting before starting next add, if otherwise rate would exceed 200 adds/min.
 </li>
 <li>
 <b>Command names</b>: Each class "AnyNameTask" in the package org.apache.lucene.benchmark.byTask.tasks,
 that extends PerfTask, is supported as command "AnyName" that can be
 used in the benchmark "algorithm" description.
 This allows to add new commands by just adding such classes.
 </li>
</ol>


<a name="tasks"></a>
<h2>Supported tasks/commands</h2>

<p>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -