Friday, January 20, 2012

JMeter Calculation

3 comments:


Throughput Calculation In JMeter

  1. select a label name in result.xml which is generated by jmeter
  2. search the min (timestamp(ts)) for corresponding labels
  3. search the max (timestamp (ts)  + elapsed time (t)) for  corresponding labels.
  4. calculate the difference between max and min 
  5. calculate Throughput= (number of samples/ difference between max and min) * 1000  



  1. select a label name(Register) in result.xml which is generated by jmeter
  2. search the min (timestamp(ts)) 1327038233281 in result.xml
  3. search the max (timestamp (ts)  + elapsed time (t)) 1327038233781 + 47.
  4. calculate the difference between max and min (1327038233828 -  1327038233281  )..  Diff ===> 547
  5. calculate Throughput= (number of samples/ difference between max and min) * 1000 (2/547) ... Result is.. 3.656307129798903107861060329067
  6. Round the Final throughput value.
ThroughPut  = (No of sample / (max(ts + t) - min(ts)) )
Standard Deviation Calculation in JMeter

standard devaiation(SD) =
x = particular label's t(Time)
x_(x bar) = some of all time(T) of specific label / no of samples

No of samples specifies = number of occurrence of a label in xml file(No of hits of a label)

KB/SEC Calculation in JMeter

kb/sec = (avg bytes /1024) * through put

Avg bytes = avg bytes of specific label bytes (by).

Total Calculation in JMeter

When calculating total row values for jmeter we should not consider labels. Instead of that we have consider the whole xml file as data and we have to use the above formula to calculate it. Don't consider labels. In whole xml take max ts value and min ts and proceed and no of samples
(Total occurrence of all labels). for throughput.


For Standard deviation don't consider labels. Take whole xml.

xBar(x_) = sumOfTime(t) / totalNoOfSamples;
for (Integer time(t) : allTimes) {
    // for each time we have to find this value
    sumOfMean += Math.pow(time(t) - xBar(x_), 2);
}


Final calculation : 

 sqrt(sumOfMean / getNoOfSamples());

For KB/SEC calculation  , don't consider labels , take all by values in xml file.

For Total row calculation formula is same but the only difference is , don't consider labels. Otherwise same.

Happy Coding :).

--
Thanks.
Chelladurai.

Regards,
Kaleeswaran.S

Read More

Friday, December 30, 2011

Starting with JPDA enabled Tomcat within Eclipse for Maven project

No comments:
Starting with JPDA enabled Tomcat within Eclipse for Maven project

Step 1 :  Build the projects and place the war files in tomcat webapps folder.

Step 2 : Start  your tomcat server.

Step 2 : Open the Eclipse , Specify java home in installed jres in eclipse(eclipse - > windows - > preferences)

Step 3 : Open Debug configuration in Eclipse 

Step 4 : Select Connect tab select the project. Specify host as localhost and port as 8000(Which is specified in tomcat(catalina.bat jpda port 8000) ).

Step 5 : Select Source tab, select all the project folder you want.  

Step 6 : Click debug.

Step 7 : Place break-points in code..

Thats Done....










Debug IT.... 

Thanks,

Arun..
Read More

Friday, October 21, 2011

Add Twitter to your webpage , Display Tweets using Java script

No comments:
Hi, Everyone like to display tweets on their webpage. Twitter api  provides the way to do it..
All you need to do is trigger a event in java script which retrives last 20 tweets. We can get tweets in two format xml and Json.. I prefer JSON which is very easy to use. I have used JSON. when page is loaed $.getJSON method is called and parameter is passed. i am parsing the return json data and appending it to the div element which shows all tweets.

But the problem is you can not refresh the page many times . i think 3 or 4 .. if u refresh more than 3 to 4 times. .Twitter server denies your request. You have to wait for some more time(Minimum 5 min. Not sure).. To avoid these kind of problem my solution would be to store values in cookies or in session... 

 <script type="text/javascript">
$(document).ready(function() {
    $.getJSON("http://twitter.com/statuses/user_timeline/kaleeswaran14.json?callback=?", function(data) {
    for(i in data) {
        $('.scroll-hold').append('<div class="blog_twit"><div class="blog_twit_img"><img src="images/right1.png" border="0" alt="image"></div><div class="blog_twit_txt">'+data[i].text+'</div><div class="blog_twit_boder">'+parseTwitterDate(data[i].created_at)+'</div></div>');
    }               
    });
    });

