123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600 |
- <html><head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>DHCP Performance Guide</title><link rel="stylesheet" type="text/css" href="bind10-guide.css"><meta name="generator" content="DocBook XSL Stylesheets V1.76.1"><meta name="description" content="BIND 10 is a framework that features Domain Name System (DNS) suite and Dynamic Host Configuration Protocol (DHCP) servers with development managed by Internet Systems Consortium (ISC). This document describes various aspects of DHCP performance, measurements and tuning. It covers BIND 10 DHCP (codename Kea), existing ISC DHCP4 software, perfdhcp (a DHCP performance measurement tool) and other related topics."></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="book" title="DHCP Performance Guide"><div class="titlepage"><div><div><h1 class="title"><a name="d0e3"></a>DHCP Performance Guide</h1></div><div><div class="author"><h3 class="author"><span class="firstname">Tomasz</span> <span class="surname">Mrugalski</span></h3></div></div><div><div class="author"><h3 class="author"><span class="firstname">Marcin</span> <span class="surname">Siodelski</span></h3></div></div><div><p class="releaseinfo">This is a companion document for BIND 10 version
- 20120712.</p></div><div><p class="copyright">Copyright © 2012 Internet Systems Consortium, Inc. ("ISC")</p></div><div><div class="abstract" title="Abstract"><p class="title"><b>Abstract</b></p><p>BIND 10 is a framework that features Domain Name System
- (DNS) suite and Dynamic Host Configuration Protocol (DHCP)
- servers with development managed by Internet Systems Consortium (ISC).
- This document describes various aspects of DHCP performance,
- measurements and tuning. It covers BIND 10 DHCP (codename Kea),
- existing ISC DHCP4 software, perfdhcp (a DHCP performance
- measurement tool) and other related topics.</p></div></div></div><hr></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="preface"><a href="#d0e28">Preface</a></span></dt><dd><dl><dt><span class="section"><a href="#acknowledgements">Acknowledgements</a></span></dt></dl></dd><dt><span class="chapter"><a href="#intro">1. Introduction</a></span></dt><dt><span class="chapter"><a href="#dhcp4">2. ISC DHCP 4.x</a></span></dt><dt><span class="chapter"><a href="#kea">3. Kea</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e54">Backend performance evaluation</a></span></dt><dt><span class="section"><a href="#mysql-backend">MySQL backend</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e156">MySQL tweaks</a></span></dt></dl></dd><dt><span class="section"><a href="#sqlite-ubench">SQLite-ubench</a></span></dt><dd><dl><dt><span class="section"><a href="#sqlite-tweaks">SQLite tweaks</a></span></dt></dl></dd><dt><span class="section"><a href="#memfile-ubench">memfile-ubench</a></span></dt><dd><dl><dt><span class="section"><a href="#memfile-tweaks">memfile tweaks</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e245">Performance measurements</a></span></dt><dt><span class="section"><a href="#d0e521">Possible further optimizations</a></span></dt></dl></dd><dt><span class="chapter"><a href="#perfdhcp">4. perfdhcp</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e533">Purpose</a></span></dt><dt><span class="section"><a href="#perfdhcp-key-features">Key features</a></span></dt><dt><span class="section"><a href="#perfdhcp-command-line">Command line options</a></span></dt><dt><span class="section"><a href="#starting-perfdhcp">Starting perfdhcp</a></span></dt><dt><span class="section"><a href="#perfdhcp-commandline-examples">perfdhcp command line examples</a></span></dt><dd><dl><dt><span class="section"><a href="#perfdhcp-basic-usage">Example: basic usage</a></span></dt><dt><span class="section"><a href="#perfdhcp-rate-control">Example: rate control</a></span></dt><dt><span class="section"><a href="#perfdhcp-templates">Example: templates</a></span></dt></dl></dd></dl></dd></dl></div><div class="list-of-tables"><p><b>List of Tables</b></p><dl><dt>3.1. <a href="#d0e256">Synchronous results</a></dt><dt>3.2. <a href="#d0e332">Asynchronous results</a></dt><dt>3.3. <a href="#tbl-perf-results">Estimated performance</a></dt></dl></div><div class="preface" title="Preface"><div class="titlepage"><div><div><h2 class="title"><a name="d0e28"></a>Preface</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#acknowledgements">Acknowledgements</a></span></dt></dl></div><div class="section" title="Acknowledgements"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="acknowledgements"></a>Acknowledgements</h2></div></div></div><p>ISC would like to acknowledge generous support for
- BIND 10 development of DHCPv4 and DHCPv6 components provided
- by <a class="ulink" href="http://www.comcast.com/" target="_top">Comcast</a>.</p></div></div><div class="chapter" title="Chapter 1. Introduction"><div class="titlepage"><div><div><h2 class="title"><a name="intro"></a>Chapter 1. Introduction</h2></div></div></div><p>
- This document is in its early stages of development. It is
- expected to grow significantly in a near future. It will
- cover topics like database backend perfomance measurements,
- pros an cons of various optimization techniques and
- tools.
- </p></div><div class="chapter" title="Chapter 2. ISC DHCP 4.x"><div class="titlepage"><div><div><h2 class="title"><a name="dhcp4"></a>Chapter 2. ISC DHCP 4.x</h2></div></div></div><p>
- TODO: Write something about ISC DHCP4 here.
- </p></div><div class="chapter" title="Chapter 3. Kea"><div class="titlepage"><div><div><h2 class="title"><a name="kea"></a>Chapter 3. Kea</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#d0e54">Backend performance evaluation</a></span></dt><dt><span class="section"><a href="#mysql-backend">MySQL backend</a></span></dt><dd><dl><dt><span class="section"><a href="#d0e156">MySQL tweaks</a></span></dt></dl></dd><dt><span class="section"><a href="#sqlite-ubench">SQLite-ubench</a></span></dt><dd><dl><dt><span class="section"><a href="#sqlite-tweaks">SQLite tweaks</a></span></dt></dl></dd><dt><span class="section"><a href="#memfile-ubench">memfile-ubench</a></span></dt><dd><dl><dt><span class="section"><a href="#memfile-tweaks">memfile tweaks</a></span></dt></dl></dd><dt><span class="section"><a href="#d0e245">Performance measurements</a></span></dt><dt><span class="section"><a href="#d0e521">Possible further optimizations</a></span></dt></dl></div><p>
- </p><div class="section" title="Backend performance evaluation"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e54"></a>Backend performance evaluation</h2></div></div></div><p>
- Kea will support several different database backends, using
- both popular databases (like MySQL or SQLite) and
- custom-developed solutions (like in-memory database). BIND 10
- source code features set of performance microbenchmarks.
- These are small tools written in C/C++ that simulate expected
- DHCP server behaviour and evaluate the performance of
- considered databases. As implemented benchmarks are not really
- simulating DHCP operation, but rather use set of primitives
- that can be used by a real server, they are called
- micro-benchmarks.
- </p><p>Although there are many operations and data types that
- server could store in a database, the most frequently used data
- type is lease information. Although lease information for IPv4
- and IPv6 differs slightly, it is expected that the performance
- differences will be minimal between IPv4 and IPv6 lease operations.
- Therefore each test uses lease4 table for performance measurements.
- </p><p>All benchmarks are implemented as single threaded applications
- that take advantage of a single database connection.</p><p>
- Those benchmarks are stored in tests/tools/dhcp-ubench
- directory. This directory contains simplified prototypes for
- various DB back-ends that are planned or considered as a
- backend engine for BIND10 DHCP. Athough trivial now, they are
- expected to evolve into useful tools that will allow users to
- measure performance in their specific environment.
- </p><p>
- Currently the following benchmarks are implemented:
- </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>in memory+flat file</p></li><li class="listitem"><p>SQLite</p></li><li class="listitem"><p>MySQL</p></li></ul></div><p>
- </p><p>
- As they require additional (sometimes heavy) dependencies, they are not
- built by default. Actually, their build system is completely separated.
- It will be eventually merged with the main BIND10 makefile system, but
- that is a low priority for now.
- </p><p>
- All benchmarks will follow the same pattern:
- </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>prepare operation (connect to a database, create a file etc.)</p></li><li class="listitem"><p>Measure timestamp 0</p></li><li class="listitem"><p>Commit new lease4 (repeated X times)</p></li><li class="listitem"><p>Measure timestamp 1</p></li><li class="listitem"><p>Search for random lease4 (repeated X times)</p></li><li class="listitem"><p>Measure timestamp 2</p></li><li class="listitem"><p>Update existing lease4 (repeated X times)</p></li><li class="listitem"><p>Measure timestamp 3</p></li><li class="listitem"><p>Delete existing lease4 (repeated X times)</p></li><li class="listitem"><p>Measure timestamp 4</p></li><li class="listitem"><p>Print out statistics, based on X and measured timestamps.</p></li></ol></div><p>
- Although this approach does not attempt to simulate actual DHCP server
- operation that has mix of all steps intervening, it answers the
- questions about basic database strenghts and weak points. In particular
- it can show what is the impact of specific DB optimizations, like
- changing engine, optimizing for writes/reads etc.
- </p><p>
- The framework attempts to do the same amount of operations for every
- backend thus allowing fair complarison between them.
- </p></div><div class="section" title="MySQL backend"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="mysql-backend"></a>MySQL backend</h2></div></div></div><p>MySQL backend requires MySQL client development libraries. It uses
- mysql_config tool (that works similar to pkg-config) to discover required
- compilation and linking options. To install required packages on Ubuntu,
- use the following command:
- </p><pre class="screen">$ <strong class="userinput"><code>sudo apt-get install mysql-client mysql-server libmysqlclient-dev</code></strong></pre><p>
- Make sure that MySQL server is running. Make sure that you have your setup
- configured so there is a user that is able to modify used database.</p><p>Before running tests, you need to initialize your database. You can
- use mysql.schema script for that purpose. WARNING: It will drop existing
- Kea database. Do not run this on your production server. Assuming your
- MySQL user is kea, you can initialize your test database by:
- </p><pre class="screen">$ <strong class="userinput"><code>mysql -u kea -p < mysql.schema</code></strong></pre><p>
- </p><p>After database is initialized, you are ready to run the test:
- </p><pre class="screen">$ <strong class="userinput"><code>./mysql_ubench</code></strong></pre><p>
- or
- </p><pre class="screen">$ <strong class="userinput"><code>./mysql_ubench > results->mysql.txt</code></strong></pre><p>
- Redirecting output to a file is important, because for each operation
- there is a single character printed to show progress. If you have a slow
- terminal, this may considerably affect test perfromance. On the other hand,
- printing something after each operation is required, as poor DB setting
- may slow down operations to around 20 per second. Observant user is expected
- to note that initial dots are printed too slowly and abort the test.</p><p>Currently all default parameters are hardcoded. Default values can be
- overwritten using command line switches. Although all benchmarks take
- the same list of parameters, some of them are specific to a given backend
- type. To get a list of supported parameters, run your benchmark with -h option:
- </p><pre class="screen">$ <strong class="userinput"><code>./mysql_ubench -h</code></strong>
- This is a benchmark designed to measure expected performance
- of several backends. This particular version identifies itself
- as following:
- MySQL client version is 5.5.24
- Possible command-line parameters:
- -h - help (you are reading this)
- -m hostname - specifies MySQL server to connect (MySQL backend only)
- -u username - specifies MySQL user name (MySQL backend only)
- -p password - specifies MySQL passwod (MySQL backend only)
- -f name - database or filename (MySQL, SQLite and memfile)
- -n integer - number of test repetitions (MySQL, SQLite and memfile)
- -s yes|no - synchronous/asynchronous operation (MySQL, SQLite and memfile)
- -v yes|no - verbose mode (MySQL, SQLite and memfile)
- -c yes|no - should compiled statements be used (MySQL only)
- </pre><p>
- </p><div class="section" title="MySQL tweaks"><div class="titlepage"><div><div><h3 class="title"><a name="d0e156"></a>MySQL tweaks</h3></div></div></div><p>One parameter that has huge impact on performance is a a backend engine.
- You can get a list of engines of your MySQL implementation by using
- </p><pre class="screen">> <strong class="userinput"><code>show engines;</code></strong></pre><p>
- in your mysql client. Two notable engines are MyISAM and InnoDB. mysql_ubench will
- use MyISAM for synchronous mode and InnoDB for asynchronous.</p></div></div><div class="section" title="SQLite-ubench"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="sqlite-ubench"></a>SQLite-ubench</h2></div></div></div><p>SQLite backend requires both sqlite3 development and run-time package. Their
- names may vary from system to system, but on Ubuntu 12.04 they are called
- sqlite3 libsqlite3-dev. To install them, use the following command:
- </p><pre class="screen">> <strong class="userinput"><code>sudo apt-get install sqlite3 libsqlite3-dev</code></strong></pre><p>
- Before running the test the database has to be created. Use the following command for that:
- </p><pre class="screen">> <strong class="userinput"><code>cat sqlite.schema | sqlite3 sqlite.db</code></strong></pre><p>
- A new database called sqlite.db will be created. That is the default name used
- by sqlite_ubench test. If you prefer other name, make sure you update
- sqlite_ubench.cc accordingly.</p><p>Once the database is created, you can run tests:
- </p><pre class="screen">> <strong class="userinput"><code>./sqlite_ubench</code></strong></pre><p>
- or
- </p><pre class="screen">> <strong class="userinput"><code>./sqlite_ubench > results-sqlite.txt</code></strong></pre><p>
- </p><div class="section" title="SQLite tweaks"><div class="titlepage"><div><div><h3 class="title"><a name="sqlite-tweaks"></a>SQLite tweaks</h3></div></div></div><p>To modify default sqlite_ubench parameters, command line
- switches can be used. Currently supported parameters are
- (default values specified in brackets):
- </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>-f filename - name of the database file ("sqlite.db")</p></li><li class="listitem"><p>-n num - number of iterations (100)</p></li><li class="listitem"><p>-s yes|no - should the operations be performend in synchronous (yes)
- or asynchronous (no) manner (yes)</p></li><li class="listitem"><p>-v yes|no - verbose mode. Should the test print out progress? (yes)</p></li><li class="listitem"><p>-c yes|no - compiled statements. Should the SQL statements be precompiled?</p></li></ol></div><p>
- </p><p>SQLite can run in asynchronous or synchronous mode. This
- mode can be controlled by using sync parameter. It is set
- using (PRAGMA synchronous = ON or OFF).</p><p>Another tweakable feature is journal mode. It can be
- turned to several modes of operation. Its value can be
- modified in SQLite_uBenchmark::connect(). See
- http://www.sqlite.org/pragma.html#pragma_journal_mode for
- detailed explanantion.</p></div></div><div class="section" title="memfile-ubench"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="memfile-ubench"></a>memfile-ubench</h2></div></div></div><p>Memfile backend is custom developed prototype backend that
- somewhat mimics operation of ISC DHCP4. It uses in-memory
- storage using standard C++ and boost mechanisms (std::map and
- boost::shared_ptr<>). All database changes are also
- written to a lease file. That file is strictly write-only. This
- approach takes advantage of the fact that simple append is faster
- than edition with potential whole file relocation.</p><div class="section" title="memfile tweaks"><div class="titlepage"><div><div><h3 class="title"><a name="memfile-tweaks"></a>memfile tweaks</h3></div></div></div><p>To modify default memfile_ubench parameters, command line
- switches can be used. Currently supported parameters are
- (default values specified in brackets):
- </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>-f filename - name of the database file ("dhcpd.leases")</p></li><li class="listitem"><p>-n num - number of iterations (100)</p></li><li class="listitem"><p>-s yes|no - should the operations be performend in synchronous (yes)
- or asynchronous (no) manner (yes)</p></li><li class="listitem"><p>-v yes|no - verbose mode. Should the test print out progress? (yes)</p></li></ol></div><p>
- </p><p>memfile can run in asynchronous or synchronous mode. This
- mode can be controlled by using sync parameter. It uses
- fflush() and fsync() in synchronous mode to make sure that
- data is not buffered and physically stored on disk.</p></div></div><div class="section" title="Performance measurements"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e245"></a>Performance measurements</h2></div></div></div><p>This section contains sample results for backend performance measurements,
- taken using microbenchmarks. Tests were conducted on reasonably powerful machine:
- </p><pre class="screen">
- CPU: Quad-core Intel(R) Core(TM) i7-2600K CPU @ 3.40GHz (8 logical cores)
- HDD: 1,5TB Seagate Barracuda ST31500341AS 7200rpm (used only one of them), ext4 partition
- OS: Ubuntu 12.04, running kernel 3.2.0-26-generic SMP x86_64
- compiler: g++ (Ubuntu/Linaro 4.6.3-1ubuntu5) 4.6.3
- MySQL version: 5.5.24
- SQLite version: 3.7.9sourceid version is 2011-11-01 00:52:41 c7c6050ef060877ebe77b41d959e9df13f8c9b5e</pre><p>
- </p><p>Benchmarks were run in two series: synchronous and
- asynchronous. As those modes offer radically different
- performances, synchronous mode was conducted for 1000 (one
- thousand) repetitions and asynchronous mode was conducted for
- 100000 (hundred thousand) repetitions.</p><div class="table"><a name="d0e256"></a><p class="title"><b>Table 3.1. Synchronous results</b></p><div class="table-contents"><table summary="Synchronous results" border="1"><colgroup><col align="center" class="Backend"><col align="center" class="Num"><col align="center" class="Create"><col align="center" class="Search"><col align="center" class="Update"><col align="center" class="Delete"></colgroup><thead><tr><th align="center">Backend</th><th align="center">Operations</th><th align="center">Create</th><th align="center">Search</th><th align="center">Update</th><th align="center">Delete</th><th align="center">Average</th></tr></thead><tbody><tr><td align="center">MySQL</td><td align="center">1000</td><td align="center">31.603978s</td><td align="center"> 0.116612s</td><td align="center">27.964191s</td><td align="center">27.695209s</td><td align="center">21.844998s</td></tr><tr><td align="center">SQLite</td><td align="center">1000</td><td align="center">61.421356s</td><td align="center"> 0.033283s</td><td align="center">59.476638s</td><td align="center">56.034150s</td><td align="center">44.241357s</td></tr><tr><td align="center">memfile</td><td align="center">1000</td><td align="center">41.711886s</td><td align="center"> 0.000724s</td><td align="center">42.267578s</td><td align="center">42.169679s</td><td align="center">31.537467s</td></tr></tbody></table></div></div><br class="table-break"><p>Following parameters were measured for asynchronous mode.
- MySQL and SQLite were run with 100 thousand repetitions. Memfile
- was run for 1 million repetitions due to much larger performance.</p><div class="table"><a name="d0e332"></a><p class="title"><b>Table 3.2. Asynchronous results</b></p><div class="table-contents"><table summary="Asynchronous results" border="1"><colgroup><col align="center" class="Backend"><col align="center" class="Num"><col align="center" class="Create"><col align="center" class="Search"><col align="center" class="Update"><col align="center" class="Delete"></colgroup><thead><tr><th align="center">Backend</th><th align="center">Operations</th><th align="center">Create [s]</th><th align="center">Search [s]</th><th align="center">Update [s]</th><th align="center">Delete [s]</th><th align="center">Average [s]</th></tr></thead><tbody><tr><td align="center">MySQL</td><td align="center">100000</td><td align="center">10.584842s</td><td align="center">10.386402s</td><td align="center">10.062384s</td><td align="center"> 8.890197s</td><td align="center"> 9.980956s</td></tr><tr><td align="center">SQLite</td><td align="center">100000</td><td align="center"> 3.710356s</td><td align="center"> 3.159129s</td><td align="center"> 2.865354s</td><td align="center"> 2.439406s</td><td align="center"> 3.043561s</td></tr><tr><td align="center">memfile</td><td align="center">1000000 (sic!)</td><td align="center"> 6.084131s</td><td align="center"> 0.862667s</td><td align="center"> 6.018585s</td><td align="center"> 5.146704s</td><td align="center"> 4.528022s</td></tr></tbody></table></div></div><br class="table-break"><p>Presented performance results can be computed into operations per second metrics.
- It should be noted that due to large differences between various operations (sometime
- over 3 orders of magnitude), it is difficult to create a simple, readable chart with
- that data.</p><div class="table"><a name="tbl-perf-results"></a><p class="title"><b>Table 3.3. Estimated performance</b></p><div class="table-contents"><table summary="Estimated performance" border="1"><colgroup><col align="center" class="Backend"><col align="center" class="Create"><col align="center" class="Search"><col align="center" class="Update"><col align="center" class="Delete"><col align="center" class="Average"></colgroup><thead><tr><th align="center">Backend</th><th align="center">Create [oper/s]</th><th align="center">Search [oper/s]</th><th align="center">Update [oper/s]</th><th align="center">Delete [oper/s]</th><th align="center">Average [oper/s]</th></tr></thead><tbody><tr><td align="center">MySQL (async)</td><td align="center">9447.47</td><td align="center">9627.97</td><td align="center">9938.00</td><td align="center">11248.34</td><td align="center">10065.45</td></tr><tr><td align="center">SQLite (async)</td><td align="center">26951.59</td><td align="center">31654.29</td><td align="center">34899.70</td><td align="center">40993.59</td><td align="center">33624.79</td></tr><tr><td align="center">memfile (async)</td><td align="center">164362.01</td><td align="center">1159195.84</td><td align="center">166152.01</td><td align="center">194299.11</td><td align="center">421002.24</td></tr><tr><td align="center">MySQL (sync)</td><td align="center">31.64</td><td align="center">8575.45</td><td align="center">35.76</td><td align="center">36.11</td><td align="center">2169.74</td></tr><tr><td align="center">SQLite (sync)</td><td align="center">16.28</td><td align="center">20045.37</td><td align="center">16.81</td><td align="center">17.85</td><td align="center">7524.08</td></tr><tr><td align="center">memfile (sync)</td><td align="center">23.97</td><td align="center">1381215.47</td><td align="center">23.66</td><td align="center">23.71</td><td align="center">345321.70</td></tr></tbody></table></div></div><br class="table-break"><div class="mediaobject"><img src="performance-results-graph1.png" alt="Performance measurements"><div class="caption"><p>Graphical representation of the performance results
- presented in table <a class="xref" href="#tbl-perf-results" title="Table 3.3. Estimated performance">Table 3.3, “Estimated performance”</a>.</p></div></div></div><div class="section" title="Possible further optimizations"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e521"></a>Possible further optimizations</h2></div></div></div><p>
- For debugging purposes the code was compiled with -g -O0
- flags. While majority of the time was spent in backend
- functions (that was probably compiled with -O2 flags), the
- benchmark code could perform faster, when compiled with -O2,
- rather than -O0. That is expected to affect memfile benchmark.
- </p><p>
- Currently all operations were conducted on one by one
- basis. Each operation was treated as a separate
- transaction. Grouping X operations together will potentially
- bring almost X fold increase in synchronous operations.
- Extension for this benchmark in this regard should be considered.
- That affects only write operations (insert, update and delete). Read
- operations (search) are expected to be barely affected.
- </p><p>
- Multi-threaded or multi-process benchmark may be considered in
- the future. It may be somewhat difficult as only some backends
- support concurrent access.
- </p></div></div><div class="chapter" title="Chapter 4. perfdhcp"><div class="titlepage"><div><div><h2 class="title"><a name="perfdhcp"></a>Chapter 4. perfdhcp</h2></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><span class="section"><a href="#d0e533">Purpose</a></span></dt><dt><span class="section"><a href="#perfdhcp-key-features">Key features</a></span></dt><dt><span class="section"><a href="#perfdhcp-command-line">Command line options</a></span></dt><dt><span class="section"><a href="#starting-perfdhcp">Starting perfdhcp</a></span></dt><dt><span class="section"><a href="#perfdhcp-commandline-examples">perfdhcp command line examples</a></span></dt><dd><dl><dt><span class="section"><a href="#perfdhcp-basic-usage">Example: basic usage</a></span></dt><dt><span class="section"><a href="#perfdhcp-rate-control">Example: rate control</a></span></dt><dt><span class="section"><a href="#perfdhcp-templates">Example: templates</a></span></dt></dl></dd></dl></div><div class="section" title="Purpose"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="d0e533"></a>Purpose</h2></div></div></div><p>
- There is a growing need to evaluate performance of DHCP servers in
- different traffic conditions to understand their bottle necks.
- This helps to elimante bugs in existing DHCP software as well
- as make informed decisions regarding new DHCP software designs
- to significantly improve its performance. The perfdhcp tool has
- been created to fill the gap in performance measurement capabilities
- mostly. However, the number of implemented features and parameters
- exposed to the user make this tool useful for functional testing as
- well.
- </p></div><div class="section" title="Key features"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="perfdhcp-key-features"></a>Key features</h2></div></div></div><p>
- The perfdhcp exposes the number of command line parameters to
- control DHCP message exchanges. Currently they fall back to
- the following categories:
- </p><div class="orderedlist"><ol class="orderedlist" type="1"><li class="listitem"><p>
- Rate control - control how many DHCP exchanges
- are initiated within a period of time. Tool can also simulate
- best effort conditions attempting to initiate as many DHCP
- packet exchanges within a unit of time as possible.
- </p></li><li class="listitem"><p>
- Test exit specifiers - control the conditions when test
- completes including number of initiated exchanges, test period or
- maximum number of dropped packets.
- </p></li><li class="listitem"><p>
- Packet templates - specify files containing packet templates that
- are used by perfdhcp to create custom DHCP messages instead of
- default. Tool also allows to specify number of values indicating
- offsets of variable values within a packet that are modified in
- flight by the tool.
- </p></li><li class="listitem"><p>
- Reporting - for each test produce the set of performance data
- including achieved packet exchange rate (server performance).
- There is also a number of diagnostic selectors available that
- enable periodic (intermediate) reporting, packet timestamps
- printing and detailed information about perfdhcp internal
- states (for debugging).
- </p></li><li class="listitem"><p>
- Different mode of operations - specify DHCP version used
- (v4 or v6), 2-way or 4-way exchanges, use Rapid Commit option
- for DHCPv6.
- </p></li><li class="listitem"><p>
- IP layer options - specify local/remote address, local interface
- and local port to be used for communication with DHCP server.
- </p></li></ol></div><p>
- </p></div><div class="section" title="Command line options"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="perfdhcp-command-line"></a>Command line options</h2></div></div></div><p>
- The following command line options may be used with perfdhcp tool.
- This summary also presents its possible exit codes as well as
- error counters printed along when test is complete:
- </p><pre class="screen">$ <strong class="userinput"><code>./perfdhcp -h</code></strong>
- perfdhcp [-hv] [-4|-6] [-r<rate>] [-t<report>] [-R<range>] [-b<base>]
- [-n<num-request>] [-p<test-period>] [-d<drop-time>] [-D<max-drop>]
- [-l<local-addr|interface>] [-P<preload>] [-a<aggressivity>]
- [-L<local-port>] [-s<seed>] [-i] [-B] [-c] [-1]
- [-T<template-file>] [-X<xid-offset>] [-O<random-offset]
- [-E<time-offset>] [-S<srvid-offset>] [-I<ip-offset>]
- [-x<diagnostic-selector>] [-w<wrapped>] [server]
- The [server] argument is the name/address of the DHCP server to
- contact. For DHCPv4 operation, exchanges are initiated by
- transmitting a DHCP DISCOVER to this address.
- For DHCPv6 operation, exchanges are initiated by transmitting a DHCP
- SOLICIT to this address. In the DHCPv6 case, the special name 'all'
- can be used to refer to All_DHCP_Relay_Agents_and_Servers (the
- multicast address FF02::1:2), or the special name 'servers' to refer
- to All_DHCP_Servers (the multicast address FF05::1:3). The [server]
- argument is optional only in the case that -l is used to specify an
- interface, in which case [server] defaults to 'all'.
- The default is to perform a single 4-way exchange, effectively pinging
- the server.
- The -r option is used to set up a performance test, without
- it exchanges are initiated as fast as possible.
- Options:
- -1: Take the server-ID option from the first received message.
- -4: DHCPv4 operation (default). This is incompatible with the -6 option.
- -6: DHCPv6 operation. This is incompatible with the -4 option.
- -a<aggressivity>: When the target sending rate is not yet reached,
- control how many exchanges are initiated before the next pause.
- -b<base>: The base mac, duid, IP, etc, used to simulate different
- clients. This can be specified multiple times, each instance is
- in the <type>=<value> form, for instance:
- (and default) mac=00:0c:01:02:03:04.
- -d<drop-time>: Specify the time after which a request is treated as
- having been lost. The value is given in seconds and may contain a
- fractional component. The default is 1 second.
- -E<time-offset>: Offset of the (DHCPv4) secs field / (DHCPv6)
- elapsed-time option in the (second/request) template.
- The value 0 disables it.
- -h: Print this help.
- -i: Do only the initial part of an exchange: DO or SA, depending on
- whether -6 is given.
- -I<ip-offset>: Offset of the (DHCPv4) IP address in the requested-IP
- option / (DHCPv6) IA_NA option in the (second/request) template.
- -l<local-addr|interface>: For DHCPv4 operation, specify the local
- hostname/address to use when communicating with the server. By
- default, the interface address through which traffic would
- normally be routed to the server is used.
- For DHCPv6 operation, specify the name of the network interface
- via which exchanges are initiated.
- -L<local-port>: Specify the local port to use
- (the value 0 means to use the default).
- -O<random-offset>: Offset of the last octet to randomize in the template.
- -P<preload>: Initiate first <preload> exchanges back to back at startup.
- -r<rate>: Initiate <rate> DORA/SARR (or if -i is given, DO/SA)
- exchanges per second. A periodic report is generated showing the
- number of exchanges which were not completed, as well as the
- average response latency. The program continues until
- interrupted, at which point a final report is generated.
- -R<range>: Specify how many different clients are used. With 1
- (the default), all requests seem to come from the same client.
- -s<seed>: Specify the seed for randomization, making it repeatable.
- -S<srvid-offset>: Offset of the server-ID option in the
- (second/request) template.
- -T<template-file>: The name of a file containing the template to use
- as a stream of hexadecimal digits.
- -v: Report the version number of this program.
- -w<wrapped>: Command to call with start/stop at the beginning/end of
- the program.
- -x<diagnostic-selector>: Include extended diagnostics in the output.
- <diagnostic-selector> is a string of single-keywords specifying
- the operations for which verbose output is desired. The selector
- keyletters are:
- * 'a': print the decoded command line arguments
- * 'e': print the exit reason
- * 'i': print rate processing details
- * 'r': print randomization details
- * 's': print first server-id
- * 't': when finished, print timers of all successful exchanges
- * 'T': when finished, print templates
- -X<xid-offset>: Transaction ID (aka. xid) offset in the template.
- DHCPv4 only options:
- -B: Force broadcast handling.
- DHCPv6 only options:
- -c: Add a rapid commit option (exchanges will be SA).
- The remaining options are used only in conjunction with -r:
- -D<max-drop>: Abort the test if more than <max-drop> requests have
- been dropped. Use -D0 to abort if even a single request has been
- dropped. If <max-drop> includes the suffix '%', it specifies a
- maximum percentage of requests that may be dropped before abort.
- In this case, testing of the threshold begins after 10 requests
- have been expected to be received.
- -n<num-request>: Initiate <num-request> transactions. No report is
- generated until all transactions have been initiated/waited-for,
- after which a report is generated and the program terminates.
- -p<test-period>: Send requests for the given test period, which is
- specified in the same manner as -d. This can be used as an
- alternative to -n, or both options can be given, in which case the
- testing is completed when either limit is reached.
- -t<report>: Delay in seconds between two periodic reports.
- Errors:
- - tooshort: received a too short message
- - orphans: received a message which doesn't match an exchange
- (duplicate, late or not related)
- - locallimit: reached to local system limits when sending a message.
- Exit status:
- The exit status is:
- 0 on complete success.
- 1 for a general error.
- 2 if an error is found in the command line arguments.
- 3 if there are no general failures in operation, but one or more
- exchanges are not successfully completed.
- </pre><p>
- </p></div><div class="section" title="Starting perfdhcp"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="starting-perfdhcp"></a>Starting perfdhcp</h2></div></div></div><p>
- In order to run performance test at least two separate systems
- have to be installed: client and server. The first one has to have
- perfdhcp tool installed, the latter has to have DHCP server
- running (v4 or v6). If only single system is available the client
- and server can be run on virtual machines (running on the same
- phisical system) but in this case performance data may be heavily
- impacted by the performance of VMs.
- </p><p>
- The DHCP operates on low port numbers (67 for DHCPv4 relays and
- 547 for DHCPv6). Running perfdhcp with non-root priviliges will
- usually result in the error message similar to this:
- </p><pre class="screen"><strong class="userinput"><code>$./perfdhcp -4 -l eth3 -r 100 all</code></strong>
- Error running perfdhcp: Failed to bind socket 3 to 172.16.1.2/port=67
- </pre><p>
- perfdhcp has the '-L' command line option that
- imposes use of custom local port. Thus the following command
- line will work:
- </p><pre class="screen"><strong class="userinput"><code>$./perfdhcp -4 -l eth3 -r 100 -L 10067 all</code></strong></pre><p>
- but in the standard configuration no responses will be received
- from the ISC DHCP server because server responds to default relay
- port 67.
- Alternative way to overcome this issue is to run perfdhcp as root.
- </p><p>
- Currently, perfdhcp is seen from the server perspective as relay agent.
- This simplifies its implementation (specifically there is no need to
- receive traffic sent to braodcast addresses). This imposes that IPv4
- address has to be set manually on the interface that will be used to
- communicate with the server. For example, if DHCPv4 server is listening
- on the interface connected to 172.16.1.0 subnet, interface on client
- machine has to have network address assigned from the same subnet
- on one of its interfaces connected to this subnet:
- </p><pre class="screen"><strong class="userinput"><code>#ifconfig eth3 172.16.1.2. netmask 255.255.255.0 up</code></strong></pre><p>
- </p></div><div class="section" title="perfdhcp command line examples"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="perfdhcp-commandline-examples"></a>perfdhcp command line examples</h2></div></div></div><p>
- In this section the perfdhcp command line examples
- are presented as a quick start guide for new users. For the
- detailed list of command line options refer to
- <a class="xref" href="#perfdhcp-command-line" title="Command line options">the section called “Command line options”</a>.
- </p><div class="section" title="Example: basic usage"><div class="titlepage"><div><div><h3 class="title"><a name="perfdhcp-basic-usage"></a>Example: basic usage</h3></div></div></div><p>
- If server is listening on interface with IPv4 address 172.16.1.1
- the simpliest perfdhcp command line will look like this:
- </p><pre class="screen"><strong class="userinput"><code>#./perfdhcp 172.16.1.1</code></strong>
- ***Rate statistics***
- Rate: 206.345
- ***Statistics for: DISCOVER-OFFER***
- sent packets: 21641
- received packets: 350
- drops: 21291
- orphans: 0
- min delay: 9.022 ms
- avg delay: 143.100 ms
- max delay: 259.303 ms
- std deviation: 56.074 ms
- collected packets: 30
- ***Statistics for: REQUEST-ACK***
- sent packets: 350
- received packets: 268
- drops: 82
- orphans: 0
- min delay: 3.010 ms
- avg delay: 152.470 ms
- max delay: 258.634 ms
- std deviation: 56.936 ms
- collected packets: 0
- </pre><p>
- In this case perfdhcp will use remote address 172.16.1.1 as a
- destination address and will use suitable local interface for
- communication. Since, no rate control parameters have been specified
- it will be initiating DHCP exchanges with the maximum possible
- rate (it will try to initiate maximum number of exchanges per
- second and count number of completed exchanged). Due to server's
- performance constraints, many DHCP packets sent to server are likely
- to be dropped. The performance test will be running until it is
- not interrupted by the user (with ^C).
- </p><p>
- The default performance statistics reported by perfdhcp have the
- following meaning:
- </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>Rate - number of packet exchanges (packet sent
- to the server and matching response received from the server)
- completed within a second.</p></li><li class="listitem"><p>sent packets - total number of DHCP packets of
- a specific type sent to the server.</p></li><li class="listitem"><p>received packets - total number of DHCP packets
- of specific type received from the server.</p></li><li class="listitem"><p>drops - number of dropped packets for the
- particular exchange. Number of dropped packets is calculated as
- a difference between number of sent packets and number of
- response packets received from the server. It is likely that
- server sent the reponse but perfdhcp execution had ended before
- reponse arrived. In such case this packet will be assumed
- dropped.</p></li><li class="listitem"><p>orphans - number of packets that have been
- received from the server and did not match any packet sent by
- perfdhcp. This may occur if received packet has been sent
- to some other host or if exchange time out has occured and
- has been been garbage collected.</p></li><li class="listitem"><p>min delay - minimum delay that occured between
- sending the packet to the server and receiving reponse from
- it.</p></li><li class="listitem"><p>avg delay - average delay between sending the
- packet of the specific type the server and receiving response
- from it.</p></li><li class="listitem"><p>max delay - maximum delat that occured between
- sedning the packet to the server and receiveing response from
- it.</p></li><li class="listitem"><p>std deviation - standard deviation of delay
- between sending the packet of a specific type to the server and
- receiving response from it.</p></li><li class="listitem"><p>collected packets - number of garbage collected
- sent packets. Packets may get garbage collected when waiting time
- for server response exceeds value set with
- -d<drop-time>.</p></li></ul></div><p>
- </p><p>
- perfdhcp allows to run the test using specified interface:
- </p><pre class="screen"><strong class="userinput"><code>#./perfdhcp -l eth3</code></strong></pre><p>
- or local address assigned to it:
- </p><pre class="screen"><strong class="userinput"><code>#./perfdhcp -l 172.16.1.2</code></strong></pre><p>
- </p></div><div class="section" title="Example: rate control"><div class="titlepage"><div><div><h3 class="title"><a name="perfdhcp-rate-control"></a>Example: rate control</h3></div></div></div><p>
- In the examples above perfdhcp initiates new exchanges with best
- effort rate. In this case many packets is expected to be dropped by the
- server due to performance limitations. Many times it is desired to set
- the expected (reasonable) rate and verify if generated traffic is
- handled without packet dropes by DHCP server. The following command will
- make perfdhcp to initiate 300 4-way exchanges per second and test will
- last for 60 seconds:
- </p><pre class="screen"><strong class="userinput"><code>#./perfdhcp -l eth3 -p 60 -r 300</code></strong>
- ***Rate statistics***
- Rate: 256.683 exchanges/second, expected rate: 300 exchanges/second
- ***Statistics for: DISCOVER-OFFER***
- sent packets: 17783
- received packets: 15401
- drops: 2382
- orphans: 0
- min delay: 0.109 ms
- avg delay: 75.756 ms
- max delay: 575.614 ms
- std deviation: 60.513 ms
- collected packets: 11
- ***Statistics for: REQUEST-ACK***
- sent packets: 15401
- received packets: 15317
- drops: 84
- orphans: 0
- min delay: 0.536 ms
- avg delay: 72.072 ms
- max delay: 576.749 ms
- std deviation: 58.189 ms
- collected packets: 0
- </pre><p>
- Note that in this example the packet drops have been significantly
- reduced thanks to setting reasonable rate. The non-zero number of
- packet drops and achived rate (256/s) below expected rate (300/s)
- indicate that server's measured performance is lower than 300 leases
- per second. Further rate decrease should eliminate most of the packet
- drops and bring achived rate close to expected rate:
- </p><pre class="screen"><strong class="userinput"><code>#./perfdhcp -l eth3 -p 60 -r 100 -R 30</code></strong>
- ***Rate statistics***
- Rate: 99.8164 exchanges/second, expected rate: 100 exchanges/second
- ***Statistics for: DISCOVER-OFFER***
- sent packets: 5989
- received packets: 5989
- drops: 0
- orphans: 0
- min delay: 0.023 ms
- avg delay: 2.198 ms
- max delay: 181.760 ms
- std deviation: 9.429 ms
- collected packets: 0
- ***Statistics for: REQUEST-ACK***
- sent packets: 5989
- received packets: 5989
- drops: 0
- orphans: 0
- min delay: 0.473 ms
- avg delay: 2.355 ms
- max delay: 189.658 ms
- std deviation: 5.876 ms
- collected packets: 0
- </pre><p>
- Note that the last parameter (-R 30) configures perfdhcp to simulate
- traffic from distinct 30 clients.
- </p></div><div class="section" title="Example: templates"><div class="titlepage"><div><div><h3 class="title"><a name="perfdhcp-templates"></a>Example: templates</h3></div></div></div><p>
- By default the DHCP messages are formed in-flight with default options.
- If desired, there is a way to define custom packet format with template
- files. Content in template files is encoded in hexadecimal format. The
- perfdhcp forms the packet by replacing parts of the binary stream read
- from the file with variable data such as elapsed time, HW address, DUID
- etc. The offsets where such variable data is placed is specific to the
- template file and have to be specified from the command line. Refer to
- <a class="xref" href="#perfdhcp-command-line" title="Command line options">the section called “Command line options”</a> to find out how to
- specify offsets for particular options and fields. With the following
- command line the DHCPv6 SOLICIT and REQUEST packets will be formed from
- solicit-example.hex and request6-example.hex packets:
- </p><pre class="screen"><strong class="userinput"><code>#./perfdhcp -6 -l eth3 -r 100 -R 20 -T templates/solicit-example.hex -T templates/request6-example.hex -O 21 -E 84 -S 22 -I 40 servers</code></strong>
- ***Rate statistics***
- Rate: 99.5398 exchanges/second, expected rate: 100 exchanges/second
- ***Statistics for: SOLICIT-ADVERTISE***
- sent packets: 570
- received packets: 569
- drops: 1
- orphans: 0
- min delay: 0.259 ms
- avg delay: 0.912 ms
- max delay: 6.979 ms
- std deviation: 0.709 ms
- collected packets: 0
- ***Statistics for: REQUEST-REPLY***
- sent packets: 569
- received packets: 569
- drops: 0
- orphans: 0
- min delay: 0.084 ms
- avg delay: 0.607 ms
- max delay: 6.490 ms
- std deviation: 0.518 ms
- collected packets: 0
- </pre><p>
- where:
- </p><div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem"><p>two occurences of -O 21 - DUID's last octet
- positions in SOLICIT and REQUEST respectively.</p></li><li class="listitem"><p>-E 84 - elapsed time option position in
- REQUEST template</p></li><li class="listitem"><p>-S 22 - server id position in REQUEST
- template</p></li><li class="listitem"><p>-I 40 - IA_NA option position in REQUEST
- template</p></li></ul></div><p>
- </p></div></div></div></div></body></html>
|