Jmeter how to stop only one thread, not all the threads. - csv

I have 50 users in my ThreadGroup with 50 seconds rump up (50 rows in my .csv config file). After certain HTTP request I would like to test for certain condition,and if pass, continue to next HTTP requests. Soft of read on google that BeanShell Assertion with the code
String response = SampleResult.getResponseDataAsString();
if(response.contains("\"HasError\":true")){
SampleResult.setStopThread(true);
}
should resolve my problem. But the problem is that this function actually stops the entire test execution, all remaining users (where I might have some more values at the .csv file to test). IS there any convenient way not to stop the entire test? If anybody faced that problem please advise.

You can set a thread to stop on Sampler error by configuring it in the thread-group component. Mark the 'stop thread' in the 'Action to be taken after Sampler error' section.
To ensure that you get a Sampler error by configuring a Response Assertion.

Related

Concurrent MySQL writing with GORM leads to an error

I have implemented a complex csv import script in Golang.
I use a Workerpool implementation for it. Inside that workerpool, workers run through 1000s of small csv files, categorizing, tagging and branding the products.
And they all write to the same database table. So far so good.
The problem i'm facing is, that if i chose more than 2 workers, the process crashes with the following message randomly
The workflow is
foreach (csv) {
workerPool.submit(csv)
}
func worker(csv) {
foreach (line) {
import(line)
}
}
import(line) {
product = get(line)
product.category = determine_category(product)
product.brand = determine_brand(product)
save(brand)
product.tags = determine_tags(product)
//and after all
save(product)
}
I tried to wrap the save() calls in transactions, but it didn't help.
Now i have the following questions:
Is MySQL suited to save concurrently to 1 table?
If transactions are need to accomplish this, where should they be set?
Is the Go SQL Driver (where the error ALWAYS happens in packets.go:1102) suited to do this ?
Could anyone help me (maybe by hiring for a few hours)?
I'm completely stuck. I can also share the sourcecode if that helps. But I first wanted to know i you guess that it's rather my code or a general issue.
Open a new db connection in each goroutine (or thread, for languages that use threads).
MySQL's protocol is stateful, which means if multiple goroutines attempt to use the same connection, the requests and responses get very confused.
You would have the same problem trying to share any other kind of stateful protocol connection between goroutines.
For example ftp is also a stateful protocol, and that may be easier to understand. A client goroutine might send a message like "get file x" and the response should be a series of messages containing the content of that file. If another goroutine tries to use the same connection while that request/response is inprogress, both clients will be confused. The second goroutine will read packets that belong to a file it didn't request. The first goroutine who requested the file will find some packets it was expecting have already been read.
Similarly, MySQL's protocol does not support multiple client goroutines sharing a single connection.

JMeter HTML Reporting - Why is "infinity" appearing for throughput and network speed?

This appeared for two larger requests, neither of which failed/errored, in a test case with a single user run.
However, this does not appear for the five-user run of the same test case.
I haven't been able to find any documentation on Apache regarding the appearance of infinity during test runs.
Has anyone faced this? If so, did you find a way to get the reporting tool list the true numeric value?
Example of "infinity" appearing in the statistics.json 1
If you have "Infinity" in the statistics.json it means that the relevant Sampler has failed somewhere somehow (it hasn't been executed for some reason).
The reason can be found in:
.jtl results file, take a look at "responseMessage" column
jmeter.log file
If you want to see where the values are coming from and how the statistics are being built and processed - increase JMeter's logging verbosity for the HTML Reporting Dashboard packages by adding the next line to log4j2.xml file:
<Logger name="org.apache.jmeter.report.dashboard" level="debug" />
The easiest way to reproduce the issue is just creating a "bad" request, for example adding a HTTP Request sampler like this:
it won't be executed because you cannot have :// characters in the DNS hostname and this transaction will be having "Infinity" values in the statistics.json

Supplying 1 JDBC request result to multiple threads in JMeter

I'm facing an issue in Jmeter. The API I am testing, get the parameters from a prior JDBC request.
This works fine when there is only 1 thread. But, when I run multiple threads it throws the error below
{"Message": "A transient error has occurred. Please try again. (1205)","Data":null}
Here is the screenshot
I need to run 5 threads without having to run the JDBC request 5 times.
I can retrieve 5 results in 1 JDBC call and supply them sequentially for each of the thread. Is this possible? How can I do this?
Worst-case scenario I will have to manually set up CSV file instead of JDBC calls.
Normally people use setUp Thread Group for test data preparation and tearDown Thread Group for eventual clean-up. I would suggest moving your JDBC Request under the setUp Thread Group and run it with 1 virtual user.
If you have to keep the test plan structure as it is and can amend the SQL query to return more results, be aware that according to the JDBC Request sampler documentation the results look like:
myVar_#=5
myVar_1=foo
myVar_2=bar
myVar_3=baz
myVar_4=qux
myVar_5=corge
Therefore you can use the values using __V() and __threadNum() functions combination like:
${__V(myVar_${__threadNum},)}

camel ftp2 file throw error when there is no file present in the folder

I am working on reading the files from the sftp path and process the plain text files that are kept on the server every 5 hours. There is a requirement where I need to throw an exception when there is no file present/kept on the server by the producer. I am using the following to read the files
from(sftp://NUID#SERVER:PORT?&preferredAuthentications=password&delete=true)
.routeId(ROUTE_ID)
.log("${body}")
.process(processor)
.end();
Now if there is no file present when the above route starts it doesn't say anything once there is a file on the server it consumes and process it. I want to throw an exception if there is no file present during a period of time.
Some possible way to throw an exception when there is no file present on the target server.
1. Use sendEmptyMessageWhenIdle option (from file)
Set this option to true will let your route receive an exchange with empty message when the polling consumer scan no file present on the target server. Then, you can add a new step in your route to throw exception when an empty message (but not normal exchange) is encountered.
2. Setup another route with timer component to check last file processing time
In your original route, add a new step to record the last file processing time in somewhere, then have a new route to periodically check whether difference between the last update time and current time is in acceptable time range.
Drawback: False alarm may occur from other problem (e.g. Continuous Network Issue)
What is the exception that you receive called?
I checked the docu http://camel.apache.org/ftp2.html and it may be caused due to an option not being set to true.
Please try again with ignoreFileNotFoundOrPermissionError=true and also check the docu for other options that may apply.

Model derivative translate job giving status code 409 (CONFLICT)

How to fix status code 409 for translate job.
There are two types of problems I am facing.
1. Sometimes API returns error status code 409(conflict)
2. Sometimes it continuously gives in progress status and never completes or fails even.
Once any of the above error occurs, any subsequent job requests starts failing with error code 409.
We are trying node js API for translating job using following code.
let translateResult = derivativesAPI.translate(job, { 'xAdsForce': true }, forgeSvc.requestOAuth2TwoLeggedOBJ(), accessToken);
First try to delete manifest for the stuck/pending request file,
If that doesn't works , last option is to delete the bucket with pending/stuck translation request and then try again.
As per documentation, the 409 means:
The request conflicts with a previous request that is still in progress
As you mentioned a previous request failed, but is pending on our system and causes this conflict. Is that happening consistently with a file? Or random? When it fails (or hangs), what's the manifest? Finally, can you share a problematic URN?
EDIT: the file is working now and we'll keep investigating this.