Saturday, March 19, 2011

Mobile Device Detector - Performance

The last blog post about Mobile Device Detector was so popular, that I've decided to post updates and some results of performance profiling without delays.

Mobile Device Detector has been updated and now supports few more conditions:
  • Pointing method
  • Device OS
  • JavaScript Support
  • Cookie Support
Also, the code was re-factored, in order to be more compatible with future CMS releases.

Regarding the performance testing - I did not try to cover all cases, just a few simple scenarios and basic tools. The following tools were used:
  • jMeter
  • ANTS Performance Profiler
I've measured average(per 2000 requests) response time(ms) with different number of threads and using the same / unique user agent string.
The results are quite interesting:

There is almost no difference in response time when you enable Mobile Device Detector. Looks like detection takes about 1-2ms.

In order to confirm these results, I've performed profiling using ANTS profiler and jMeter:

1. Single thread, same UserAgent:

2. Single thread, random UserAgent:

3. 5 threads, same UserAgent:

4. 5 threads, random UserAgent:

Handling 2000 requests usually takes 2 seconds of CPU time, or ~1ms per request, including Sitecore device resolving logic.

I think these numbers are just fine. There is no sense to compare them directly to the ones found on internet, as the hardware varies a lot(this test was performed at the rather old desktop with 2.13Ghz Intel CPU and DDR2 RAM). Just test(using jMeter, etc) Mobile Device Detector with your solution and see how it affects performance. It would be great if you can share the results.


  1. I'm unable to install your package in a Sitecore 6.4 installation...

    "Could not load file or assembly 'FiftyOne.Foundation' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."

    Please see this screenshot:

  2. I think this might has something to do with the Application Pool not being set to .NET 4.0...

    I installed it on a newly created project and this works. However device detection does not. I can switch devices by using the querystring parameter, however setting a simple rule like: "except where the device supports javascript" for device1 and "where the device supports javascript" for device2 does not select either one...?

  3. Using .net 4.0 is a prerequisite.
    Regarding the "device supports javascript" rule - I've just checked and it seems to work for me. It detects Firefox JavaScript capability without issues.

    Make sure you've published your site, or try to check some other rule, it will help to identify where the problem is.

  4. Publishing the entire content tree solved the problem! Great effort on this module!