siri: updated xp to add delay between bursts of requests

This commit is contained in:
Quentin De Coninck 2017-02-23 17:01:23 +01:00
parent 674ed0d14e
commit efa57d7516
6 changed files with 42 additions and 18 deletions

View File

@ -25,6 +25,8 @@ public class SiriClient {
public final int MAX_PAYLOAD_SIZE; public final int MAX_PAYLOAD_SIZE;
public final int INTERVAL_TIME_MS; public final int INTERVAL_TIME_MS;
public final int BUFFER_SIZE; public final int BUFFER_SIZE;
public final int BURST_SIZE;
public final int INTERVAL_BURST_TIME_MS;
private boolean mRun = false; private boolean mRun = false;
private int messageId = 0; private int messageId = 0;
@ -41,18 +43,20 @@ public class SiriClient {
OutputStream outputStream; OutputStream outputStream;
OutputStreamWriter osw; OutputStreamWriter osw;
Socket socket; Socket socket;
private int pktCounter;
/** /**
* Constructor of the class. OnMessagedReceived listens for the messages received from server * Constructor of the class. OnMessagedReceived listens for the messages received from server
*/ */
public SiriClient(String serverIp, int serverPort, int runTime, int querySize, int responseSize, public SiriClient(String serverIp, int serverPort, int runTime, int querySize, int responseSize,
int delayQueryResponse, int minPayloadSize, int maxPayloadSize, int intervalTimeMs, int delayQueryResponse, int minPayloadSize, int maxPayloadSize, int intervalTimeMs,
int bufferSize) { int bufferSize, int burstSize, int intervalBurstTimeMs) {
random = new Random(); random = new Random();
sentTime = new long[MAX_ID]; sentTime = new long[MAX_ID];
delayTime = new ArrayList<>(); delayTime = new ArrayList<>();
counter = 0; counter = 0;
missed = 0; missed = 0;
pktCounter = 0;
/* Client parameters */ /* Client parameters */
SERVERIP = serverIp; SERVERIP = serverIp;
SERVERPORT = serverPort; SERVERPORT = serverPort;
@ -64,10 +68,12 @@ public class SiriClient {
MAX_PAYLOAD_SIZE = maxPayloadSize; MAX_PAYLOAD_SIZE = maxPayloadSize;
INTERVAL_TIME_MS = intervalTimeMs; INTERVAL_TIME_MS = intervalTimeMs;
BUFFER_SIZE = bufferSize; BUFFER_SIZE = bufferSize;
BURST_SIZE = burstSize;
INTERVAL_BURST_TIME_MS = intervalBurstTimeMs;
} }
public SiriClient(String serverIp, int serverPort, int runTime) { public SiriClient(String serverIp, int serverPort, int runTime) {
this(serverIp, serverPort, runTime, 2500, 750, 0, 85, 500, 333, 9); this(serverIp, serverPort, runTime, 2500, 750, 0, 85, 500, 333, 9, 0, 0);
} }
protected String getStringWithLengthAndFilledWithCharacter(int length, char charToFill) { protected String getStringWithLengthAndFilledWithCharacter(int length, char charToFill) {
@ -257,11 +263,17 @@ public class SiriClient {
final long startTime = System.currentTimeMillis(); final long startTime = System.currentTimeMillis();
while (socket != null && !socket.isClosed()) { while (socket != null && !socket.isClosed()) {
try { try {
Thread.sleep(INTERVAL_TIME_MS); //* getPoisson(3)); if (BURST_SIZE > 0 && pktCounter == BURST_SIZE) {
Thread.sleep(INTERVAL_BURST_TIME_MS);
pktCounter = 0;
} else {
Thread.sleep(INTERVAL_TIME_MS); //* getPoisson(3));
}
if ((System.currentTimeMillis() - startTime) >= RUN_TIME * 1000) { if ((System.currentTimeMillis() - startTime) >= RUN_TIME * 1000) {
stopClient(); stopClient();
} else if (!socket.isClosed() && counter <= QUERY_SIZE * BUFFER_SIZE) { } else if (!socket.isClosed() && counter <= QUERY_SIZE * BUFFER_SIZE) {
sendMessage(); sendMessage();
pktCounter++;
} else if (!socket.isClosed()) { } else if (!socket.isClosed()) {
missed++; missed++;
} }
@ -328,11 +340,11 @@ public class SiriClient {
public static void usage() { public static void usage() {
System.out.println("Usage: siriClient serverIP serverPort runTime [querySize responseSize delayQueryResponse " System.out.println("Usage: siriClient serverIP serverPort runTime [querySize responseSize delayQueryResponse "
+ "minPayloadSize maxPayloadSize intervalTimeMs bufferSize]"); + "minPayloadSize maxPayloadSize intervalTimeMs bufferSize burstSize intervalBurstTimeMs]");
} }
public static void main(String[] args) { public static void main(String[] args) {
if (args.length != 3 && args.length != 10) { if (args.length != 3 && args.length != 12) {
usage(); usage();
System.exit(1); System.exit(1);
} }
@ -341,7 +353,7 @@ public class SiriClient {
int runTime = Integer.parseInt(args[2]); int runTime = Integer.parseInt(args[2]);
SiriClient siriClient; SiriClient siriClient;
if (args.length == 10) { if (args.length == 12) {
int querySize = Integer.parseInt(args[3]); int querySize = Integer.parseInt(args[3]);
int responseSize = Integer.parseInt(args[4]); int responseSize = Integer.parseInt(args[4]);
int delayQueryResponse = Integer.parseInt(args[5]); int delayQueryResponse = Integer.parseInt(args[5]);
@ -349,8 +361,10 @@ public class SiriClient {
int maxPayloadSize = Integer.parseInt(args[7]); int maxPayloadSize = Integer.parseInt(args[7]);
int intervalTimeMs = Integer.parseInt(args[8]); int intervalTimeMs = Integer.parseInt(args[8]);
int bufferSize = Integer.parseInt(args[9]); int bufferSize = Integer.parseInt(args[9]);
int burstSize = Integer.parseInt(args[10]);
int intervalBurstTimeMs = Integer.parseInt(args[11]);
siriClient = new SiriClient(serverIp, serverPort, runTime, querySize, responseSize, delayQueryResponse, siriClient = new SiriClient(serverIp, serverPort, runTime, querySize, responseSize, delayQueryResponse,
minPayloadSize, maxPayloadSize, intervalTimeMs, bufferSize); minPayloadSize, maxPayloadSize, intervalTimeMs, bufferSize, burstSize, intervalBurstTimeMs);
} else { } else {
siriClient = new SiriClient(serverIp, serverPort, runTime); siriClient = new SiriClient(serverIp, serverPort, runTime);
} }

View File

@ -43,6 +43,8 @@ class MpExperienceSiri(MpExperience):
self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE) self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE)
self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS) self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS)
self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE) self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE)
self.burst_size = self.xpParam.getParam(MpParamXp.SIRIBURSTSIZE)
self.interval_burst_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALBURSTTIMEMS)
def prepare(self): def prepare(self):
MpExperience.prepare(self) MpExperience.prepare(self)
@ -61,7 +63,7 @@ class MpExperienceSiri(MpExperience):
s = MpExperienceSiri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \ s = MpExperienceSiri.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \ self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
" " + self.delay_query_response + " " + self.min_payload_size + " " + \ " " + self.delay_query_response + " " + self.min_payload_size + " " + \
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + \ self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
" >" + MpExperienceSiri.CLIENT_LOG + " 2>" + MpExperienceSiri.CLIENT_ERR " >" + MpExperienceSiri.CLIENT_LOG + " 2>" + MpExperienceSiri.CLIENT_ERR
print(s) print(s)
return s return s

View File

@ -46,6 +46,8 @@ class MpExperienceSiriHTTP(MpExperience):
self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE) self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE)
self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS) self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS)
self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE) self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE)
self.burst_size = self.xpParam.getParam(MpParamXp.SIRIBURSTSIZE)
self.interval_burst_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALBURSTTIMEMS)
self.file = self.xpParam.getParam(MpParamXp.HTTPFILE) self.file = self.xpParam.getParam(MpParamXp.HTTPFILE)
self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE) self.random_size = self.xpParam.getParam(MpParamXp.HTTPRANDOMSIZE)
@ -75,7 +77,7 @@ class MpExperienceSiriHTTP(MpExperience):
s = MpExperienceSiriHTTP.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \ s = MpExperienceSiriHTTP.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \ self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
" " + self.delay_query_response + " " + self.min_payload_size + " " + \ " " + self.delay_query_response + " " + self.min_payload_size + " " + \
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + \ self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
" >" + MpExperienceSiriHTTP.CLIENT_LOG + " 2>" + MpExperienceSiriHTTP.CLIENT_ERR " >" + MpExperienceSiriHTTP.CLIENT_LOG + " 2>" + MpExperienceSiriHTTP.CLIENT_ERR
print(s) print(s)
return s return s

