How to create load test for SSE using jmeter? - jmeter

I am testing rest service which has subscription end point with header(2 key value pairs) values. On sucessful subscription I get 200 ok and soon get data streaming. How can I load test this in Jmeter?

As of current JMeter version 5.2.1 there is no built-in SSE support.
The options are in:
Consider another load testing tool which supports SSE like Gatling
Add SSE support to JMeter by adding a library which supports server sent events like okhttp-eventsource to JMeter Classpath and implement your test scenario using JSR223 Sampler(s) and Groovy language. Check out How to Load Test SSE Services with JMeter article for more information if you decide to stay with JMeter

Related

How integrate Selenium code in JMeter How this is achieve

I create a maven project using selenium web driver in eclipse to automate one web-based application. Here I also used TestNG and the programming language Java. Now I want to integrate this selenium project into JMeter and want to do performance testing so how can I achieve this?
Although it's possible to kick off a TestNG test programmatically from JMeter's JSR223 Sampler using the code like:
TestListenerAdapter tla = new TestListenerAdapter()
TestNG testng = new TestNG()
testng.setTestClasses(new Class[] { YourClassWithTests.class })
testng.addListener(tla)
testng.run()
I don't think you will get the results you're looking for.
The main limitations are:
In general it's not advised to use Selenium for performance testing
You won't get metrics and KPIs like number of concurrent users, connect time, response time, etc.
Test will be very resource intensive as one instance of browser requires 1 CPU core and a couple of gigabytes of RAM so the resource footprint will be immense.
So I would recommend converting your Selenium tests to "pure" JMeter, you can kick off JMeter's HTTP(S) Test Script Recorder and configure your Selenium tests to use JMeter as the proxy, this way JMeter will be able to intercept the relevant HTTP requests and create HTTP Request samplers which are lightweight comparing to the real browsers and this way you will get all the metrics.

OS Sampler V/S HTTP Request Sampler in JMeter

I have to generate load for my performance testing using JMeter. I am having .Net code to send data to IOT hub which we want to use.
I can easily create REST endpoints or executable based on requirement. To integrate with JMeter which Sampler I should prefer OS Sampler or HTTP request Sampler to integrate with existing .Net code.
We will be use distributed testing in JMeter so if we go with REST Endpoints then scaling will be required but scaling is not required in case of executable so I think OS Sampler is better over HTTP request Sampler.
Do you see any concern using OS Sampler over HTTP request Sampler?
Please suggest performance comparison also.
Thanks in advance.
If you have a .NET executable which performs an IOT broker load testing - you don't need JMeter.
If you choosing the way to proceed I would recommend going for HTTP Request samplers as with the OS Process sampler you will have only .NET application execution time while with the HTTP Request samplers you will see:
connect time
latency also known as time to first byte
"pure" response time for each and every HTTP request
ability to correlate increasing load with changing other metrics like throughput, server hits per second, response time, etc. using HTML Reporting Dashboard

My Jmeter Webdriver sampler test is too heavy on my machine. I'm planning to use selenium grid, with selenium grid ,will it make my test more lighter?

My Jmeter Webdriver sampler test is too heavy on my machine. I'm planning to use selenium grid, with selenium grid ,will it make my test more lighter? As of the moment while running my test on gui and non gui mode I'm encountering a web driver timeout , connection timeout, and an out of memory error. Will this approach help?
Have you tried to read WebDriver Sampler's documentation?
Note: It is NOT the intention of this project to replace the HTTP Samplers included in JMeter. Rather it is meant to compliment them by measuring the end user load time.
You should not be creating the main load using WebDriver Samplers, 99.99999% of the virtual users should be simulated on HTTP protocol level, WebDriver Sampler could be used only for specific use cases like OAuth login, checking client side performance, etc.
Check out How to make JMeter behave more like a real browser article to learn how to properly setup JMeter for web applications testing so it would generate the same network footprint as the real user using the real browser.
If your have a form of a strict requirement to use the real browsers - consider switching to Distributed Testing as in case of Selenium Grid you will not be able to collect samplers execution metrics precisely.

Handling SSE requests using Jmeter

I am trying to handle a SSE request which gives response in the form of event stream, but Jmeter is giving error
org.apache.http.ConnectionClosedException: Premature end of chunk coded message body: closing chunk expected
Is there any element to handle such request?
As of latest JMeter version (JMeter 5.1) there is no SSE support, you should probably consider switching to Gatling tool which has SSE support.
If you would like to stay with JMeter you can still test SSE, however you will have to use JSR223 Test Elements and handle the SSEs using Groovy scripting. Check out How to Load Test SSE Services with JMeter article for more details if interested.

Angular 4 performance & stress test

I am looking for a way to performance and stress test my SPA.
I prefer an open source(free) tool to do so.
I have searched quite a lot(https://www.blazemeter.com/blog/how-load-test-ajaxxhr-enabled-sites-jmeter) about the possibility to use Jmeter but i am still not sure if it is possible as this is an SPA and Jmeter works on the protocol level.
JMeter is not a browser as such it will not:
play URLs called through javascript.
report time taken in UI by javascript to display it
But the good news is that you can record all requests at HTTP protocol level,
all requests will be nested inside a Transaction Controller.
JMeter will play them sequentially and not in parallel.
So:
response time will be sum of Main + child requests response time
Load simulation will not be highly impacted as parallelism due to load testing will be simulated
There is also JMeter Webdriver Sampler that allows you to use a Real Browser
So by combining both approach you should be able to:
- Simulate load on your target application
- Have an idea of User Experience response times through JMeter Webdriver Sampler
You can install both plugins using JMeter-Plugins plugin manager plugin.
Note there is a 3rd party plugin that provides parallel execution if you want the parallel execution but I'm not sure it's needed:
https://github.com/Blazemeter/jmeter-bzm-plugins/blob/master/parallel/Parallel.md

Resources