Archive for category Apache

Recording HTTPS Traffic with JMeter’s Proxy Server & asp.net login

Recording HTTPS Traffic with JMeter’s Proxy Server _ BlazeMeter

JMeter Expert_ Testing performance of web page with Apache JMeter

 

Jmeter is an open source web performance testing tool.

The easiest way is to use “proxy” to record what you have done in browser, says firefox, and generate the script required.

For testing an asp.net based web application, below are important

  • Regular Expression Extractor to get the viewstate and eventvalidation value generated by asp.net (Web Form only; no need for MVC)
  • Adding Cookie Manager for storing cookie for asp.net

 

Regular Expression Extractors

Our first regular expression extractor will grab the page’s VIEWSTATE element and store it in the JMeterviewState variable. Add a new Regular Expression Extractor in JMeter by:

  1. Right click on your Thread Group
  2. Choose Add -> Post Processors -> Regular Expression Extractor
  3. Configure as follows
    • Reference Name: viewState
    • Regular Expression: name="__VIEWSTATE" id="__VIEWSTATE" value="(.+?)"
    • Template: $1$
    • Math No: 1
    • Default Value: ERROR

VIEWSTATE Regular Expression Extractor

We also need to include a regex extractor that stores the EVENTVALIDATION element in the eventValidationvariable. Again:

  1. Right click on your Thread Group
  2. Choose Add -> Post Processors -> Regular Expression Extractor
  3. Configure as follows
    • Reference Name: eventValidation
    • Regular Expression: name="__EVENTVALIDATION" id="__EVENTVALIDATION" value="(.+?)"
    • Template: $1$
    • Math No: 1
    • Default Value: ERROR

EVENTVALIDATION Regular Expression Extractor

Using the Extracted Values

Now that we have populated the viewState and eventValidation values, we need to include them when we POST to our application. In my run, this only happened on the login page.

  1. Select your login page POST in the Test Plan’s Recording Controller
  2. Set the __VIEWSTATE parameter to ${viewState}
  3. Set the __EVENTVALIDATION parameter to ${eventValidation}

Login POST Configuration

HTTP Cookie Manager

If you run your test plan now, you will see that it is still not working. This is because ASP.NET WebForms uses a cookie to store the login session. We can solve this with JMeter’s “HTTP Cookie Manager”.

  1. Right click on your Thread Group
  2. Choose Add -> Config Element -> HTTP Cookie Manager

Finally, run your Test Plan. You should see that your WebForms application returns the correct responses to JMeter’s requests. If not, double check that you are using the viewState and eventValidation variables in your login page POST (or any other post, for that matter) and that you have added the Cookie Manager.

Bonus – Parameterize Credentials Across Threads

Application performance for multiple concurrent logins with the same user is probably not a very interesting test case for your system. Luckily, it is extremely easy to parameterize login credentials for JMeter threads with a “CSV Data Set Config” element.

Store Credentials in CSV File

  1. Create a text file named credentials.csv in the same directory as your Test Plan .jmx file
  2. Populate credentials.csv with the login credentials you want to use (mind extra spaces)
login_1,password_1
login_2,password_2
login_3,password_3

Add CSV Data Set Config

  1. Select your Thread Group
  2. Choose Add -> Config Element -> CSV Data Set Config
  3. Configure as follows
    • Filename: credentials.csv
    • Variable Names: username,password

CSV Data Set Config

Use Variable Credentials in Login Post

  1. Select your login page POST in the Test Plan’s Recording Controller
  2. Configure as follows
    • <Your Login Element ID> : ${username}
    • <Your Password Element ID> : ${password}

Login POST Configuration with username, password Variables

Now the threads in your Test Plan will cycle through the credentials specified in your CSV.

Acknowledgements

The following articles were extremely helpful in figuring all of this out:

 

 

No Comments

Apache server 2.4.6 hangs after serving requests from Internet Explorer 10/11

Apache server 2.4.6 hangs after serving requests from Internet Explorer 10/11

Symptoms:
Apache 2.4 running on Windows hangs when Internet Explorer 10/11 is used to acces pages on it.

 

Reproduction:

I had a very reproducible scenario: Only the first request to Apache coming from IE would work, all other subsequent requests would hang, in all browsers. As long as I did not use Internet Explorer there did not seem to be a problem, but once that was used everything would hang until Apache was restarted. Strangely enough after I had applied the fix (see below) I reverted it to do some more testing but was not able to reproduce the problem anymore…

 

Migitating factors:
I am not sure of these, just describing the setup I was using when I encountered these problems. If you know more, please leave a comment.

  • Running on Windows 7
  • Using Apache 2.4.6
  • VMWare network drivers installed (see explanation for why this might be relevant)
  • Using an experimental 64-bit build of PHP 5.5: php-5.5.5-Win32-VC11-x64
  • Using Internet Explorer 11
  • Using Twitter Bootstrap, MySQL

Cause:
It seems that I was being hit by an issue with Apache’s Multi-Processing Module optimized for Windows NT. See references below for some sources that describe this problem and the fix.

Fix:
Add this configuration snippet to Apache24/conf/httpd.conf (bottom of file seems fine):

# Apparently this fixes an issue with Apache 2.4.6 on Windows hanging
# when serving requests from Internet Explorer 10/11.
AcceptFilter http none
AcceptFilter https none

Explanation:
From the Apache docs about AcceptFilter:

This directive enables operating system specific optimizations for a listening socket by the Protocol type.

On Windows, none uses accept() rather than AcceptEx() and will not recycle sockets between connections. This is useful for network adapters with broken driver support, as well as some virtual network providers such as vpn drivers, or spam, virus or spyware filters.

Copied from site: http://stijndewitt.wordpress.com/2014/01/10/apache-hangs-ie11/

No Comments