I have a test in which I use a thread group with 2 users (numbers of threads) and ramp up period of 1 second. Although 2 browsers start and load the website (as expected) one of them stops and one continues to do the work. Any help appreciated. I am using Firefox 43 with Selenium 2.53.1 and JMeter 3.3
Here is the configuration
Most probably your test implementation is not thread-safe and JMeter threads are running into a race condition when 2 threads are trying to access the same Selenium Session.
Selenium WebDriver itself is not thread-safe so make sure that each JMeter Thread is using a separate dedicated WebDriver instance.
Check out jmeter.log file - in majority of cases it contains enough information to guess the root cause of JMeter test malfunction
Are you aware of WebDriver Sampler plugin which provides Selenium integration with JMeter? You can consider switching to it or at least using its source code as a reference
Add a Synchronizing Timer should help.
(Take a look of the article
https://www.blazemeter.com/blog/using-jmeter-synchronizing-timer)
But I only found one request in your image that I don't really understand about the problem you're facing.
Related
I'm experiencing a couple of problems while trying to run a Gatling simulation I've done. basically, I have two problems:
When any API under test in the Gatling simulation returns 400 or any other error code (not part of the check.status), Gatling kills the virtual user, instead of restarting the scenario and re-use that virtual user, so per each error, I'm losing a virtual user, as my test was planned only with 16 users for 30 mins, I'm having finished the test in the first few minutes without completing anything It happens every time I try to run the test and is annoying as I've been following all the documentation and I don't know what do I have wrong on the code. The simulation config for the users and ramp looks like the next code:
val scnCreation = scenario("My Scenario").during(conf.getDuration("test.duration")) {
exec(Pattern.methodToExecute)
}
setUp(scnCreation.inject(
rampUsers(conf.getInt("test.vu")).during(conf.getDuration("test.ramp"))
)
I'm getting this error while the test is running, but my resources are not overwhelmed (CPU is about ~30% and memory is about ~50%):
[gatling-http-1-13] WARN io.netty.channel.nio.NioEventLoop - Selector.select() returned prematurely 512 times in a row;
Any ideas on how to increase the "limits" of the Gatling engine and how to fix that bad-behavior in which Gatling kills one virtual user after an error?
Your statement that, on error, virtual users escape your loop and terminate is most likely wrong, unless you've implemented your test this way with some exit condition (edit: you did).
If you don't want your users to exit your loop, don't use exitHereIfFailed. Wrap your loop content with exitBlockOnFail instead. Have a look at the documentation.
Then, in any case, Gatling doesn't "recycle" virtual users. You're using rampUsers which defines an open workload model where you define the arrival rate of your users.
This is a NIO/OS bug. Upgrade your Java to the latest release of Java 8 at least, and if you're running on Linux, check how old your kernel is and most likely consider upgrading.
Also, I suspect you're using an old version of Gatling as modern ones don't use Java NIO on Linux. You should upgrade (latest is 3.5.1 as of now)
I have a ruby script that is running Capybara using selenium chrome driver.
The test navigates a website, at an unknown time a notification will appear that needs to be closed.
Is it possible to have a second thread that is polling the driver to check for the presence of the notification while the script continues perform the test.
I have tried a few different approaches, but I get errors such as Bad file descriptor (Errno::EBADF) which appears to be because the session/driver is not thread safe.
If this cannot be done, any ideas for dealing with this issue would be much appreciated. I would rather not have a piece of code I keep calling between actions, as I fear this would cause performance issues over time.
This seems like a starting point, but not 100% of what you're looking for http://blog.jthoenes.net/2013/08/16/waiting-for-a-javascript-event-with-seleniumcapybara/
Adding multiple requests to same thread group also seem to run sequentially.
I know you can start thread groups in parallel but I want all thread groups to run or start in parallel for the SAME user.
And then you have the synchronizing timer that starts multiple users at the exact time
http://jmeter.apache.org/usermanual/component_reference.html#Synchronizing_Timer
But this does not scale all users concurrently based on throughput and is very hacky i.e., you have to parameterize your users and the group by in such a way to match expected throughput and number of requests per user
Right now, the work around is to create an HTML page to trigger download embedded resources in parallel for same user in one thread group but that is ugly and only works for GET requests. Also this is very buggy and runs very slow besides occupying full CPU and the throughput is 1/10th of a separate parallel test showing that this does not work correctly.
You could use the same approach as for AJAX testing with JMeter which assumes running multiple requests of different types at the same moment of time. It assumes some scripting so you will have to write a bit of Groovy or Java code in JSR223 Sampler or even create your own sampler, fortunately JMeter module plugin-oriented architecture is very extension-friendly as it evidenced by JMeter Plugins project (take a look by the way, perhaps your use case is already implemented)
See How to Load Test AJAX/XHR Enabled Sites With JMeter guide for explanation of the approach and few code snippets demonstrating how to run parallel asynchronous requests
I have a web application that simply acts as a Front Controller using Spring Boot to call other remote REST services where I am combining Spring's DeferredResult with Observables subscribed on Scheduler.computation().
We are also using JMeter to stress out the web application, and we have noticed that requests start to fail with a 500 status, no response data and no logs anywhere when the number of concurrent threads scheduled in JMeter increases from 25, which obviously is a very "manageable" number for Tomcat.
Digging into the issue with the use of VisualVM to analyze how the threads were being created and used, we realized that the use of rx.Schedulers was somehow impacting the number of threads created by Tomcat NIO. Let me summarize our tests based on the rx.Scheduler used and a test in JMeter with 100 users (threads):
SCHEDULERS.COMPUTATION()
As we're using the Schedulers.computation() and my local machine has 4 available processors, then 4 EventLoop thread pools are created by RxJava (named RxComputationThreadPool-XXX) and ONLY 10 of Tomcat (named http-nio-8080-exec-XXX), as per VisualVM:
http://screencast.com/t/7C9La6K4Kt6
SCHEDULERS.IO() / SCHEDULERS.NEWTHREAD()
This scheduler seems to basically act as the Scheduler.newThread(), so a new thread is always created when required. Again, we can see lots of threads created by RxJava (named RxNewThreadScheduler-XXX), but ONLY 10 for Tomcat (named http-nio-8080-exec-XXX), as per VisualVM:
http://screencast.com/t/K7VWhkxci09o
SCHEDULERS.IMMEDIATE() / NO SCHEDULER
If we disable the creation of new threads in RxJava, either by setting the Schedulers.immediate() or removing it from the Observable, then we see the expected behaviour from Tomcat's threads, i.e. 100 http-nio-8080-exec corresponding to the number of users defined for the JMeter test:
http://screencast.com/t/n9TLVZGJ
Therefore, based on our testing, it's clear to us that the combination of RxJava with Schedulers and Tomcat 8 is somehow constraining the number of threads created by Tomcat... And we have no idea why or how this is happening.
Any help would be much appreciated as this is blocking our development so far.
Thanks in advance.
I have client and server threads in my applications. When I run these apps as standalone apps, these threads communicate properly.
But when I run client as JUnit and server as standalone, client thread dies within few seconds.
I couldn't get, why such different behavior.
When the JUnit runner terminates, all spawned threads etc. are killed too (as it is most likely run in a separate JVM instance).
Here is a (rather old) article describing the problem you experienced (the GroboUtils library it is recommending seems to have been abandoned long time ago though). And another, recent one, with a more modern solution using the new Java concurrency framework.
The gist of the latter solution is that it runs the threads via an executor, which publishes the results of the runs via Futures. And Future.get is blocking until the thread finishes with the task, automatically keeping the JUnit tests alive. You may be able to adapt this trick to your case.