MonthMay 2013

Jmeter Problems and Solutions

Performance

1) How to handle sessions in Jmeter?

Add->Pre-Processors->HTTP URL Re-writting Modifier for the sampler where your session variable is present
Then add your variable in session argument name and check chache session id.
Please see the Image below:

Jmeter_SessionHandling

2) How to customize the user data/ how to run the script for multiple users in Jmeter?

i) Add Thread Group->Config Element-> CSV Data config Element
ii) Give user variables for the csv file column.
iii) Place the csv in the same folder where you kept the jmeter script or give full file path in filename

See the images below:

Jmeter_CSV1

 

 

 

 

 

 

Jmeter_CSV

 

 

 

 

 

 

 

 

3) How to run the Jmeter for more than 300 users?

i) Run in Non GUI distributed mode to run for more than 300 users. It depends on RAM size. For the system with 3.2 GB, you can run up-to 1000 users.

Step1:
Configure Jmeter for Distributed testing

Step2:
Place your script and csv in /bin folder of the jmeter.

Step3:
Open command prompt , go to jmeter bin directory and give the following command

jmeter -n -t testplan.jmx -R ip1,ip2 -l resultfilename

4) How to record Jmeter script?
you can capture headers and parameters of the request by Fiddler or HTTPWATCH and write the script manually, or configure proxy and use Recording controller.

Detailed manual is available in Apache Site:
http://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf

5) How to extract the data using regex in Jmeter?

There is an element called preprocessor->regularexpression.

Add it under the request you want and then follow the below steps:

i) Give reference name (any name , that will be substituted in the place of actual parameter value in the request)

ii) Give the regular expression , for example if the text to be extracted is ‘world’ from text=’world’, then the regex will be like this text='(.+?)’

iii) Give template as $1$

iv) Match No would be which row of the value from the web page , it may be 1, 2,3 etc. If you want random row then give ‘0’

v)Default value is a string that will be sent to the server when it fails to extract the data. it can be anything for Ex: Loginid_Failed

Please see the Image below:

Jmeter_Regex

 

 

 

 

 

 

6) what are the charcters used in regex?

Regular Expressions use certain characters and those have special meaning. Following are the list of such characters.
( ) : grouping
[ ] : character classes
{ } : repetition
* + ? : repetition
. : wild-card character
: escape character
| : alternatives
^ $ : start and end of string or line

7) How can i use special charcters with actual meaning in regex?

Add backslash to the special character to mean it as it is, for example (),$,^.

8)  Mention example for regular expression to extract string with whitespace

Regular Expression : <url.values+(.+?)=”(.+?)”

Explanation:

<url.value    : Extract the string <url.value

<url.values  : Extract the string <url.value followed by white space

<url.values+Extract the string <url.value followed by white space and

<url.values+(.+?) : Extract the string <url.value followed by white space and any character with 1 or more match

<url.values+(.+?) =  : Extract the string <url.value followed by white space and any character with 1 or more match with equals symbol 

<url.values+(.+?) =”(.+?)” : Extract the string <url.value followed by white space and any character with 1 or more match with equals symbol  and any charcter with 1 or more matches inside double quotes.

So the final string returned from above condition may be like this:

<url.value groupid=”1234trurbd93737″

9) How to use java program inside Jmeter?

Java program can be called inside jmeter by using BeanShell Pre/Post Processor.

10) How to send file with Jmeter script?

There is a column in http request as ‘ Send Files with the Request’

Give the filepath,parameter name and MIME type.

For sending different files , give it in CSV file and add the variable in CSVconfig Element. (Any question related this, you can post your questions)

11) How to capture Jmeter results?

There are lot of graphs/listeners available for jmeter. Or if the purpose is to find response time for the request, use ‘Aggregate Report’ and take min, max, avg timings(in milliseconds) . That will help a lot.
Or you can download plugin for colorful graphs.

http://code.google.com/p/jmeter-plugins/

Jmeter_AggregateReport

12) How to View the results of JTL file created in NON-GUI mode?
Open any Jmeter script, go to Aggregate report listener, Browse the file and Open it. After that you can Save it as CSV file.

13) How to test ‘HTTPS’ applications using Jmeter?
In HTTP Request default, mention the protocol as ‘https

14) How to rectify Jmeter out of memory error-heap space when opening Jmeter?
Right Click and Edit Jmeter.bat file , increase Xmx value and check.

15) Where to Download Jmeter latest version?
https://jmeter.apache.org/download_jmeter.cgi

16) How to execute ssh command or shell script on remote server using Jmeter?
Using SSH sampler it can be done. For detailed explanation see here
http://www.technix.in/execute-linux-command-shell-script-apache-jmeter/

17) How to run endurance test using Jmeter for more than 8 hours?

Using Timers , it is possible to run endurance test using jmeter, please look at this

http://www.technix.in/run-overnight-endurance-test-consecutively-using-jmeter/

 

Performance Testing on ETL

How to do performance testing on ETL?

1) First step , find out the load that is being transformed in production
2) Create new data of that same load or Move from Production data to your local performance server
3) Disable the ETL until you generate the load required
4) Take count of the needed data from the tables of the database
5) Note down the last run of ETL and Enable the ETL ,so that it will get enough stress to
transform entire load created ,run it.
6) After ETL completes the run ,again take count of the data created /transformed
a) Note down ETL Run time End and find out the total time it took to tranform the load
b) Findout whether performance time is improved or decreased
b) See that all the expected load got extracted and transfered witETL_Process_Flowhout missing.

