cool tech graphics

A JMeter test plan for Drupal

Filed under:

Last week, I wrote about graphing JMeter results with Matplotlib. Let's take a closer look at the actual Drupal test plan.

This plan was adapted from Jacob Singh's test and has five different thread groups:

  • Anonymous browsing
  • Authenticated browsing
  • Editing a node
  • Search
  • Login and view user page

Download the test plan: DrupalStress.jmx

Since some of these samplers need a variety of URLs to test, we have two input files:


Not surprisingly, this contains a list of URLs for the browsing threads. A simple list can be generated with the following query:

SELECT CONCAT('/node/', nid) FROM node WHERE STATUS = 1
  ORDER BY changed LIMIT 1000;

For an active site, an alternative might be to extract this list from your site's access logs; such a list would closely match actual traffic patterns.


The wordlist contains a list of queries for the search thread. Querying the search_index table provides a basic list:

SELECT word FROM search_index ORDER BY RAND() LIMIT 1000;

This list will only contain one-word queries, so again you may want to tailor the wordlist to your site.

Running the test

To generate multiple samples with different parameters, it's best to run JMeter from a script. In this way configuration options can be parameterized (using the __P() function) and passed to JMeter with the -J option. The plotting script in particular expects multiple test runs with a variable number of threads. For this test, the thread_count variable is applied only to anonymous browsing, as it was testing a site that serves primarily anonymous visitors. This balance can be adjusted by editing the thread groups in JMeter.

# The host under test.
# A Drupal username.
# USER's password
# A node id to edit.
# Ramp up by factors of sqrt(2).
for thread_count in 2 3 4 6 8 11 16 23 32 45 64 91 128 181 256 362 512
do -n -t DrupalStress.jmx -Jhost=$HOST -Juser=$USER\
  -Jpassword=$PASS -Jthreads=$thread_count -Jedit_id=$EDIT_ID

Each thread group uses a Runtime Controller set to 30 seconds, so this script will take about 10 minutes total. When it's finished, the CSV output will be in /tmp/Drupal6.

test plan

Date posted: August 25, 2010


Awesome. Definitely going to make use of this.

I cant seem to get auth browsing to work.. I have a basic pressflow install I made the changes in the drupal defaults (im running this in gui mode), Login form is green, but Home Page - auth is red, not sure why

Troubleshooting is kind of tricky. First, disable all the other tests except the one you are debugging. Then watch the headers / response under "View results tree". Sometimes, if I can't figure out what's going on I've had to use Wireshark to watch the traffic.

Thanks for a very detailed post.
We need to simulate a new user for each iteration for Anonymous users.

Please comment on how this can be done.


Hi. I'm learning how to administer Drupal in preparation for migrating our Plone site to it. I used ab in the past, but only now am learning to use jmeter for the load tests. When you say I need to provide two input files, urls and wordlist, I'm not sure how to provide them. I ran your example queries successfully against my test Drupal instance, so I think I can create them, but do I put them in the same directory as the jmx script? Is there someplace in the script where these filenames and locations are specified? Thanks in advance if you have time to reply.

Hi. I just discovered Config Element->CSV Data Set Config so I see where the filenames are specified. :-) Next question, where are $_{host} and other variables being defined? Gee, I hope that sixty seconds after posting the question I discover this one, too. (facepalm) TIA.

Hello Dylan,
I am new to jmeter. This is my second day using the jmeter . Today while creating new test script and after running it I found that i am not able to get the results.
The test is running but the result are not shown.

Hi Dylan,
Thanks for this great post. By modifying the login/out parameters I managed to use this against Drupal 7 as well. Thanks! :-)

Useful article, what do you think about Drupal Blazemter plugin which generates JMeter load scripts? If I'm not mistaken it includes "Login and view user page", "Anonymous browsing", "Authenticated browsing" thread groups.

hi i have a problem with the testing of a drupal 7 site , i have to test the comment box and it just doesn't want to post .....

Add new comment

Restricted HTML

  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <blockquote cite> <code> <ul type> <ol start type> <li> <dl> <dt> <dd> <h2 id> <h3 id> <h4 id> <h5 id> <h6 id>
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <cpp>, <java>, <php>. The supported tag styles are: <foo>, [foo].
  • Web page addresses and email addresses turn into links automatically.
  • Lines and paragraphs break automatically.

Metal Toad is an Advanced AWS Consulting Partner. Learn more about our AWS Managed Services

Have questions?