HtmlUnit in loadtesting

View: New views
3 Messages — Rating Filter:   Alert me  

HtmlUnit in loadtesting

by P H-2 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I have been trying to use HtmlUnit in loadtesting a web service that contains JavaScript -code with AJAX requests. It works fine with a small amount of load, but with a bigger load I get into trouble.

My code is like this:

WebClient webClient = new WebClient();
….
HtmlPage page = webClient.getPage(…);
webClient.waitForBackgroundJavaScript(250000);
Search_some_Html_element();

During a smaller load this works fine, but with a higher load (let's say 50 concurrent threads each using HtmlUnit) the HtmlElements which are loaded after JavaScript -functions are done are not on the HTML-page. It seems like the HTML page is not constructed correctly.

I also tried to replace  webClient.waitForBackgroundJavaScript() with waiting in a loop for the HTML-element to appear on tge page.

while (true) {
        if(search_for_html_element())
                break;
        page.wait(500);
        if(has_time_elapsed())
                break;
}

The result is that the HTML element does not appear on the page even if I wait in this loop for a couple of minutes.

Any idea how to solve this problem?

- Pete

....................................................................
Luukku Plus -paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: HtmlUnit in loadtesting

by Truitt, Brice [USA] :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi P H,

Has the web-app reached its failure point, or maybe close to its failure point? It has been my past experience that websites that reach their terminal load begin to show signs of stress. Maybe the AJAX/Javascript queues are refusing connections, or maybe the website has reached its peak load.

That's how it appears to me.

Thanks
BT


 
-----Original Message-----
From: P H [mailto:ph968@...]
Sent: Monday, October 26, 2009 9:49 AM
To: htmlunit-user@...
Subject: [Htmlunit-user] HtmlUnit in loadtesting

Hi,

I have been trying to use HtmlUnit in loadtesting a web service that contains JavaScript -code with AJAX requests. It works fine with a small amount of load, but with a bigger load I get into trouble.

My code is like this:

WebClient webClient = new WebClient();
..
HtmlPage page = webClient.getPage(.);
webClient.waitForBackgroundJavaScript(250000);
Search_some_Html_element();

During a smaller load this works fine, but with a higher load (let's say 50 concurrent threads each using HtmlUnit) the HtmlElements which are loaded after JavaScript -functions are done are not on the HTML-page. It seems like the HTML page is not constructed correctly.

I also tried to replace  webClient.waitForBackgroundJavaScript() with waiting in a loop for the HTML-element to appear on tge page.

while (true) {
        if(search_for_html_element())
                break;
        page.wait(500);
        if(has_time_elapsed())
                break;
}

The result is that the HTML element does not appear on the page even if I wait in this loop for a couple of minutes.

Any idea how to solve this problem?

- Pete

....................................................................
Luukku Plus -paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

Re: HtmlUnit in loadtesting

by gredler :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Pete,

Nothing jumps out at me, but just a couple of items:

- Make sure you don't share WebClient instances between different threads.
- When you're done with a WebClient, make sure you call closeAllWindows() to avoid memory issues.
- Unless you've changed the WebClient configuration (setThrowExceptionOnFailingStatusCode(boolean)), getting 500 (or similar) responses from the server should trigger Java exceptions on your side.

Other than that, I don't know what to suggest. Maybe your app is resource-intensive enough that you're running into clientside resource limitations (e.g. memory)?

Take care,

Daniel


On Mon, Oct 26, 2009 at 10:57 AM, Truitt, Brice [USA] <truitt_brice@...> wrote:
Hi P H,

Has the web-app reached its failure point, or maybe close to its failure point? It has been my past experience that websites that reach their terminal load begin to show signs of stress. Maybe the AJAX/Javascript queues are refusing connections, or maybe the website has reached its peak load.

That's how it appears to me.

Thanks
BT



-----Original Message-----
From: P H [mailto:ph968@...]
Sent: Monday, October 26, 2009 9:49 AM
To: htmlunit-user@...
Subject: [Htmlunit-user] HtmlUnit in loadtesting

Hi,

I have been trying to use HtmlUnit in loadtesting a web service that contains JavaScript -code with AJAX requests. It works fine with a small amount of load, but with a bigger load I get into trouble.

My code is like this:

WebClient webClient = new WebClient();
..
HtmlPage page = webClient.getPage(.);
webClient.waitForBackgroundJavaScript(250000);
Search_some_Html_element();

During a smaller load this works fine, but with a higher load (let's say 50 concurrent threads each using HtmlUnit) the HtmlElements which are loaded after JavaScript -functions are done are not on the HTML-page. It seems like the HTML page is not constructed correctly.

I also tried to replace  webClient.waitForBackgroundJavaScript() with waiting in a loop for the HTML-element to appear on tge page.

while (true) {
       if(search_for_html_element())
               break;
       page.wait(500);
       if(has_time_elapsed())
               break;
}

The result is that the HTML element does not appear on the page even if I wait in this loop for a couple of minutes.

Any idea how to solve this problem?

- Pete

....................................................................
Luukku Plus -paketilla pääset eroon tila- ja turvallisuusongelmista.
Hanki Luukku Plus ja helpotat elämääsi. http://www.mtv3.fi/luukku

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user



--
Daniel Gredler
http://daniel.gredler.net/

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
Htmlunit-user mailing list
Htmlunit-user@...
https://lists.sourceforge.net/lists/listinfo/htmlunit-user