Leo
Leo

Reputation: 6570

How to stress test ajaxterm(J) javascript heartbeat behavior?

I am using AjaxtermJ (java port of Ajaxterm). Ajaxterm client-side has a javascript routine that sends heartbeats every second to the server (no matter the user has typed anything or not).

I want to stress test it to fine tune the server, but I haven't found an easy way to emulate this behavior.

HtmlUnit has some headless javascript support but not enough (as far as I've tried) to emulate this kind of thing. I wonder if there are modern and powerful tools to make this easier, since nowadays there are many javascript-rich-clients out there.

Of course, I can write my own java code for JMeter and start a thread that sends a heartbeat every second, but before trying such an approach, I'd like to know if there is an easier way.

ps. I am not asking for a software recommendation here (I know the rules), although some framework may be the answer. But my question is specifically how can I emulate this behavior in a stress test.

Upvotes: 0

Views: 98

Answers (1)

Vadim Kleyzit
Vadim Kleyzit

Reputation: 812

It looks like in your application, every client imposes dual impact on the Web server: user typing action (A) and the heartbeats (B). To stress test it you need to emulate two corresponding test cases executed asynchronously. Any reasonably complete load testing tool which supports multiple test cases, pacing and easy test case recording / editing, should handle this scenario. Here's how I would implements this test in our tool called StresStimulus:

  1. Record user action to create test case A.
  2. Clone test case A to create test case B.
  3. Delete from the test case A heartbeat requests.
  4. Delete from the test case B, all requests, except a single heartbeat.
  5. For test case B set "delay after the test case" property to "Pacing" and set the minimum duration of the test case replay = 1 second, as shown on the screenshot.

set pacing to 1 second to emulate heartbeats

After that, you can tailor load according to your stress test requirements. Just make sure that the test cases A and B are executed with the same number of virtual users. For example, to emulate a step load from 1 to 100 virtual users, create a step load from 2 to 200 VUs and assign 50% of the VUs to each of the test cases. Test case B will properly emulate heartbeats for any number of VUs, executing user typing in test case A.

Upvotes: 2

Related Questions