How to load test your website?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

How to load test your website?

Herbert König
Hi Aida/Web,

what to use to load test a Website?
I want to log in many users from several browsers and use my site.
Problem is, each logged in user gets a new model with new URL's

I might go for a macro recorder which just replays HTTP requests and
change my app to produce predictable URL's.

Any ideas and insights welcome.


Cheers,

Herbert                          mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to load test your website?

Janko Mivšek
Hi Herbert,

On 06. 07. 2012 14:50, Herbert König wrote:

> what to use to load test a Website?

By using ab (ApacheBech) testing tool you can quite nicelly stress test
your Aida apps.

Example and few suggestions:

1. 1000 requests, 10 concurrent, keep alive connections, with cookie set
so that only one session will be created:

ab2 -n 1000 -c 10 -k -C 'aida9357=123456' \
  http://demo.aidaweb.si/admin?view=login

2. To simulate a specific user and some of his specific pages, I'd find
his cookie and make a script to repeatably call above command, for 1
request, and for each page in sequence. To simulate many users, you can
run many such scribts in parallel, each with a different cookie.

3. Selenium is quite popular testing tool among Smalltalkers too, maybe
it is an opportunity to build a support (or at least write a small
tutorial) for Selenium testing Aida apps?

Best regards
Janko



> I want to log in many users from several browsers and use my site.
> Problem is, each logged in user gets a new model with new URL's
>
> I might go for a macro recorder which just replays HTTP requests and
> change my app to produce predictable URL's.
>
> Any ideas and insights welcome.
>
>
> Cheers,
>
> Herbert                          mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to load test your website?

bobcalco
Herbert/Janko:

On Sat, Jul 7, 2012 at 8:09 AM, Janko Mivšek <[hidden email]> wrote:
Hi Herbert,

On 06. 07. 2012 14:50, Herbert König wrote:

> what to use to load test a Website?

By using ab (ApacheBech) testing tool you can quite nicelly stress test
your Aida apps.

Example and few suggestions:

1. 1000 requests, 10 concurrent, keep alive connections, with cookie set
so that only one session will be created:

ab2 -n 1000 -c 10 -k -C 'aida9357=123456' \
  http://demo.aidaweb.si/admin?view=login

2. To simulate a specific user and some of his specific pages, I'd find
his cookie and make a script to repeatably call above command, for 1
request, and for each page in sequence. To simulate many users, you can
run many such scribts in parallel, each with a different cookie.

3. Selenium is quite popular testing tool among Smalltalkers too, maybe
it is an opportunity to build a support (or at least write a small
tutorial) for Selenium testing Aida apps?


If you really want to smash your server to pieces, consider the Erlang-based Tsung load test tool:


Erlang's lightweight threading model allows the tool to create a significantly bigger load than tools that use OS-threads to simulate concurrent virtual users. I would say that this is more appropriate for testing big production servers but the nice thing is it doesn't require a hardware beast from which to run the tests.

Thanks for the heads-up about Selenium. Will look into it.

- Bob
 
Best regards
Janko



> I want to log in many users from several browsers and use my site.
> Problem is, each logged in user gets a new model with new URL's
>
> I might go for a macro recorder which just replays HTTP requests and
> change my app to produce predictable URL's.
>
> Any ideas and insights welcome.
>
>
> Cheers,
>
> Herbert                          mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida



--
Bob Calco
 
813-520-2891 (mobile)


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: How to load test your website?

Herbert König
In reply to this post by Janko Mivšek
Hi Janko, Robert,

thanks for the pointers.

After skimming the manual for ApacheBench and having read through the
Tsung features it seems Selenium IDE is closest to what I need.

With the others it seems easy to test static websites, but I need to
test a highly Ajaxified site.

Like enter points to build up a graph, press buttons to start and
display calculations, upload and download data .... interactions needed
when using a spreadsheet or an ERP system. I was thinking of a Firefox
plugin.

Started a first test:
Selenium looks promising but a lot of manual modification to the
recorded test scripts is needed. click --> clickAndWait, type -->
typeAndWait ....

