can we have any jmeter control over the threads? - jmeter

can we have any control over the threads?
Consider i have 10 threads and i have provided my test data in .csv file. so can I control on threads like which thread should pick which data and may be some delay for few of the threads?
Also, can someone suggest me some book or online content wherein i can have information on internals of JMeter. Like when we run test plan, what all things are happening on memory side, reading of different properties files, receiving response, how threads internally works, etc.
Thanks,
Abhishek

JMeter is a very flexible and powerful tool. In theory, anything is possible it all depends on what your testing goals are. Even things not supported by JMeter can be coded in Java and easily integrated with a Java Sampler. Your question indicates you have not spent a lot of time experimenting with the tool, but hopefully my answer jump-starts that process for you.
JMeter has a lot of control features that can be used in conjunction with CSV data to control the flow of a thread. For example, use the CSV data to correctly enter the right block of a Switch Controller, validate an If Controller, or control the number of loops in a Loop Controller. Be sure you read the entire Getting Started Guide and familiarize yourself with the Component Reference Guide
In terms of how things work internally, your best bet is to build the JMeter project from source in an IDE like Eclipse. You can then step through the entire program in as much detail as you want.
Tutorial: Build JMeter from Source
Also, the /bin/jmeter file has a decent number of comments about how to properly configure JVM memory for a JMeter process.
You probably want to install at least the most basic JMeter Plugin Package.
Lastly, if you need one thread to control the behavior of another thread you can use FIFO Queues or set JVM properties via Beanshell which are global and not unique to a thread like runtime variables.
props.put("key","value");

Related

Jmeter CLI stops tests after sometime. Any ideas?

When I run Jmeter from Windows CLI, after some random time, the tests are being stopped or stuck. I can click on ctrl+C (one time) just to refresh the run but part of the request will be lost during the time it was stuck.
Take a look at jmeter.log file, normally it should be possible to figure out what's wrong by looking at messages there. If you don't see any suspicious entries there - you can increase JMeter's logging verbosity by changing values in logj2.xml file or via -L command-line parameters.
Take a thread dump and see what exactly threads are doing when they're "stuck"
If you're using HTTP Request samplers be aware that JMeter will wait for the result forever and if the application fails to respond at all - your test will never end so you need to set reasonable timeouts.
Make sure to follow JMeter Best Practices
Take a look at resources consumption like CPU, RAM, etc. - if your machine is overloaded and cannot conduct the required load you will need to switch to distributed testing
There are several approaches to debugging a JMeter test which can be combined as a general systematic approach that I capable of diagnosing most problems.
The first thing that I would suggest is running the test within the JMeter GUI to visualize the test execution. For this you may want to add a View Results Tree listener which will provide you with real time results from each request generated:
Another way you can monitor your test execution in real time within the JMeter GUI is with the Log Viewer. If any exceptions are encountered during your test execution you will see detailed output in this window. This can be found under the Options menu:
Beyond this, JMeter records output files which are often very useful in debugging you load tests. Both the .log file and the .jtl file will provide a time stamped history of every action your test performs. From there you can likely track down the offending request or error if your test unexpectedly hangs:
If you do decide to move your test into the cloud using a service that hosts your test, you may be able to ascertain more information through that platform. Here is a comprehensive example on how to debug JMeter load tests that covers the above approaches as well as more advanced concepts. Using a cloud load test provider can provide your test will additional network and machine resources beyond what your local machine can, if the problem is related to a performance bottleneck.

Understand JMeter technicalities for comparing distributed vs independent JMeter engines

I'd few ques on technical details of JMeter mostly pertaining to distributed setup vs independent JMeter engines (since JMeter controller can become a bottleneck in case of several JMeter load generators). Would be great if anybody can help with the understanding here -
How is JMeter distributed setup orchestrated by JMeter controller (i.e. called master or client)? Can we use the same logic to synchronize test among independent JMeter engines (independent mode)?
Is there a way to pool connections across vUsers?
Function of ASYNC_QUEUE in backend listener and it's expected side-effects in independent mode (mentioned above), what happens when queue is full?
Does/Is there a way for JMeter to execute javascript/act as headless browser?
How does DNS resolution happen for JMeter? Does it resolve for each vuser?
Your "question" looks like a compilation of interview questions rather than something connected with your single current concern and I don't think it's a proper place/way to ask it, I believe it should be: one post - one question.
Whatever
How is JMeter distributed setup orchestrated by JMeter controller - JMeter master sends .jmx script to slaves and collects results from them. Theoretically you can implement your own mechanism for delivering the test plan and eventual dependencies to the individual JMeter engines and running the test at the same time. Then you will need to collect the .jtl results files from the engines and combine it into a single one.
Is there a way to pool connections across vUsers? - JMeter does it internally
When the queue is full no more new sample results will be taken for processing by the backend listener so the results won't be "realtime" anymore, you will see the new results as free slots will be appearing in the queue
For JMeter per-se - no, AJAX calls can be simulated using Parallel Controller, for client-side performance testing, JavaScript execution profiling and rendering speed measurement you will need to use a read browser, no matter normal or headless, there is WebDriver Sampler plugin providing JMeter integration with Selenium
DNS resolution is dependent on underlying OS and/or JVM DNS resolution implementation, there is DNS Cache Manager which enables overriding hosts entries and using custom DNS resolver so each thread looks up the IP address on its own