View File

@ -46,6 +46,8 @@ class MpExperienceSiriMsg(MpExperience):
self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE) self.max_payload_size = self.xpParam.getParam(MpParamXp.SIRIMAXPAYLOADSIZE)
self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS) self.interval_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALTIMEMS)
self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE) self.buffer_size = self.xpParam.getParam(MpParamXp.SIRIBUFFERSIZE)
self.burst_size = self.xpParam.getParam(MpParamXp.SIRIBURSTSIZE)
self.interval_burst_time_ms = self.xpParam.getParam(MpParamXp.SIRIINTERVALBURSTTIMEMS)
self.client_sleep = self.xpParam.getParam(MpParamXp.MSGCLIENTSLEEP) self.client_sleep = self.xpParam.getParam(MpParamXp.MSGCLIENTSLEEP)
self.server_sleep = self.xpParam.getParam(MpParamXp.MSGSERVERSLEEP) self.server_sleep = self.xpParam.getParam(MpParamXp.MSGSERVERSLEEP)
self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS) self.nb_requests = self.xpParam.getParam(MpParamXp.MSGNBREQUESTS)
@ -75,7 +77,7 @@ class MpExperienceSiriMsg(MpExperience):
s = MpExperienceSiriMsg.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \ s = MpExperienceSiriMsg.JAVA_BIN + " -jar " + os.path.dirname(os.path.abspath(__file__)) + "/siriClient.jar " + \
self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \ self.mpConfig.getServerIP() + " 8080 " + self.run_time + " " + self.query_size + " " + self.response_size + \
" " + self.delay_query_response + " " + self.min_payload_size + " " + \ " " + self.delay_query_response + " " + self.min_payload_size + " " + \
self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + \ self.max_payload_size + " " + self.interval_time_ms + " " + self.buffer_size + " " + self.burst_size + " " + self.interval_burst_time_ms + \
" >" + MpExperienceSiriMsg.CLIENT_LOG + " 2>" + MpExperienceSiriMsg.CLIENT_ERR " >" + MpExperienceSiriMsg.CLIENT_LOG + " 2>" + MpExperienceSiriMsg.CLIENT_ERR
print(s) print(s)
return s return s