function parseTwitterDate($stamp)
{       
    var date = $stamp;   
    return date.substr(0,16);
}
</script>


--
Thank you.


Regards,
Kaleeswaran.S

Read More

Wednesday, October 12, 2011

Maven Hectic Work...

No comments:
I am developing web applications using maven... As a developer cleaning,building, stoping tomcat, placing war file, starting tomcat and opening browser takes 50% time in  a day.. Mostly coding wont take that much time. Each time ill make change i have to build,copy etc...

I love developing But these kind of hectic work make me feel lazy...

Hurray.. !!!

I found a solution for this... BATCH file..

I created a batch file which does all my work.. i am free.. What i have to do is .. Type coding Run the batch file and see the changes.. Sounds nice..

My code is...


@ECHO off
cls
:start
ECHO.
ECHO 1. Install
ProjName1
ECHO 2. Buid ProjName2
ECHO 3. Buid ProjName3
ECHO 4. Delete Files In Tomcat
ECHO 5. Copy Files To tomcat
ECHO 6. Start tomcat
ECHO 7. Stop tomcat
ECHO 8. Run
ProjName
ECHO 9. Exit
set /p choice=Type your choice.
if not '%choice%'=='' set choice=%choice:~0,1%
if '%choice%'=='1' goto
ProjName1
if '%choice%'=='2' goto ProjName2
if '%choice%'=='3' goto ProjName3
if '%choice%'=='4' goto delete
if '%choice%'=='5' goto copy
if '%choice%'=='6' goto runtomcat
if '%choice%'=='7' goto stoptomcat
if '%choice%'=='8' goto Run
if '%choice%'=='9' goto end
ECHO "%choice%" is not valid please try again
ECHO.
goto start


:
ProjName1
ECHO Going to Build and Install ProjName
ECHO Please Wait..............
CD /D D:\
ProjName\trunk\ProjName
call mvn clean install

ECHO Shall i proceed ???
PAUSE

goto start


:
ProjName2
ECHO Going to Build ProjName
ECHO Please Wait..............
CD /D D:\
ProjName\trunk\ProjName
call mvn clean package

ECHO Shall i proceed ???
PAUSE

goto start


:
ProjName3
ECHO Going to Build ProjName
ECHO Please Wait..............
CD /D D:\
ProjName\trunk\server\ProjName
call mvn clean package

ECHO Shall i proceed ???
PAUSE


goto start

:delete

ECHO Going to Delete Existing files in tomcat
ECHO Please Wait..............

DEL C:\apache-tomcat-7.0.14\apache-tomcat-7.0.14\webapps\*.war
rmdir /s /q "C:\apache-tomcat-7.0.14\apache-tomcat-7.0.14\webapps\
ProjName"
rmdir /s /q "C:\apache-tomcat-7.0.14\apache-tomcat-7.0.14\webapps\
ProjName"
goto start

:copy
ECHO Going to Copy war files to tomcat
xcopy /s D:\ProjName\trunk\server\engine\target\ProjName.war C:\apache-tomcat-7.0.14\webapps
xcopy /s D:\
ProjName\trunk\framework\target\ProjName.war C:\apache-tomcat-7.0.14\webapps
goto start

:runtomcat

ECHO Going to start tomcat
call "C:\apache-tomcat-7.0.14\bin\startup.bat"
goto start

:stoptomcat

ECHO Going to stop tomcat
call "C:\apache-tomcat-7.0.14\bin\shutdown.bat"
goto start


:run

ECHO Going to open firefox browser with URL
start /d "C:\Program Files\Mozilla Firefox" firefox.exe http://localhost:8080/ProjName
goto end

:end
pause
exit


Happy Coding :)

Read More

Thursday, October 6, 2011

How to Read a XML file From Nexus repository

No comments:
Here I am using the jsersey client library to read xml file from nexus

Specify the URL of the XML

        String BASE_URI = "http://localhost:8080/Nexus";
        WebResource r = c.resource(BASE_URI);
        ClientResponse response = r.get(ClientResponse.class);
        System.out.println( response.getStatus() );
        System.out.println( response.getHeaders().get("Content-Type") );
        String   = response.getEntity(String.class);
        System.out.println(entity);

Thats Done.. It ll display the All XML contents.. 


--
Thank you.


Regards,
Kaleeswaran.S

Read More