Selenium relies on id's to click on and enter data. So whenever I will
add one single input all subsequent I id's will have a higher number and
I will have to recreate the test scripts. Maybe I'll need to manually
set all my id's (and manually keep track of them) to avoid this.

Ajax posting onBlur seems not to be caught properly in all use cases (I
assume I have to read more docs to make it work).

Seems there is no free lunch .... :-)

Anyway, family business now, I'll keep you posted.

Cheers,

Herbert



_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Testing Ajaxified Aida Apps with Selenium was:Re[2]: How to load test your website?

Herbert König
In reply to this post by Janko Mivšek
Hi Janko, Robert,

JM> 3. Selenium is quite popular testing tool among Smalltalkers too, maybe
JM> it is an opportunity to build a support (or at least write a small
JM> tutorial) for Selenium testing Aida apps?

testing AIDA apps using a lot of Ajax is tedious with Selenium. At
least compared to my expectations.

The easy part:
Install Selenium ide from the Selenium website into firefox.
Press Crtl Alt S to fire up the Selenium Dialog.
Top right press the record button (if it's not already pressed by
default).
Do your thing in your web application and see the Selenium script fill
in their dialogue.
   I start via a login (even for guests). This gives every user a
   fresh model with its app. In the model I upload some data to have
   something to play with. This ensures repeatability compared to
   having some data in a database which may be changed over time and
   will break your tests. Then I recorded about a quarter of an hour's
   work in the app. Mainly browsing the data (which gives the highest
   server load), adding some data, modifying some and have the model
   do some calculations (the main purpose of the app). Then I download
   the modified data.
When done press the record button of the Selenium dialog again and
save the script via the file menu.

Now comes the tedious part:
Click on the first line of the script and press the run button. The
Selenium website has real good documentation. Logging in, uploading
data, clicking all tabs (ViewTabs) on my App works just fine.

For all these Selenium recorded a ClickAndWait command because they
all refresh the whole page.

Clicking on the first element of a WebGrid which Ajax updates half of
the page works fine, clicking on the second element of the same
WebGrid fails because of "Element not found" error and the script
stops. In this case Selenium recorded a Click. So I thought I just
replace the Click with ClickAnd wait.. Well no good.

My click fires three of Prototypes Ajax.Updater's. You cannot just
WaitForElementPresent of the next element you want to click on, you
have to WaitForElementPresent of the last element updated by the last
Ajax.Updater. I identified these via Firebug. Once you know which
element this is Selenium is helpful. You set a breakpoint on the fatal
click, run the script to the halt. Then in the web browser right click
on the element you want to wait for and select the
WaitForElementPresent from the context Menu which inserts the command
with the right parameters into the script. Great feature! Other than
my first assessment in an earlier post you want your web elements id's
created automatically, otherwise your waitForElementPresent will find
the old element with the same id and your click will fail again.

The next problem arises when entering data into inputs. Mine post to
the server on blur. So after each Selenium "Type..." you will have to
insert a fireEvent blur command. But the post request fired by the
onBlur event has to be processed by the server (usually changing an
ivar of the model). Selenium can be faster than that if you type into
several input fields and then click a button to change the data. So
every now and then you will want to waitForValuePresent to check that
the change has been accepted. Also I sometimes focused some elements
just to give Aida time to process some requests which have no reply
making a change in the browser. Al in all Selenium is very helpful
just like you expect from a modern IDE just a bit different, but
Smalltalkers should be tolerant against being different :-)).

So in the course of these my 131 lines script blew up to 500 lines.

As selenium saves its script as HTML I just attach it, you can open it
in any web browser. Type, Click, ClickAndWait and Open have been
recorded by Selenium the rest is from me.

Regarding writing a Smalltalk support for Selenium like many lanuages
have: IMO we don't want that. You add one element to your page and
everything will fail, because all the subsequent id's have changed and
you redo the whole script. And running Aida and the browser on a 4
core machine Selenium can use around 30% of Aida. So running two or
three browsers will fully load Aida. I run Aida on an old machine and
the browser(s) on newer machines.

