1 <?xml version="1.0" encoding="iso-8859-1"?>
2 <!DOCTYPE refentry PUBLIC "-//Samba-Team//DTD DocBook V4.2-Based Variant V1.0//EN" "http://www.samba.org/samba/DTD/samba-doc">
3 <refentry id="traffic_replay.7">
6 <refentrytitle>traffic_replay</refentrytitle>
7 <manvolnum>7</manvolnum>
8 <refmiscinfo class="source">Samba</refmiscinfo>
9 <refmiscinfo class="manual">User Commands</refmiscinfo>
10 <refmiscinfo class="version">&doc.version;</refmiscinfo>
15 <refname>traffic_replay</refname>
16 <refpurpose>Samba traffic generation tool.
22 <command>traffic_replay</command>
23 <arg choice="opt">-F, --fixed-password <test-password></arg>
24 <arg choice="opt">-T, --packets-per-second <number></arg>
25 <arg choice="opt">-S, --scale-traffic <scale by factor></arg>
26 <arg choice="opt">-r, --replay-rate <scale by factor></arg>
27 <arg choice="opt">-D, --duration <seconds></arg>
28 <arg choice="opt">--traffic-summary <output file></arg>
29 <arg choice="opt">-I, --instance-id <id></arg>
30 <arg choice="opt">-K, --prefer-kerberos</arg>
31 <arg choice="opt">-B, --badpassword-frequency <frequency></arg>
32 <arg choice="opt">--dns-rate <rate></arg>
33 <arg choice="opt">-t, --timing-data <file></arg>
34 <arg choice="opt">--random-seed <seed></arg>
35 <arg choice="opt">-U, --username user</arg>
36 <arg choice="opt">--password <password></arg>
37 <arg choice="opt">-W --workgroup <workgroup></arg>
38 <arg choice="opt">--realm <realm></arg>
39 <arg choice="opt">-s, --config-file <file></arg>
40 <arg choice="opt">-k, --kerberos <kerberos></arg>
41 <arg choice="opt">--ipaddress <address></arg>
42 <arg choice="opt">-P, --machine-pass</arg>
43 <arg choice="opt">--option <option></arg>
44 <arg choice="opt">-d, --debuglevel <debug level></arg>
45 <arg choice="opt">--conversation-persistence <0-1></arg>
46 <arg choice="opt">--latency-timeout <seconds></arg>
47 <arg choice="opt">--stop-on-any-error</arg>
48 <arg choice="req">summary-file</arg>
49 <arg choice="req">dns-hostname</arg>
53 <command>traffic_replay</command>
54 <arg choice="opt">-G, --generate-users-only</arg>
55 <arg choice="opt">-F, --fixed-password <test-password></arg>
56 <arg choice="opt">-n, --number-of-users <total users></arg>
57 <arg choice="opt">--number-of-groups <total groups></arg>
58 <arg choice="opt">--average-groups-per-user <average number></arg>
59 <arg choice="opt">--group-memberships <total memberships></arg>
60 <arg choice="opt">--max-members <group size></arg>
61 <arg choice="req">dns-hostname</arg>
65 <command>traffic_replay</command>
66 <arg choice="req">-c|--clean-up</arg>
67 <arg choice="req">dns-hostname</arg>
71 <command>traffic_replay</command>
72 <arg choice="opt">-h, --help</arg>
73 <arg choice="opt">-V, --version</arg>
78 <title>DESCRIPTION</title>
79 <para>This tool is part of the <citerefentry><refentrytitle>samba</refentrytitle>
80 <manvolnum>7</manvolnum></citerefentry> suite.</para>
81 <para>This tool generates traffic in order to measure the performance
82 of a Samba DC, and to test how well Samba will scale as a network
83 increases in size. It can simulate multiple different hosts making
84 multiple different types of requests to a DC.</para>
86 <para>This tool is intended to run against a dedicated test DC (rather
87 than a live DC that is handling real network traffic).</para>
89 <para>Note that a side-effect of running this tool is that user
90 accounts will be created on the DC, in order to test various Samba
91 operations. As creating accounts can be very time-consuming, these
92 users will remain on the DC by default. To remove these accounts, use
93 the --clean-up option.
98 <title>OPTIONS</title>
103 <term>-h|--help</term>
105 Print a summary of command line options.
110 <term>summary-file</term>
112 File containing the network traffic to replay. This should be a
113 traffic-model (generated by <command>traffic_learner</command>).
114 Based on this file, this tool will generate 'conversations' which
115 represent Samba activity between a network host and the DC.
120 <term>dns-hostname</term>
122 The full DNS hostname of the DC that's being tested. The Samba activity
123 in the summary-file will be replicated and directed at this DC. It's
124 recommended that you use a dedicated DC for testing and don't try to run
125 this tool against a DC that's processing live network traffic.
130 <term>-F|--fixed-password <test-password></term>
132 Test users are created when this tool is run, so that actual Samba
133 activity, such as authorizing users, can be mimicked. This option
134 specifies the password that will be used for any test users that are
137 <para>Note that any users created by this tool will remain on the DC
138 until you run the --clean-up option. Therefore, the fixed-password
139 option needs to be the same each time the tool is run, otherwise the
140 test users won't authenticate correctly.
145 <term>random-seed</term>
147 A number to seed the random number generator with. When traffic is
148 generated from a model-file, use this option to keep the traffic
149 consistent across multiple test runs. This allows you to compare the
150 performance of Samba between different releases.
155 <term>Traffic Model Options</term>
157 When the summary-file is a traffic-model (produced by
158 <command>traffic_learner</command>), use these options to alter the
159 traffic that gets generated.</para>
162 <term>-D|--duration <seconds></term>
164 Specifies the approximate duration in seconds to generate
165 traffic for. The default is 60 seconds.
170 <term>-T|--packets-per-second <number></term>
172 Generate this many packets per second, regardless of
173 the traffic rate of the sample on which the model
174 was based. This cannot be used with <option>-S</option>.
179 <term>-S|--scale-traffic <factor></term>
181 Increases the number of conversations by this factor,
182 relative to the original traffic sample on which the
183 model was based. This option won't affect the rate at
184 which packets get sent (which is still based on the
185 traffic model), but it will mean more conversations
186 get replayed. It cannot be combined with
187 <option>-T</option>, which sets the traffic rate in a
193 <term>-r|--replay-rate <factor></term>
194 <listitem><para> Replays the traffic faster by this
195 factor. This option won't affect the number of packets
196 sent, but it will squeeze them into fewer
197 conversations, which may reduce resource usage.
202 <term>--traffic-summary <output-file></term>
204 Instead of replaying a traffic-model, this option generates a
205 traffic-summary file based on what traffic would be sent. Using
206 a traffic-model allows you to scale the packet rate and number
207 of packets sent. However, using a traffic-model introduces
208 some randomness into the traffic generation. So running the
209 same traffic_replay command multiple times using a model file
210 may result in some differences in the actual traffic sent.
211 However, running the same traffic_replay command multiple times
212 with a traffic-summary file will always result in the same
213 traffic being sent. </para>
215 For taking performance measurements over several test runs,
216 it's recommended to use this option and replay the traffic from
217 a traffic-summary file, or to use the --random-seed option.
221 <term>--stop-on-any-error</term>
222 <listitem><para> Any client error causes the whole run to stop.
227 <term>--conversation-persistence <0-1></term>
228 <listitem><para> Conversation termination (as decided
229 by the model) is re-interpreted as a long pause with
230 this probability. </para></listitem>
234 <term>--latency-timeout <seconds></term>
235 <listitem><para> Wait this long at the end of the run
236 for outstanding reply packets. The number of
237 conversations that have not finished at the end of the
238 timeout is a failure metric. </para></listitem>
246 <term>--generate-users-only</term>
247 <listitem><para>Add extra user/groups on the DC to increase the DB
248 size. By default, this tool automatically creates test users that map
249 to the traffic conversations being generated. This option allows extra
250 users to be created on top of this. Note that these extra users may
251 not actually used for traffic generation - the traffic generation is
252 still based on the number of conversations from the model/summary file.
256 Generating a large number of users can take a long time, so it this
257 option allows this to be done only once.</para>
259 <para>Note that the users created will remain on the DC until the
260 tool is run with the --clean-up option. This means that it is best to
261 only assign group memberships once, i.e. run --clean-up before
262 assigning a different allocation of group memberships.</para>
266 <term>-n|--number-of-users <total-users></term>
268 Specifies the total number of test users to create (excluding
269 any machine accounts required for the traffic). Note that these
270 extra users simply populate the DC's DB - the actual user
271 traffic generated is still based on the summary-file.
276 <term>--number-of-groups <total-groups></term>
278 Creates the specified number of groups, for assigning the test
279 users to. Note that users are not automatically assigned to
280 groups - use either --average-groups-per-user or
281 --group-memberships to do this.
286 <term>--average-groups-per-user <average-groups></term>
288 Randomly assigns the test users to the test groups created.
289 The group memberships are distributed so that the overall
290 average groups that a user is member of matches this number.
291 Some users will belong to more groups and some users will
292 belong to fewer groups. This option is incompatible with
293 the --group-membership option.
298 <term>--group-memberships <total-memberships></term>
300 Randomly assigns the test users to the test groups created.
301 The group memberships are distributed so that the total
302 groups that a user is member of, across all users, matches
303 this number. For example, with 100 users and 10 groups,
304 --group-memberships=300 would assign a user to 3 groups
305 on average. Some users will belong to more groups and some
306 users will belong to fewer groups, but the total of all
307 member linked attributes would be 300. This option is
308 incompatible with the --average-groups-per-user option.
312 <term>--max-members <group size></term>
313 <listitem><para> Limit the largest group to this size,
314 even if the other group options would have it otherwise.
322 <term>--clean-up</term>
324 Cleans up any users and groups that were created by previously running
325 this tool. It is recommended you always clean up after running the tool.
330 <term>-I|--instance-id <id></term>
332 Use this option to run multiple instances of the tool on the same DC at
333 the same time. This adds a prefix to the test users generated to keep
334 them separate on the DC.
339 <term>-K|--prefer-kerberos</term>
341 Use Kerberos to authenticate the test users.
346 <term>-B|--badpassword-frequency <frequency></term>
348 Use this option to simulate users trying to authenticate with an
354 <term>--dns-rate <rate></term>
356 Increase the rate at which DNS packets get sent.
361 <term>-t|--timing-data <file></term>
363 This writes extra timing data to the file specified. This is mostly
364 used for reporting options, such as generating graphs.
369 <term>Samba Common Options</term>
372 &cmdline.common.debug.client;
373 &cmdline.common.config.client;
374 &cmdline.common.option;
376 <term>--realm=REALM</term>
387 <term>Credential Options</term>
391 <term>--simple-bind-dn=DN</term>
393 DN to use for a simple bind
398 <term>--password=PASSWORD</term>
405 <term>-U USERNAME|--username=USERNAME</term>
412 <term>-W WORKGROUP|--workgroup=WORKGROUP</term>
418 &cmdline.common.credentials.usekerberos;
421 <term>--ipaddress=IPADDRESS</term>
423 IP address of the server
427 &cmdline.common.credentials.machinepass;
436 <title>OPERATIONS</title>
439 <title>Generating a traffic-summary file</title>
440 <para>To use this tool, you need either a traffic-summary file or a
441 traffic-model file. To generate either of these files, you will need a
442 packet capture of actual Samba activity on your network.</para>
444 <para>Use Wireshark to take a packet capture on your network of the
445 traffic you want to generate. For example, if you want to simulate lots
446 of users logging on, then take a capture at 8:30am when users are
449 <para>Next, you need to convert your packet capture into a traffic
450 summary file, using <command>traffic_summary.pl</command>. Basically
451 this removes any sensitive information from the capture and summarizes
452 what type of packet was sent and when.</para>
454 <para>Refer to the <command>traffic_summary.pl --help</command> help for more
455 details, but the basic command will look something like:</para>
457 <para><command>tshark -r capture.pcapng -T pdml |
458 traffic_summary.pl > traffic-summary.txt</command></para>
462 <title>Replaying a traffic-summary file</title>
463 <para>Once you have a traffic-summary file, you can use it to generate
464 traffic. The traffic_replay tool gets passed the traffic-summary file,
465 along with the full DNS hostname of the DC being tested. You also need
466 to provide some user credentials, and possibly the Samba realm and
467 workgroup (although the realm and workgroup may be determined
468 automatically, for example from the /etc/smb.conf file, if one is
469 present). E.g.</para>
471 <para><command>traffic_replay traffic-summary.txt
472 my-dc.samdom.example.com -UAdmin%password -W samdom
473 --realm=samdom.example.com --fixed-password=blahblah123!</command>
476 <para>This simply regenerates Samba activity seen in the traffic
477 summary. The traffic is grouped into 'conversations' between a host and
478 the DC. A user and machine account is created on the DC for each
479 conversation, in order to allow logon and other operations to succeed.
480 The script generates the same types of packets as those seen in the
483 <para>Creating users can be quite a time-consuming process, especially
484 if a lot of conversations are being generated. To save time, the test
485 users remain on the DC by default. You will need to run the --clean-up
486 option to remove them, once you have finished generating traffic.
487 Because the same test users are used across multiple runs of the tool,
488 a consistent password for these users needs to be used - this is
489 specified by the --fixed-password option.
492 <para>The benefit of this tool over simply using tcprelay is that the
493 traffic generated is independent of any specific network. No setup is
494 needed beforehand on the test DC. The traffic no longer contains
495 sensitive details, so the traffic summary could be potentially shared
496 with other Samba developers.</para>
498 <para>However, replaying a traffic-summary directly is somewhat limited
499 in what you can actually do. A more flexible approach is to generate
500 the traffic using a model file.</para>
504 <title>Generating a traffic-model file</title>
505 <para>To create a traffic-model file, simply pass the traffic-summary
506 file to the <command>traffic_learner</command> script. E.g.</para>
508 <para><command>traffic_learner traffic-summary.txt
509 -o traffic-model.txt</command></para>
511 <para>This generates a model of the Samba activity in your network.
512 This model-file can now be used to generate traffic.</para>
516 <title>Replaying the traffic-model file</title>
517 <para>Packet generation using a traffic-model file uses the same
518 command as a traffic-summary file, e.g.</para>
520 <para><command>traffic_replay traffic-model.txt
521 my-dc.samdom.example.com -UAdmin%password</command>
524 <para>By default, this will generate 60 seconds worth of traffic based
525 on the model. You can specify longer using the --duration parameter.
528 <para>The traffic generated is an approximation of what was seen in
529 the network capture. The traffic generation involves some randomness,
530 so running the same command multiple times may result in slightly
531 different traffic being generated (although you can avoid this, by
532 specifying the --random-seed option).</para>
534 <para>As well as changing how long the model runs for, you can also
535 change how many conversations get generated and how fast the traffic
536 gets replayed. To roughly double the number of conversations that get
537 replayed, use --scale-traffic=2 or to approximately halve the number
538 use --scale-traffic=0.5. To approximately double how quickly the
539 conversations get replayed, use --replay-rate=2, or to halve this use
540 --replay-rate=0.5</para>
542 <para>For example, to generate approximately 10 times the amount of
543 traffic seen over a two-minute period (based on the network capture),
546 <para><command>traffic_replay traffic-model.txt
547 my-dc.samdom.example.com -UAdmin%password --fixed-password=blahblah123!
548 --scale-traffic=10 --duration=120</command></para>
552 <title>Scaling the number of users</title>
553 <para>The performance of a Samba DC running a small subset of test
554 users will be different to a fully-populated Samba DC running in a
555 network. As the number of users increases, the size of the DB
556 increases, and a very large DB will perform worse than a smaller DB.
559 <para>To increase the size of the Samba DB, this tool can also create
560 extra users and groups. These extra users are basically 'filler' for
561 the DB. They won't actually be used to generate traffic, but they may
562 slow down authentication of the test users.</para>
564 <para>For example, to populate the DB with an extra 5000 users (note
565 this will take a while), use the command:</para>
567 <para><command>traffic_replay my-dc.samdom.example.com
568 -UAdmin%password --generate-users-only --fixed-password=blahblah123!
569 --number-of-users=5000</command></para>
571 <para>You can also create groups and assign users to groups. The users
572 can be randomly assigned to groups - this includes any extra users
573 created as well as the users that map to conversations. Use either
574 --average-groups-per-user or --group-memberships to specify how many
575 group memberships should be assigned to the test users.</para>
577 <para>For example, to assign the users in the replayed conversations
578 into 10 groups on average, use a command like:</para>
580 <para><command>traffic_replay traffic-model.txt my-dc.samdom.example.com
581 -UAdmin%password --fixed-password=blahblah123!
582 --generate-users-only --number-of-groups=25 --average-groups-per-user=10
585 <para>The users created by the test will have names like STGU-0-xyz.
586 The groups generated have names like STGG-0-xyz.</para>
592 <title>VERSION</title>
594 <para>This man page is complete for version &doc.version; of the Samba
599 <title>SEE ALSO</title>
602 <refentrytitle>traffic_learner</refentrytitle><manvolnum>7</manvolnum>
608 <title>AUTHOR</title>
610 <para>The original Samba software and related utilities
611 were created by Andrew Tridgell. Samba is now developed
612 by the Samba Team as an Open Source project similar
613 to the way the Linux kernel is developed.</para>
615 <para>The traffic_replay tool was developed by the Samba team at
616 Catalyst IT Ltd.</para>
618 <para>The traffic_replay manpage was written by Tim Beale.</para>