Hi all
I'm looking for some answers and opinions in relation to using BeanShell
functions and the efficiency of JMeter scripts calling them.
I'm load testing a calendar application and need to generate and
manipulate random dates in the iCal DTSTAMP format i.e. 20070910T090800Z
for the time of writing this mail.
I found that for some of the more complex operations such as generating
random dates within a given timeframe and then adding hours, days or
weeks onto these it was very cumbersome to do this using JMeter alone so
I settled on BeanShell functions using the Calendar class to manipulate
dates and the following functions to convert the dates:
// Convert Java Calendar object to iCal timestamp
String calendarToTS(Calendar cal) {
String ret = String.format("%1$tY%1$tm%1$tdT%1$tH%1$tM%1$tSZ", new
Object[] {cal});
return ret;
}
// Convert iCal timestamp to Java Calendar object
Calendar tsToCalendar(String ts) {
Calendar ret = Calendar.getInstance();
ret.set(Calendar.YEAR, new Integer(ts.substring(0,4)));
ret.set(Calendar.MONTH, new Integer(ts.substring(4,6)) - 1);
ret.set(Calendar.DATE, new Integer(ts.substring(6,8)));
ret.set(Calendar.HOUR_OF_DAY, new Integer(ts.substring(9,11)));
ret.set(Calendar.MINUTE, new Integer(ts.substring(11,13)));
ret.set(Calendar.SECOND, new Integer(ts.substring(13,15)));
return ret;
}
When I run a load test the jmeter process uses about 90% of the cpu on a
4 CPU solaris box which would normally only see about 20% load with an
equivalent script which doesn't call any BeanShell functions.
Does anyone have any suggestions for a more efficient way off accessing
Java functionality from JMeter.
Thanks, Stuart
ps - apologies for the half message sent by mistake beforehand.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]