What we want for Aida (tell me if this is a stupid idea):
In 2009 during the onClickDo:andUpdateMany: discussions here I
captured every HTTPRequest and every HTTPResponse of an interaction
with my webapp to see if the correct Ajax requests were sent and if
they got the correct responses.

One would have to save this collection of HTTPRequests and ..Responses
(JSON comes to mind) replay the requests to the server and collect all
the responses and compare them in whatever meaningful way to the
expected responses. This will save us all the manual verification we
need to do with Selenium. If the webapp changes just record the next
interactive session and be done.

Only thing I don't know is how to setup a Swazoo client to resend the
requests and collect the responses.

Janko, if you find anything useful in this, edit it and put it on Aida
site.

Cheers,

Herbert                            mailto:[hidden email]
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

Elling131Commands.html (24K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Testing Ajaxified Aida Apps with Selenium

Janko Mivšek
Hi Herbert,

It seems that Selenium has a problem because ids of elementes inside
updated element are changing and it lost the 'thread'. Specially WebGrid
filter field, they are recreated with new ids after each search, because
a whole grid is updated.

How to put the  filter row outside the whole grid is the question. It
will namely be desirable not to update filters, but they are part of a
whole grid table which column widths are automatically adjusted at every
update ..

Best regards
Janko

Dne 13. 07. 2012 20:58, piše Herbert König:

> Hi Janko, Robert,
>
> JM> 3. Selenium is quite popular testing tool among Smalltalkers too, maybe
> JM> it is an opportunity to build a support (or at least write a small
> JM> tutorial) for Selenium testing Aida apps?
>
> testing AIDA apps using a lot of Ajax is tedious with Selenium. At
> least compared to my expectations.
>
> The easy part:
> Install Selenium ide from the Selenium website into firefox.
> Press Crtl Alt S to fire up the Selenium Dialog.
> Top right press the record button (if it's not already pressed by
> default).
> Do your thing in your web application and see the Selenium script fill
> in their dialogue.
>    I start via a login (even for guests). This gives every user a
>    fresh model with its app. In the model I upload some data to have
>    something to play with. This ensures repeatability compared to
>    having some data in a database which may be changed over time and
>    will break your tests. Then I recorded about a quarter of an hour's
>    work in the app. Mainly browsing the data (which gives the highest
>    server load), adding some data, modifying some and have the model
>    do some calculations (the main purpose of the app). Then I download
>    the modified data.
> When done press the record button of the Selenium dialog again and
> save the script via the file menu.
>
> Now comes the tedious part:
> Click on the first line of the script and press the run button. The
> Selenium website has real good documentation. Logging in, uploading
> data, clicking all tabs (ViewTabs) on my App works just fine.
>
> For all these Selenium recorded a ClickAndWait command because they
> all refresh the whole page.
>
> Clicking on the first element of a WebGrid which Ajax updates half of
> the page works fine, clicking on the second element of the same
> WebGrid fails because of "Element not found" error and the script
> stops. In this case Selenium recorded a Click. So I thought I just
> replace the Click with ClickAnd wait.. Well no good.
>
> My click fires three of Prototypes Ajax.Updater's. You cannot just
> WaitForElementPresent of the next element you want to click on, you
> have to WaitForElementPresent of the last element updated by the last
> Ajax.Updater. I identified these via Firebug. Once you know which
> element this is Selenium is helpful. You set a breakpoint on the fatal
> click, run the script to the halt. Then in the web browser right click
> on the element you want to wait for and select the
> WaitForElementPresent from the context Menu which inserts the command
> with the right parameters into the script. Great feature! Other than
> my first assessment in an earlier post you want your web elements id's
> created automatically, otherwise your waitForElementPresent will find
> the old element with the same id and your click will fail again.
>
> The next problem arises when entering data into inputs. Mine post to
> the server on blur. So after each Selenium "Type..." you will have to
> insert a fireEvent blur command. But the post request fired by the
> onBlur event has to be processed by the server (usually changing an
> ivar of the model). Selenium can be faster than that if you type into
> several input fields and then click a button to change the data. So
> every now and then you will want to waitForValuePresent to check that
> the change has been accepted. Also I sometimes focused some elements
> just to give Aida time to process some requests which have no reply
> making a change in the browser. Al in all Selenium is very helpful
> just like you expect from a modern IDE just a bit different, but
> Smalltalkers should be tolerant against being different :-)).
>
> So in the course of these my 131 lines script blew up to 500 lines.
>
> As selenium saves its script as HTML I just attach it, you can open it
> in any web browser. Type, Click, ClickAndWait and Open have been
> recorded by Selenium the rest is from me.
>
> Regarding writing a Smalltalk support for Selenium like many lanuages
> have: IMO we don't want that. You add one element to your page and
> everything will fail, because all the subsequent id's have changed and
> you redo the whole script. And running Aida and the browser on a 4
> core machine Selenium can use around 30% of Aida. So running two or
> three browsers will fully load Aida. I run Aida on an old machine and
> the browser(s) on newer machines.
>
> What we want for Aida (tell me if this is a stupid idea):
> In 2009 during the onClickDo:andUpdateMany: discussions here I
> captured every HTTPRequest and every HTTPResponse of an interaction
> with my webapp to see if the correct Ajax requests were sent and if
> they got the correct responses.
>
> One would have to save this collection of HTTPRequests and ..Responses
> (JSON comes to mind) replay the requests to the server and collect all
> the responses and compare them in whatever meaningful way to the
> expected responses. This will save us all the manual verification we
> need to do with Selenium. If the webapp changes just record the next
> interactive session and be done.
>
> Only thing I don't know is how to setup a Swazoo client to resend the
> requests and collect the responses.
>
> Janko, if you find anything useful in this, edit it and put it on Aida
> site.
>
> Cheers,
>
> Herbert                            mailto:[hidden email]
>
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>

