???????MySQL???????????????? ??

????????: Linux RHEL 5U4 X86-64?? 24G??棬 16??.

????MySQL????????10.232.36.100???

??????????32??????????????????????update?? insert?? delete??????????????50%?? 30%?? 20%?? ?????????999999 × 100?Σ??100?β????????1-3??

??????????????????2??С???

??????????????tsung??????????? ???????blog??????? ??????

??????????????????? ???????????????????????滻????????????д???????к????????塣
???????????Σ?
<!DOCTYPE tsung SYSTEM "/usr/local/share/tsung/tsung-1.0.dtd">
<tsung loglevel="warning" dumptraffic="false">

  <clients>
    <client host="localhost" use_controller_vm="true"/>
  </clients>

 <servers>
  <server host="10.232.36.100" port="3306" type="tcp"/>
 </servers>

 <load>
  <arrivalphase phase="1" duration="2" unit="hour">
    <users interarrival="0.1" unit="second" maxnumber="32"></users>
  </arrivalphase>
 </load>

 <sessions>
  <session probability="50" name="st-replace" type="ts_mysql">

      <request>
        <mysql type="connect" />
      </request>
      <request>
        <mysql type="authenticate" database="test" username="test" password="mysqltest" />
      </request> 

      <for from="1" to="999999" var="counter">
        <for from="1" to="100" var="counter">
          <setdynvars sourcetype="random_number" start="1" end="999999999">
            <var name="rnd_uid" />
          </setdynvars>
          <setdynvars sourcetype="random_string" length="13">
            <var name="rnd_uname" />
          </setdynvars>
          <setdynvars sourcetype="random_number" start="0" end="1">
            <var name="rnd_male" />
          </setdynvars>
          <setdynvars sourcetype="random_number" start="1" end="120">
           <var name="rnd_age" />
         </setdynvars>
         <setdynvars sourcetype="random_string" length="10">
           <var name="rnd_city" />
         </setdynvars>
         <setdynvars sourcetype="random_string" length="52">
           <var name="rnd_profile" />
         </setdynvars>
         <request subst="true">
           <mysql type="sql">replace into user(tid?? uname?? male?? age?? city?? profile) values(%%_rnd_uid%%?? "%%_rnd_uname%%"?? %%_rnd_male%%?? %%_rnd_age%%?? "%%_rnd_city%%"?? "%%_rnd_profile%%") </mysql>
         </request>
        </for>
        <thinktime min="2" max="5" random="true" />
      </for>

      <request>
        <mysql type="close"></mysql>
      </request>
  </session>

  <session probability="20" name="st-delete" type="ts_mysql">

      <request>
        <mysql type="connect" />
      </request>
      <request>
        <mysql type="authenticate" database="test" username="test" password="mysqltest" />
      </request> 

      <for from="1" to="999999" var="counter">
        <for from="1" to="100" var="counter">
          <setdynvars sourcetype="random_number" start="1" end="999999999">
            <var name="rnd_uid" />
          </setdynvars>
          <request subst="true">
            <mysql type="sql">delete from user where tid = %%_rnd_uid%% </mysql>
          </request>
        </for>
        <thinktime min="2" max="5" random="true" />
      </for>

      <request>
        <mysql type="close"></mysql>
      </request>
  </session>

  <session probability="30" name="st-update" type="ts_mysql">

      <request>
        <mysql type="connect" />
      </request>
      <request>
        <mysql type="authenticate" database="test" username="test" password="mysqltest" />
      </request> 

      <for from="1" to="999999" var="counter">
        <for from="1" to="100" var="counter">
          <setdynvars sourcetype="random_number" start="1" end="999999999">
            <var name="rnd_uid" />
          </setdynvars>
         <setdynvars sourcetype="random_string" length="52">
           <var name="rnd_profile" />
         </setdynvars>

         <request subst="true">
           <mysql type="sql">update  user set profile = "%%_rnd_profile%%" where tid = %%_rnd_uid%% </mysql>
         </request>
        </for>
        <thinktime min="2" max="5" random="true" />
      </for>

      <request>
        <mysql type="close"></mysql>
      </request>
  </session>

 </sessions>
</tsung>

??????????!