0

I'm trying to build a simulator that simulates hundreds of users on a web application.

I'm usually using Microsoft Load Simulator and WebTests. If the webpage has some complexity I'm using WebTest plugins to adjust it correctly.

Now, I have a web page that does tons of ajax requests per url I visit, the ajax requests are based on complex calculations done in the browser. If I'll just browse to the url and record all the traffic, even after I'll make some dynamic parameters I still won't be able to simulate it correctly since there may be different requests that could be sent based on the server previous responses.

If I'll build a webtest that simulates it correctly it will require a lot of webtest plugins and will be impossible to maintaince since the site will probably change each few weeks.

I thought about using selenium but if I'll use it I will need far too much hardware resources to run hundreds of users.

I came up with the idea of using a headless browser such as PhantomJs, SimpleBrowser, HtmlUnit and etc. Both SimpleBrowser and HtmlUnit does not support executing javascript/AJAX which makes them useless for me.

I tried using PhantomJs but I had a problem with running multiple users in parallel since the localStorage is the same for all so it keeps the same session for all so I can't simulate different users in parallel.

Does anyone had any experience with loadtesting complex ajax web applications?

I will Love you for eternity if you would help me with this issue.

P.S I'm usually coding in C# but I'm open for new languages\technologies.

Pro
  • 1
  • 3
  • (1) HtmlUnit does support JavaScript, just not all of it. (2) PhantomJS has one cache per process. Are you saying that you're running the simulation for multiple users in a single PhantomJS instance? (I don't have any experience load testing, though.) – Artjom B. Dec 02 '15 at 14:07
  • Yeah, I know it does support JS , that's why added "/AJAX", cuz it doesn't support ajax and this is more important.. About PhantomJS, even when I quit the proccess, it's chace is still saved. I used selenium to automate my site with ChromeDriver and it works great- also running multiple users in parallel , but when I switched to PhantomJs, it seems like it's cache is still saved (It keeps me logged in to the site.. etc..) – Pro Dec 02 '15 at 14:14
  • This is strange. Only localStorage is persisted between multiple PhantomJS processes, but cache is usually private to a single process. This would change is PhantomJS is run with the `--disk-cache=true` commandline option. – Artjom B. Dec 02 '15 at 14:23
  • You are right.after a check I found that the sessionId is saved in the localStorage. Is there a way to run multiple PhantomJs with seperate localStorage for each – Pro Dec 02 '15 at 15:04
  • No, there isn't, AFAIK. – Artjom B. Dec 02 '15 at 15:07
  • Running each PhantomJS instance as a separate user should give it its own everything. – Kalle Jun 02 '16 at 07:21

2 Answers2

0

Using Selenium for performance testing is not logical. I recommend you to use Locust for real performance testing. For getting and using a dynamic data you can check the this answer. You need to write simple Python script for simulating users.

Community
  • 1
  • 1
Mesut GUNES
  • 7,089
  • 2
  • 32
  • 49
  • 2
    The solution you suggested "Locust" seems like a similar tool to the tool I mensioned (Microsoft Load Simulator-in visual studio) Its similar because they both use http requests.. But I need javascript execution to run my client's logic so I won't have to suplicate my client side http requests logic code to the load simulator every time.. – Pro Dec 02 '15 at 18:04
  • @Pro This is your words "P.S I'm usually coding in C# but I'm open for new languages\technologies" – Mesut GUNES Dec 02 '15 at 18:07
  • Sorry, when I click 'enter' instead of making a new row it sended the message.. I already have selenium tests for my site so load testing them would be easy, the problem is the amount of resources needed to do it. That's why I was looking for a headless browser like PhantomJs but it seems like neither of them can support js execution and parallel users correctly.. :/ yeah I am open for new technologies but I don't see how Locust differs from VisualStudio's load and performance test.. My problem is that I'll have to update the http requests logic new version of the client side. – Pro Dec 02 '15 at 18:13
  • @Pro no idea about the tool you are using but automation and performance are two diffrent concept. Even you open a headless browser you assign it to a driver to manege it. It is also expensive. With locust or most of the performance tools enable you create dynamic data, header and cookies. – Mesut GUNES Dec 02 '15 at 20:23
  • It is impossible for me to use this kind of test since it doesn't simulate ajax so well + I want to make a simulator that I don't need to maintaince too much. If I will write it by the Record and Replay methodolgy each version of the web app I'll have to check that the tests are still the same as the website responses. I can afford running Hundreds of Headless browsers so if there isn't a disadvantage about it then there is no problem. – Pro Dec 02 '15 at 22:22
  • @Pro Locust is very simple and very powerful since it uses Python which means with Locust you can do everything that you can do with python. For ajax see this: https://github.com/locustio/locust/issues/219. and Yes performance testing is not that easy to record and replay it. You may look at selenium extension of Jmeter which gives you a ugly java interface. – Mesut GUNES Dec 03 '15 at 06:09
0

I am investigating www.loadbooster.com that can import a Selenium script and run headless borwoser with PhantomJS to run the script as a load test. It is still work in progress for me, so I cant comment on how good it is, but you could investigate it.

Ash
  • 1,614
  • 1
  • 10
  • 6