/*
 * DataComm-1 workload approximated using PGL 
 * (original DataComm-1 specs were developed prior to PGL)
 *
 */

// Warning: These workload specs have not been verified yet!

#include "contents.pg"
#include "phases.pg"

/*
 * Note: DataComm-1 is PolyMix-1 with longer (4 hour) tests and persistent
 * connections. Compare these specs with polymix-1.pg
 */


// there is one workload parameter, namely request rate
rate Req_Rate = 50/sec; // adjust as needed

// experiment duration
time ExpDur = 4hour;

// describe DataComm-1 server
Server S = { 
	kind = "DataComm-1-srv";     // just a label
	accept_lmt = -1;             // no limit on number of accept(2) calls
	contents = [ cntPolyMix_1 ]; // dcomm-1 supports only one kind of content
	xact_think = norm(3sec, 1.5sec);
	pconn_use_lmt = zipf(16);
	http_versions = [ "1.0" ];  // newer agents use HTTP/1.1 by default
};

// where the simulated servers and robots will be located
// these ips will need adjustments based on your local environment
addr[] srv_ips = ['10.0.1.3:8080', '10.0.1.4:8080' ];
addr[] rbt_ips = ['10.0.1.1', '10.0.1.2' ];

// handy constant
int RobotCnt = count(rbt_ips);

// describe DataComm-1 robot
Robot R = {
	kind = "DataComm-1-rbt";          // just a label
	origins = srv_ips;
	recurrence = 55% / cntPolyMix_1.cachable;
	pop_model = { pop_distr = popUnif(); };
	req_rate = Req_Rate / RobotCnt;  // each robot has smaller req_rate
	pconn_use_lmt = zipf(64);
	http_versions = [ "1.0" ];  // newer agents use HTTP/1.1 by default
};


/* phases (note that load is kept at constant level) */

Phase phWarm = { 
	name = "warm";
	goal.duration = 10% * ExpDur;
	load_factor_beg = 1;         // load starts high right away
	log_stats = false; 
};

Phase phMeas = { 
	name = "meas";
	goal.duration = ExpDur - phWarm.goal.duration; // the rest of the run
};

// build schedule using some well-known phases and phases defined above
schedule(phWait, phWarm, phMeas, phCool);

// place agents on their hosts
S.addresses = srv_ips;
R.addresses = rbt_ips;

// commit to using these servers and robots
use(S, R);
