1 #
   2 # CDDL HEADER START
   3 #
   4 # The contents of this file are subject to the terms of the
   5 # Common Development and Distribution License (the "License").
   6 # You may not use this file except in compliance with the License.
   7 #
   8 # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
   9 # or http://www.opensolaris.org/os/licensing.
  10 # See the License for the specific language governing permissions
  11 # and limitations under the License.
  12 #
  13 # When distributing Covered Code, include this CDDL HEADER in each
  14 # file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15 # If applicable, add the following below this CDDL HEADER, with the
  16 # fields enclosed by brackets "[]" replaced with your own identifying
  17 # information: Portions Copyright [yyyy] [name of copyright owner]
  18 #
  19 # CDDL HEADER END
  20 #
  21 #
  22 # Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  23 # Use is subject to license terms.
  24 #
  25 # This workloads emulates a video server. It has two filesets, one of videos
  26 # being actively served, and one of videos availabe but currently inactive
  27 # (passive). However, one thread, vidwriter, is writing new videos to replace
  28 # no longer viewed videos in the passive set. Meanwhile $nthreads threads are
  29 # serving up videos from the activevids fileset. If the desired rate is R mb/s,
  30 # and $nthreads is set to T, then set the $srvbwrate to R * T to get the
  31 # desired rate per video stream. The video replacement rate of one video
  32 # file per replacement interval, is set by $repintval which defaults to
  33 # 10 seconds. Thus the write bandwidth will be set as $filesize/$repintval.
  34 
  35 set $dir=/tmp
  36 set $eventrate=96
  37 set $filesize=10g
  38 set $nthreads=48
  39 set $numactivevids=32
  40 set $numpassivevids=194
  41 set $reuseit=false
  42 set $readiosize=256k
  43 set $writeiosize=1m
  44 #
  45 set $passvidsname=passivevids
  46 set $actvidsname=activevids
  47 #
  48 set $repintval=10
  49 
  50 eventgen rate=$eventrate
  51 
  52 define fileset name=$actvidsname,path=$dir,size=$filesize,entries=$numactivevids,dirwidth=4,prealloc,paralloc,reuse=$reuseit
  53 define fileset name=$passvidsname,path=$dir,size=$filesize,entries=$numpassivevids,dirwidth=20,prealloc=50,paralloc,reuse=$reuseit
  54 
  55 define process name=vidwriter,instances=1
  56 {
  57   thread name=vidwriter,memsize=10m,instances=1
  58   {
  59     flowop deletefile name=vidremover,filesetname=$passvidsname
  60     flowop createfile name=wrtopen,filesetname=$passvidsname,fd=1
  61     flowop writewholefile name=newvid,iosize=$writeiosize,fd=1,srcfd=1
  62     flowop closefile name=wrtclose, fd=1
  63     flowop delay name=replaceinterval, value=$repintval
  64   }
  65 }
  66 
  67 define process name=vidreaders,instances=1
  68 {
  69   thread name=vidreaders,memsize=10m,instances=$nthreads
  70   {
  71     flowop read name=vidreader,filesetname=$actvidsname,iosize=$readiosize
  72     flowop bwlimit name=serverlimit, target=vidreader
  73   }
  74 }
  75 
  76 echo  "Video Server Version 1.1 personality successfully loaded"
  77 usage "Usage: set \$dir=<dir>              defaults to $dir"
  78 usage "       set \$eventrate=<value>      defaults to $eventrate"
  79 usage "       set \$filesize=<size>        defaults to $filesize"
  80 usage "       set \$nthreads=<value>       defaults to $nthreads"
  81 usage "       set \$writeiosize=<value>    defaults to $writeiosize"
  82 usage "       set \$readiosize=<value>     defaults to $readiosize"
  83 usage "       set \$numactivevids=<value>  defaults to $numactivevids"
  84 usage "       set \$numpassivevids=<value> defaults to $numpassivevids"
  85 usage " "
  86 usage "       run runtime (e.g. run 60)"
  87