View File

@ -48,6 +48,8 @@ class MpParamXp(MpParam):
SIRIMAXPAYLOADSIZE = "siriMaxPayloadSize" SIRIMAXPAYLOADSIZE = "siriMaxPayloadSize"
SIRIINTERVALTIMEMS = "siriIntervalTimeMs" SIRIINTERVALTIMEMS = "siriIntervalTimeMs"
SIRIBUFFERSIZE = "siriBufferSize" SIRIBUFFERSIZE = "siriBufferSize"
SIRIBURSTSIZE = "siriBurstSize"
SIRIINTERVALBURSTTIMEMS = "siriIntervalBurstTimeMs"
VLCFILE = "vlcFile" VLCFILE = "vlcFile"
VLCTIME = "vlcTime" VLCTIME = "vlcTime"
DITGKBYTES = "ditgKBytes" DITGKBYTES = "ditgKBytes"
@ -138,6 +140,8 @@ class MpParamXp(MpParam):
defaultValue[SIRIMAXPAYLOADSIZE] = "500" defaultValue[SIRIMAXPAYLOADSIZE] = "500"
defaultValue[SIRIINTERVALTIMEMS] = "333" defaultValue[SIRIINTERVALTIMEMS] = "333"
defaultValue[SIRIBUFFERSIZE] = "9" defaultValue[SIRIBUFFERSIZE] = "9"
defaultValue[SIRIBURSTSIZE] = "0"
defaultValue[SIRIINTERVALBURSTTIMEMS] = "0"
defaultValue[VLCFILE] = "bunny_ibmff_360.mpd" defaultValue[VLCFILE] = "bunny_ibmff_360.mpd"
defaultValue[VLCTIME] = "0" defaultValue[VLCTIME] = "0"
defaultValue[DITGKBYTES] = "10000" defaultValue[DITGKBYTES] = "10000"

Binary file not shown.