0

I have set up an extremely basic Web Forms site locally to find out why when I do a load test through jMeter to a .Net website that the OutputCache directive on the page is ignored.

I'm using this directive at the top of the page:

<%@ OutputCache Duration="3600" VaryByParam="none" %>

In order to check if the cache is working I have a simple log4net log in the Page Load:

protected void Page_Load(object sender, EventArgs e)
{
    log.Debug("In Page_Load");
}

When browsing the site through the Web Browser the OutputCache is behaving as expected as I get a log in the file once:

DEBUG [2014-04-05 15:44:56,905] - In Page_Load

When I continue to refresh the browser to the same page as well as using other browsers, there are no more logs which is expected behaviour.

I have then restarted IIS and then executed a very simple jMeter test of 5 threads with a delay of 1000 milliseconds and I get 5 "In Page_Load" logs instead of the expected 1 as above.

If I restart IIS, open the site in a browser window and then execute the load test I get the single log from the first manual browser request and no more logs as it seems doing that first request through the browser populates the web servers cache and the jMeter load test runs as expected.

Does anyone have experience with jMeter and .Net OutputCache?

Ryan Durkin
  • 813
  • 6
  • 17

1 Answers1

0

I have no experience with .Net OutputCache, but it sounds like your simple JMeter script "looks" different to IIS than your browser.

I would suggest recording the actual browser session with either the built in JMeter http recorder[1] (formerly called the JMeter built in proxy) or with BlazeMeter's JMeter Chrome plugin [2].

I'm guessing playing back an actual browser request might do the trick.

[1] http://jmeter.apache.org/usermanual/component_reference.html#HTTP(S)_Test_Script_Recorder
[2] https://chrome.google.com/webstore/detail/blazemeter-the-load-testi/mbopgmdnpcbohhpnfglgohlbhfongabi?hl=en

Update 1: Try these scenarios:
A - 1 thread with 5 loops (and not 5 threads with 1 loop) B - Use a loop controller in the actual script instead of looping with the thread group. C - Can you try loading the page with a real browser 5 times and totally clearing all cache / cookies / history / etc between loads?

I'm guessing it might have something to do with cookies, though based on what you said earlier that you're using different browsers and didn't see an issue wouldn't make sense. Maybe there is some client side cookie those browsers already had?

Ophir Prusak
  • 1,437
  • 13
  • 20
  • I'm thinking the same too. I hadn't heard of the jMeter test recorder so that's good to know. Tried that but unfortunately the issue is the same. – Ryan Durkin Apr 05 '14 at 16:05
  • Not sure if this is related, but how is caching setup in your scripts? Are you using the cache manager with use cache control checked? Can you upload your script to somewhere? – Ophir Prusak Apr 05 '14 at 16:25
  • Yes, HTTP Cache Manager has been added to the thread group with Use Cache-Control selected – Ryan Durkin Apr 05 '14 at 16:30
  • The script is here. It's pretty basic https://dl.dropboxusercontent.com/u/2612395/TestScript.jmx – Ryan Durkin Apr 05 '14 at 16:34
  • I looked at your script. There must be *something* that is different in how JMeter looks vs using different browsers (cookies??) – Ophir Prusak Apr 08 '14 at 02:03
  • I updated my answer with some more ideas on what to try. – Ophir Prusak Apr 08 '14 at 02:10
  • @RyanDurkin did you figure it out? – Ophir Prusak Apr 11 '14 at 13:40
  • B behaved just as expected but A and C sent me down another path as I was seeing multiple logs refreshing the site in different browser types and only a single log when I dropped jMeter down to a single thread. This then led me to the VaryByCustom attribute described here: http://support.microsoft.com/kb/308375 which explains "This attribute contains the default setting Browser, which means that a different instance of an item is cached for each browser version that requests it" So IIS must be seeing a jMeter thread as a different browser type as I do 3 threads I only see 3 logs – Ryan Durkin Apr 13 '14 at 09:18
  • Ryan, if my answer answers your question any chance of getting it approved? :) – Ophir Prusak Apr 13 '14 at 13:45
  • It still hasn't answered my question as I still need to successfully configure jMeter to not send every thread as a different browser type? – Ryan Durkin Apr 24 '14 at 10:31