JMeter can generate "load" against a system. But it is replacing the normal
"client" in a client-server or browser-server type model. So let's say you are
testing a web site, JMeter will act as the 'browser' (instead of Chrome, or
Firefox, or IE (shudder!), or Safari).
The value of this setup is that you can simulate what a number of users might
be doing on your server. The disadvantage of this setup is that you cannot see
exactly what the users will (because JMeter isn't a real browser).
Given that, if your goal is to load up the activity on your server - and
validate that it can handle the anticipated load - that is exactly what JMeter
will help you do.
(I'm sure there will be many other posts from knowledgeable users telling us
that there are many more features of JMeter, but I'm trying to keep in mind
that you are a new user, and am therefore simplifying things to the most basic
parts at first.)
Before you begin to develop a JMeter test, you need to first decide what
'server' functionality you need to exercise. For example, let's say your system
has a "Home Page", a "Registration Page", a "Login Page" (for returning users),
and a simple "Account Management Page". You might want to setup a test that
thoroughly exercises each one of these pages - one at a time - with some large
number of users. But why not setup a test that exercises "all" of these pages
simultaneously, and in the proportion you anticipate they will be utilized
under normal activity? For two reasons: 1) it is simpler to setup targeted
tests first; and 2) with JMeter you can combine several different tests into
another test to accomplish that, but you need the simpler tests setup first.
So, you would need to setup a JMeter script that tests just "get the home page".
You would use the "HTTP Sampler" and use it to get the home page. Since the
home page is anonymous (for the purposes of this test), you don't need logins
or user credentials yet.
Next, you may want to setup the "Registration Page" test. This test would be a
little more complicated. It would first "get the home page" (you can re-use
your first test here), and then it would "get the registration page" (following
the pattern that your users would follow), then it would submit the
registration data from the form on the registration page, and wait for the
response.
So, how do you re-use your "get home page" test? With something called the
"Include Controller" and the "Module Controller". The "Include Controller" can
be used to include "Test Fragments" you have saved from other tests. So if you
save off the part of your "get the home page" test that actually requests the
home page - as a "test fragment", you can "Include" that file into another
test. Once it is included, you can use the "Module Controller" to add it in
various steps within your other tests. Here's an example of how you might set
this up:
Include Controller: /path_to_fragment/GetHomepageFragment.jmx
Thread Group 1
Module Controller: Get Home Page
HTTP Sampler: Get Registration Page
HTTP Sampler: Submit Registration Form
Module Controller: Get Home Page
Tree Listener
Summary Report Listener
In this setup, you Include the GetHomepageFragment that you previously created.
Then you use it twice in Thread Group 1. (A "Thread Group" is just a container
that runs your test scripts some number of times, with a specified number of
simultaneous 'users' (e.g. "threads"). So if you want to run 100 simultaneous
users, for 100 loops - your test script will be executed 100 x 100 = 10000
times within the thread group.)
I added a couple of "Listeners" at the bottom of the test plan - so that you
could see what the test is doing. The "Tree Listener" will show you every
request and response made by the test. (HOWEVER, for an actual test run - you
do not want to enable the tree listener, since it will take up a lot of memory
and slow down your test script because it has to store all of the
requests/responses from the entire test run. So normally I just set the Tree
Listener to only show "Errors" when I run my scripts. But it is very useful to
enable the Tree Listener while you are debugging your test scripts.)
The next thing you need to consider is 'variables' in your test scripts. The
above works great if you only want to submit the same data each time. So if
your registration system allows you to register the same user over-and-over,
that would be fine. But most registration systems require you to change
something about the username for each unique registration (e.g., you aren't
allowed to use the same username as someone else). So your "Submit Registration
Form" sampler will need to setup to use variables. You can do something simple,
such as use a numerical counter in your variables - so that the username
changes with a number for each registration. For example: "user00001" through
"user10000". Of course, this will encounter a problem if you want to run your
test twice against the same data (e.g., the first time you run your test script
- you will create users "user00001" through "user10000", but then when you
start your test over - it will try to create the same users again). So we use a
combination of a date stamp and a numerical counter. The date stamp would be
different each time I run the test, and the counter would increment for the
various threads (simultaneous users) as the test is running. You can also use
built-in variables like 'thread number' and things like that for your tests.
Once you build up a collection of simple tests, you can use the Include
Controller and Module Controllers to create aggregate test scripts that include
all of your simpler test scripts to make a more full-featured suite of tests.
Hopefully this is enough to get you started. As always, it helps a ton to read
the documentation.
--
Robin D. Wilson
Sr. Director of Web/Java Engineering
KingsIsle Entertainment, Inc.
www.KingsIsle.com
-----Original Message-----
From: Jackeline kordon [mailto:[email protected]]
Sent: Friday, May 15, 2015 5:13 AM
To: [email protected]
Subject: How to generate workload on a server (normal and stress workload)
Hi
am a newbie.....and it is an emergency, I have a very close deadline...
I want to create a server of application, with a set of dynamic users.
users send requets to the server which corresponds to a workload, then I have
to test the performance of the server under different types of workloads.
I'm sorry, but I do not even know from where I have to start...
Thanks.
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]