Jmeter: lots of Connection: close in response header - jmeter

I am using Jmeter to do load testing against index page(static page) of my websit.
There are lots of errors in the test reulst because of connection closed.
Any tips why server(apache 2.2) decide to close the connection?
=============http headers===============
Load time:1055
Connect Time: 845
Latency: 1055
Size in bytes:98
Body size in bytes: 0
GET https://mysite/index.html
GET data:
[no cookies]
Request Headers:
Connection: keep-alive
Content-Length: 0
Content-Type: text/plain; charset=ISO-8859-1
Host: mysite
User-Agent: Apache-HttpClient/4.5.2 (Java/1.8.0_121)
Response headers:
HTTP/1.0 302 Found
Location: http://mysite/splash.html
Connection: close

Check your Mysql database connection pool size, During the load test you create number of thread it may insufficient to your mysql connection configuration.
you can increase max_connections in my.cnf

Try out the following JMeter configuration amendment:
Change "Implementation" of all your HTTP Request samplers to HttpClient4. The fastest and the easiest way of doing this for all the samplers is using HTTP Request Defaults
Add the next line to user.properties file (located in the "bin" folder of your JMeter installation)
httpclient4.retrycount=1
hc.parameters.file=hc.parameters
In the hc.parameters file add the next line:
http.connection.stalecheck$Boolean=true
Restart JMeter to pick the properties up
More information: Connection Reset since JMeter 2.10 ?

Related

Robot Framework, How to download a file returned in a response body using only request api

I'm using robot framework to send requests without opening a browser. One of the requests is supposed to download a file. But when I send this request the file is not downloaded (even if I have a 200 status code).
${uri} set variable /api/pricing/ExportImportParams/downloadExportParams
Create Session test ${url} cookies=&{cookies}
${resp}= Get Request test ${uri} headers=&{headers}
${resp_code} = Set Variable ${resp.status_code}
${resp_code} = Convert To String ${resp_code}
Run Keyword And Continue On Failure Should be Equal ${resp_code} 200
The test is passed while the status code is 200.
But no file is downloaded
Here is the response Headers
content-disposition: attachment;
filename="Export Site Parameter_2020-01-03_09-21-39.xlsx";
filename*=UTF-8''Export%20Site%20Parameter_2020-01-03_09-21-39.xlsx
content-length: 3767 content-type:
application/vnd.openxmlformats-officedocument.spreadsheetml.sheet
date: Fri, 03 Jan 2020 09:21:38 GMT server: Kestrel x-powered-by:
ASP.NET
Thanks for helping
Making an assumption that you are using the RequestsLibrary to perform the HTTP Get request to retrieve the file. Althought the documentation does not specify it, the content attribute of the returned response object contains the data. This can then be easily stored in a file using the standard OperatingSystem library.
*** Settings ***
Library RequestsLibrary
Library OperatingSystem
*** Test Cases ***
File Download Using RequestsLibrary
${file_name} Set Variable file_example_XLS_10.xls
${uri} Set Variable /wp-content/uploads/2017/02/${file_name}
Create Session test https://file-examples.com
${response}= Get Request test ${uri}
Run Keyword And Continue On Failure Should Be Equal As Numbers ${response.status_code} 200
Create Binary File ${EXECDIR}/${file_name} ${response.content}

Why does the .jmx file is not running in jmeter?

I'm getting an error when I tried to run a jmx file in Jmeter.
Thread Name: Thread Group 1-1
Sample Start: 2019-09-19 11:49:31 IST
Load time: 11
Connect Time: 0
Latency: 0
Size in bytes: 2255
Headers size in bytes: 0
Body size in bytes: 2255
Sample Count: 1
Error Count: 1
Response code: Non HTTP response code: java.net.SocketTimeoutException
Response message: Non HTTP response message: connect timed out
Response headers:
HTTPSampleResult fields:
ContentType:
DataEncoding: null
The .jmx file is running normally, the error you're getting indicates that JMeter's HTTP Request couldn't establish connection with the application under test within the bounds of the maximum connect time defined.
Make sure that the application under test is reachable from the machine where JMeter is running using telnet client or equivalent. If it isn't - you need to contact your network administrator to clarify what's going on and why application is not reachable
If you can access the application under test using telnet command it might be the case you need to increase timeouts under HTTP Request Defaults

Response time difference in Jmeter and Postman

