Artificial Intelligence

A JMeter test plan for Drupal

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, and Login and view user page. The revised test plan is available for download.


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:

urls:

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.

wordlist:

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.

#!/bin/bash
 
# The host under test.
HOST=localhost
 
# A Drupal username.
USER=user
 
# USER's password
PASS='12345'
 
# A node id to edit.
EDIT_ID=42
 
# 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
  jmeter.sh -n -t DrupalStress.jmx -Jhost=$HOST -Juser=$USER\
  -Jpassword=$PASS -Jthreads=$thread_count -Jedit_id=$EDIT_ID
done

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

Similar posts

Get notified on new marketing insights

Be the first to know about new B2B SaaS Marketing insights to build or refine your marketing function with the tools and knowledge of today’s industry.