How to find RAM utilization for specific JAVA process at run time

How to find RAM utilization for specific JAVA process at run time when application is running with huge load?

1) Open terminal in your Linux server.

2) Set your JAVA_Home.

3) type as jconsole and Enter

4) You can see a new window opening with jconsole, select the process that you want to profile and click on connect

jconsole

 

5) This will show show all details included Heap memory,Non heap memory,No. of loaded classes,No. of Live threads

what is the advantage of using jconsole?

If you want to see the summary of resource utilization in the production server at run time, this is the right tool to use as it will not create much performance overhead on the server . 

 

Installing Java and Setting JAVA_HOME

For any applications built around java requires JAVA_HOME variable to be set, here is how to setup JAVA_HOME for both Linux/Unix and windows environment.

To Install the JDK Software and Set JAVA_HOME on a UNIX System

  1. Install the JDK software.
    1. Go to http://java.sun.com/javase/downloads/index.jsp.
    2. Select the appropriate JDK version and click Download.The JDK software is installed on your computer, for example, at /usr/jdk/jdk1.6.0_02. You can change this location.
  2. Set JAVA_HOME.
    • Korn and bash shells:
      export JAVA_HOME=jdk-install-dir
      export PATH=$JAVA_HOME/bin:$PATH
    • Bourne shell:
      JAVA_HOME=jdk-install-dir
      export JAVA_HOME
      PATH=$JAVA_HOME/bin:$PATH
      export PATH
    • C shell:
      setenv JAVA_HOME jdk-install-dir
      setenv PATH $JAVA_HOME/bin:$PATH
      export PATH=$JAVA_HOME/bin:$PATH

To Install the JDK Software and Set JAVA_HOME on a Windows System

 

  • Install the JDK software.
    1. Go to http://java.sun.com/javase/downloads/index.jsp.
    2. Select the appropriate JDK software and click Download.The JDK software is installed on your computer, for example, at C:Program FilesJavajdk1.7. You can move the JDK software to another location if desired.
  • Set JAVA_HOME:
    1. Right click My Computer and select Properties.
    2. On the Advanced tab, select Environment Variables, and then edit JAVA_HOME to point to where the JDK software is located, for example, C:Program FilesJavajdk1.7.

JAVA_windows

ORA-00845: MEMORY_TARGET not supported on this system

Getting ORA-00845: MEMORY_TARGET not supported on this system, while trying to start a database.

Error
sql> startup
ORA-00845: MEMORY_TARGET not supported on this system

Reason:

This is a very common error which you might face while starting up your oracle database. This happens when your system is out of temporary storage. While starting up the database oracle uses /dev/shm to store temporary files but when it runs out of memory you get this error.

/dev/shm is also know as tmpfs i.e. temporary file system which keeps all the file system in virtual memory to speed up several processes.

Solution:

Increase the size of /dev/shm

To check the size of /dev/shm
root@localhost# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 10G 4.4G 2.9G 61% /
tmpfs 504M 76K 504M 1% /dev/shm
/dev/sda1 194M 25M 160M 14% /boot

To increase the size
root@localhost# mount -o remount,size=3G /dev/shm
Verify the size
root@localhost# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda3 7.6G 4.4G 2.9G 61% /
tmpfs 3G 1007M 2.1G 33% /dev/shm
/dev/sda1 194M 25M 160M 14% /boot

To make permanent changes to your file system update your fstab
root@localhost# vi /etc/fstab
tmpfs /dev/shm tmpfs defaults,size=3G 0 0

 

Update the new fstab file
root@localhost# mount -a
 

Linux kernel 3.9 released

Linux-Kernel-3-3Linux creator Linus Torvalds has released version 3.9 of The Linux Kernel. This release has done nearly ten weeks after 3.8 version was released. The latest release of 3.9 can be obtained from Kernel.org.

Protocol           Location

HTTP                https://www.kernel.org/pub/

FTP                  ftp://ftp.kernel.org/pub/

RSYNC             rsync://rsync.kernel.org/pub/

Here is a quick look into new features of Linux released

  1. SSD caching: Linux 3.9’s addition of a device mapper target (dm-cache) that enables the usage of speedy devices such as solid-state drives(SSDs).
  2. Expanded Architecture support: This new release brings support for ARC700 processor family (750D & 770D) from Synopsys as well as the META ATP (Meta 1) and HTP (Meta 2) processor cores from imagination. Meta cores can be found in many digital radios, while the ARC700 family is commonly embedded in SoCs in TC set-top boxes and digital media players.
  3. Better Power efficiency: Thanks to the inclusion of intel PowerClamp driver, which performs synchronised idle injection across all online CPUs.
  4. Chromebook Support: Support for all most all chrome books supported by different vendors.
  5. Another Boost for ARM: Linux’s support for ARM has improved considerably over the past few releases, and kernel 3.9 brings a key improvement in the form of support for the KVM virtualization system in the ARM architecture port. As KernelNewbies notes, “this brings virtualization capabilities to the Linux ARM ecosystem.”
  6. Android developer Support: Linux 3.9 adds support for the “Goldfish” virtualized platform that’s part of the Android development environment. Essentially, that means it’s now possible to develop for Android with “out-of-the-box” kernels.

Of course, this is only a small sampling of what’s new in Linux 3.9; a raft of new drivers and numerous other new improvements are included as well. A thorough summary is available on The H.

 

© 2017 My techbook

Theme by Anders NorénUp ↑