I am going to show how to use Jmeter for performance testing of liferay portal’s authenticated pages. Here I am going to use Apache Jmeter 2.11.
Here are Some Steps to follow :
Step: 1 - Disable p_auth
Make
auth.token.check.enabled =false in portal-ext.properties file and then restart liferay. Liferay uses Portal Authentication Token
p_auth to prevent
CSRF attack. This token is included in every action request in the portal by including the "p_auth" parameter in URL.We are disabling it so JMeter can login. Here is detail about authtoken.
Step: 2 - Add Thread Group
Right click on Test Plan and then follow below path:
Add ? Threads(Users) ? Add Thread Group
In Thread Group there is Loop Count which tells how many loops to perform on request. Ramp up Period tells the time interval.
eg. if Number of Thread =1,Ramp up Period=1 and Loop Count=5 then it perform 5 iteration of request in 1 second for 1 user here is more detail about thread group.
Step 3 - Add Http Cookie Manager under Thread Group
Right click on Thread Group and then follow below path:
Add ? Config Element ? HTTP Cookie Manager.
HTTP Cookie Manager Stores Cookie and send cookie just like web browsers. Here is more detail about
cookie manager.
Step: 4 - Add Once Only Controller
Right Click on Thread Group and then follow below path:
Add ? Logical Controller ? Once Only Controller
Once Only Controller run only once for any looping parent control. If parent control defines 5 loops then it will run for only first iteration. Mainly it is used for login purpose. Here is more detail about
all controllers.
Step: 5 - Add Http Request under Once Only Controller
Right click on Once Only Controller and then follow below path:
Add ? Sampler ? HTTP Request
In this request you call the Login Portlet using below URL:
/web/guest/?p_p_id=58&p_p_state=maximized&_58_struts_action=%2Flogin%2Flogin
Below is Configuration for this Request.
- Server name or IP appropriate to your domain.
- Port number on which your liferay is running.
- URL of Login Portlet.

Step: 6 - Add Regular Expression Extractor under Once Only Controller
Right click on Once Only Controller and then follow below path:
Add ? Post Processor ? Regular Expression Extractor
Extractor is used to extract parameter from first request to utilize it in the next request. Here we will capture authtoken from previous request using regular expression and use it in next request
The Extractor is configured as shown in the screenshot:
Step: 7 - Add Http Request under Once Only Controller
Right click on Once Only Controller and then follow below path:
Add ? Sampler ? HTTP Request
Now you can take "authtoken" parameter for the second login request to use. The path for the request is:
/web/guest/?p_auth=${authtoken}&p_p_id=58&p_p_lifecycle=1&p_p_state=maximized&_58_struts_action=%2Flogin%2Flogin
The POST parameters can be found in the next Screenshot. The names of the parameters are below:
- _58_login
- _58_password
- _58_rememberMe
The parameter "_58_login" and "_58_password" shall be filled with the existing credentials.
- Server name or IP appropriate to your domain.
- Port number on which your liferay is running.
- URL of Login Action.
- Credential of User.
This Request is for private page for which you want to test.