How do I perform a complete Load Test process with JMeter?

I am new to using JMeter and have developed a basic test plan with HTTP Sampler and a few listeners. Please run me through the entire process of how I can start after opening JMeter ?
There's no right answer for this, it depends what you're wanting to achieve. I'd suggest starting with the best practices: http://jmeter.apache.org/usermanual/best-practices.html
And also look at building a web test plan: http://jmeter.apache.org/usermanual/build-web-test-plan.html
I would look at the Graphs Generator listener - https://jmeter-plugins.org/wiki/GraphsGeneratorListener/ - use these graphs to make sure you're making the number of transactions that you would expect in your tests.
Basically - the documentation is your friend. I took time to read what each controller, listener and sampler was doing and decided how to implement these myself. There was some trial and error. JMeter is an easy tool to pick up and use but there's a LOT of depth to it.
In addition to Ali1874 answer, I would suggest looking into how to run JMeter tests using command line. You can find more information at http://jmeter.apache.org/usermanual/get-started.html#non_gui. With regards to reporting JMeter is able to produce nice HTML reports when using -e -o options http://jmeter.apache.org/usermanual/generating-dashboard.html#report_after_load_test.
Also, with regards to Jmeter test plans, in my previous company we used to parameterize number of threads required, servers and other elements. In general structure looked like the one at the example test plan.
We had different user defined variables elements for different environments for faster test tuning. Also, we used bzm – Weighted switch controller (https://github.com/Blazemeter/jmeter-bzm-plugins) to distribute load among endpoints by including HTTP requests from Test Fragment element so that we would not have to duplicate requests allowing to manage them more easily. You can check out full plan at here (https://github.com/gretard/testing/blob/master/00-jmeter/results/samplePlan.jmx). Please bear in mind that test plan uses bzm – Weighted switch controller plugin and jpgc - Standard Set plugin which you can install by using Plugins manager (https://jmeter-plugins.org/wiki/PluginsManager/).
Hope this will help.

JSR223 Preprocess performance issue Jmeter

I have an scenario to measure login function performance for that i have used JSR223 preprocessor to encrypt my password using Javascript its around 2000 Line of code it works fine it encrypts the password successfully, i can able to login using my script it works fine in small number of users.
If we go for an large volume of users script finish first 3 steps very fast once it reaches JSR223 preprocessor thread it takes long time to process it makes delay in performance test.
Any suggestion to fine tune this process ?
Already i have configured the cache size as 1024 even though it takes long time to execute.
For 600 Users it takes 1hr +++ time to finish the process with 1 Master and 3 slaves environment.
Javascript should be avoided for Load Testing.
The best option is to use:
Groovy
Check Cache Compilation Key
Enter a unique key per Test element
This will make JMeter compile the script leading to most optimal performances, read this for more informations:
http://www.ubik-ingenierie.com/blog/jmeter_performance_tuning_tips/
If you're looking to learn jmeter correctly, this book will help you.
JavaScript is not the best language to use with JSR223 PreProcessor, it's being run via Rhino or Nashorn engine and your expression is being evaluated all the time from scratch using not very performant way.
According to JMeter Best Practices it is recommended to use Groovy scripting engine. Assuming good configuration you will be able to get groovy scripts compiled into native JVM bytecode hence performance will be much higher than for JavaScript.
In order to get Groovy support in Jmeter you just need to
Download groovy-all.jar
Drop the file to "lib" folder of your JMeter installation
Restart JMeter
See Beanshell vs JSR223 vs Java JMeter Scripting: The Performance-Off You've Been Waiting For! guide for more detailed explanation and scripting best practices.

How can I monitor my Application server or Database server from Jmeter scripts ? Can we check CPU , memory utilization, etc?

I need to know till what extend we can analyze our Application using Apache Jmeter.
My script creation is complete. Paramatrized & Correlated. Now I need a deep understanding of Analysis.
Earlier, I just use to focus on Response time, Standard deviation, throughput, etc.
But now my boss wants me to do more analysis. Please help me guys.
You can use these Samplers from JMeter-plugins project:
http://jmeter-plugins.org/wiki/DbMon/
http://jmeter-plugins.org/wiki/JMXMon/
Correctly still divide the tasks and means to solve them. If you need to monitor the parameters of the server utilization - then it needs to use the appropriate means, for example, zabbix. If you need to understand how much resources consumes your server applications - it is necessary to refer to the appropriate monitoring tools, plug-ins, such as Zorka for WebSphere in zabbix.

Resources