I'm trying to test an API Get method when I run the same API for 1000 records in postman the response time is 4 seconds (installed postman in windows 7 and ran the test), whereas in JMeter it is taking 22 seconds, any idea what might be the reason for this?
Steps followed for JMeter run:
GUI mode
Non-GUI mode
Both Postman and JMeter are in same system/network.
Below is the Jmeter result:
Thread Name: Test/TestAPI 1-1
Sample Start: 2018-05-22 17:15:00 IST
Load time: **21406** // this is the issue , same in postman taking only 4712 ms
Connect Time: 425
Latency: 1990
Size in bytes: 3962439
Sent bytes:1130
Headers size in bytes: 175
Body size in bytes: 3962264
Sample Count: 1
Error Count: 0
Data type ("text"|"bin"|""): text
Response code: 200
Response message: OK
Response headers:HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
api-supported-versions: 1
Date: Tue, 22 May 2018 11:45:06 GMT
Content-Length: 3958179
Server: Web Server
HTTPSampleResult fields:
ContentType: application/json; charset=utf-8
DataEncoding: utf-8
Post Man Results:
api-supported-versions →1
content-encoding →gzip
content-type →application/json; charset=utf-8
date →Tue, 22 May 2018 12:00:11 GMT
server →Web Server
transfer-encoding →chunked
vary →Accept-Encoding
You need to compare similar request. In your case at least 1 header is missing. Add to JMeter's HTTP Header Accept-Encoding gzip,deflate
Follow JMeter's Best Practices to get the best performance, the main one is not to use listeners:
Use non-GUI mode: jmeter -n -t test.jmx -l test.jtl
Use as few Listeners as possible; if using the -l flag as above they can all be deleted or disabled.

G-WAN v7.12.6 can't visit the static contents

G-WAN out-of-box is running no problem with the dynamic contents but can't visit the static contents.
I ran G-WAN with kk user(not root, no sudo). All files and directories are of kk user/group.
I installed it in localhost. When I typed 127.0.0.1:8080 in the browser, it returned:
Server not found
Firefox can't find the server at www.index.html.
It is strange that the returned server name was www.index.html
When I typed 127.0.0.1:8080/index.html, it returned 404 file not found.
How can I workaround these, until a new release is out?
This time, there is no error message in the log file.
(I installed G-WAN in Ubuntu 15.10)
UPDATE: ------------------------
There are two strange info from the served_from.c, as below:
This page was processed...
Using get_env():
by the Server: 0.0.0.0:8080:8080(hostname: 127.0.0.1)
^^^^^^^^^^^^^^^^^(Should it be only one '8080'?)
Virtual Host: /home/kk/dev/gwan_v7.12.6/0.0.0.0:8080/#0.0.0.0
HTTP method: GET
HTTP request: /?served_from
HTTP query: served_from
HTTP entity: (null)
Content-Encoding: 0
Content-Length: 0
Content-Type: 0
for the Client: 127.0.0.1:43199
Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
Using HTTP Headers to get the same information:
by the Server: 27.0.0.1:8080 (hostname: 27.0.0.1)
^^^^^^^^^^^^^(Should it be 127.0.0.1 ?
The leading '1' is missing.)
HTTP method: GET
HTTP entity: -
Content-Encoding: 0
Content-Length: 0
Content-Type: 0
for the Client: 127.0.0.1:43199
ozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:47.0) Gecko/20100101 Firefox/47.0
Acpt-Language: n-US,en;q=0.5
Acpt-Encoding: 3: |GZIP|DEFLATE
Cookies: -
Is there anything wrong in v7.12.6?
UPDATE 2 ================================
with the following steps, G-WAN v7.12.6 can't show static contents:
1. all files and directories are of the same user/group (i.e. kk)
2. out-of-box, listen to 8080
3. run ./gwan
cannot visit static contents.
with following changes, G-WAN works normally:
1. change directory 0.0.0.0.8080 to 0.0.0.0:80
2. run sudo ./gwan -d:kk:kk
everything is normal.
sorry for my mis-typing in the UPDATE2. It should be 0.0.0.0:80 (emphasize the colon). Actually, I typed it right in the directory name. Repeat: ./gwan should work according to G-WAN's document, since the user launching the program is owning all the files and directories.
If you can query the server for scripts then G-WAN is running fine. The problem is obviously a file permission issue, hence the error 404 file not found you got for the query 127.0.0.1:8080/index.html.
This system configuration problem will affect any program, not specifically G-WAN. Consult our dedicated FAQ to find how to correct it.
For the served_from.c script, feel free to display the IP address in the "correct" order and to cut the string at the expected position to avoid the listener port repetition.
UPDATE:
Your latest update says "changing directory 0.0.0.0.8080 to 0.0.0.0:80 works". This was the problem: "0.0.0.0.8080" has never been a valid syntax for G-WAN.

JMeter - Non HTTP response message: URI can't be null

I need to test a web login using jmeter but this is the response in the results tree:
Thread Name: Thread Group 1-1
Sample Start: 1970-01-01 05:30:00 IST
Load time: 0
Latency: 0
Size in bytes: 1089
Headers size in bytes: 0
Body size in bytes: 1089
Sample Count: 1
Error Count: 1
Response code: Non HTTP response code: java.lang.IllegalArgumentException
Response message: Non HTTP response message: URI can't be null.
Response headers:
HTTPSampleResult fields:
ContentType:
DataEncoding: null
can someone please help me?
You entered a bad url in http sampler, check fields:
host
port
path
Another option is to read:
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf
I got this issue resolved, in my own with several testing..
Try to open the file in notepad and check it,
Links should be in this format
"GET /
"GET /css/bootstrap.min.css
"GET /theme/css/daterangepicker/daterangepicker+AC0-bs3.css
and in the Access Log Sampler
Server: works only on hosted site..example test.com if you enter ip. address for test.com it will not work based on my testing

Resources