--
Janko Mivšek
Svetovalec za informatiko
Eranova d.o.o.
Ljubljana, Slovenija
www.eranova.si
tel:  01 514 22 55
faks: 01 514 22 56
gsm: 031 674 565


_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Testing Ajaxified Aida Apps with Selenium

Herbert König
Am 23.07.2012 12:15, schrieb Janko Mivšek:

Hi Janko,

yes I think we don't want selenium because it is a lot of manual work
each time one changes the site. I use it anyway because it helps a lot
but I don't want to write a second selenium script.

So a question:

is there something like a Web client in Swazoo?

Because I've dusted off my recording of HTTP requests and responses and
can save them to disk.  I'm hesitant to just fire the recorded requests
at Aida from within the image.  I want to fire them from a second image
and compare the responses to the recorded HTTP responses.

Squeak has a WebClient package but using that wouldn't be portable.

Cheers,

Herbert

> Hi Herbert,
>
> It seems that Selenium has a problem because ids of elementes inside
> updated element are changing and it lost the 'thread'. Specially WebGrid
> filter field, they are recreated with new ids after each search, because
> a whole grid is updated.
>
> How to put the  filter row outside the whole grid is the question. It
> will namely be desirable not to update filters, but they are part of a
> whole grid table which column widths are automatically adjusted at every
> update ..
>
> Best regards
> Janko
>
> Dne 13. 07. 2012 20:58, piše Herbert König:
>> Hi Janko, Robert,
>>
>> JM> 3. Selenium is quite popular testing tool among Smalltalkers too, maybe
>> JM> it is an opportunity to build a support (or at least write a small
>> JM> tutorial) for Selenium testing Aida apps?
>>
>> testing AIDA apps using a lot of Ajax is tedious with Selenium. At
>> least compared to my expectations.
>>
>> The easy part:
>> Install Selenium ide from the Selenium website into firefox.
>> Press Crtl Alt S to fire up the Selenium Dialog.
>> Top right press the record button (if it's not already pressed by
>> default).
>> Do your thing in your web application and see the Selenium script fill
>> in their dialogue.
>>     I start via a login (even for guests). This gives every user a
>>     fresh model with its app. In the model I upload some data to have
>>     something to play with. This ensures repeatability compared to
>>     having some data in a database which may be changed over time and
>>     will break your tests. Then I recorded about a quarter of an hour's
>>     work in the app. Mainly browsing the data (which gives the highest
>>     server load), adding some data, modifying some and have the model
>>     do some calculations (the main purpose of the app). Then I download
>>     the modified data.
>> When done press the record button of the Selenium dialog again and
>> save the script via the file menu.
>>
>> Now comes the tedious part:
>> Click on the first line of the script and press the run button. The
>> Selenium website has real good documentation. Logging in, uploading
>> data, clicking all tabs (ViewTabs) on my App works just fine.
>>
>> For all these Selenium recorded a ClickAndWait command because they
>> all refresh the whole page.
>>
>> Clicking on the first element of a WebGrid which Ajax updates half of
>> the page works fine, clicking on the second element of the same
>> WebGrid fails because of "Element not found" error and the script
>> stops. In this case Selenium recorded a Click. So I thought I just
>> replace the Click with ClickAnd wait.. Well no good.
>>
>> My click fires three of Prototypes Ajax.Updater's. You cannot just
>> WaitForElementPresent of the next element you want to click on, you
>> have to WaitForElementPresent of the last element updated by the last
>> Ajax.Updater. I identified these via Firebug. Once you know which
>> element this is Selenium is helpful. You set a breakpoint on the fatal
>> click, run the script to the halt. Then in the web browser right click
>> on the element you want to wait for and select the
>> WaitForElementPresent from the context Menu which inserts the command
>> with the right parameters into the script. Great feature! Other than
>> my first assessment in an earlier post you want your web elements id's
>> created automatically, otherwise your waitForElementPresent will find
>> the old element with the same id and your click will fail again.
>>
>> The next problem arises when entering data into inputs. Mine post to
>> the server on blur. So after each Selenium "Type..." you will have to
>> insert a fireEvent blur command. But the post request fired by the
>> onBlur event has to be processed by the server (usually changing an
>> ivar of the model). Selenium can be faster than that if you type into
>> several input fields and then click a button to change the data. So
>> every now and then you will want to waitForValuePresent to check that
>> the change has been accepted. Also I sometimes focused some elements
>> just to give Aida time to process some requests which have no reply
>> making a change in the browser. Al in all Selenium is very helpful
>> just like you expect from a modern IDE just a bit different, but
>> Smalltalkers should be tolerant against being different :-)).
>>
>> So in the course of these my 131 lines script blew up to 500 lines.
>>
>> As selenium saves its script as HTML I just attach it, you can open it
>> in any web browser. Type, Click, ClickAndWait and Open have been
>> recorded by Selenium the rest is from me.
>>
>> Regarding writing a Smalltalk support for Selenium like many lanuages
>> have: IMO we don't want that. You add one element to your page and
>> everything will fail, because all the subsequent id's have changed and
>> you redo the whole script. And running Aida and the browser on a 4
>> core machine Selenium can use around 30% of Aida. So running two or
>> three browsers will fully load Aida. I run Aida on an old machine and
>> the browser(s) on newer machines.
>>
>> What we want for Aida (tell me if this is a stupid idea):
>> In 2009 during the onClickDo:andUpdateMany: discussions here I
>> captured every HTTPRequest and every HTTPResponse of an interaction
>> with my webapp to see if the correct Ajax requests were sent and if
>> they got the correct responses.
>>
>> One would have to save this collection of HTTPRequests and ..Responses
>> (JSON comes to mind) replay the requests to the server and collect all
>> the responses and compare them in whatever meaningful way to the
>> expected responses. This will save us all the manual verification we
>> need to do with Selenium. If the webapp changes just record the next
>> interactive session and be done.
>>
>> Only thing I don't know is how to setup a Swazoo client to resend the
>> requests and collect the responses.
>>
>> Janko, if you find anything useful in this, edit it and put it on Aida
>> site.
>>
>> Cheers,
>>
>> Herbert                            mailto:[hidden email]
>>
>>
>>
>> _______________________________________________
>> Aida mailing list
>> [hidden email]
>> http://lists.aidaweb.si/mailman/listinfo/aida
>>

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida