onpremise

Is Cloud Mobile Detection Compromising Mobile Web Experience?

Engineering

1/16/2013 10:11 PM

Device Detection Mobile Cloud Development

Device detection allows a website to know what mobile device is currently being used to browse it. This allows developers to specifically tailor a web page to accommodate different device types. There are two technical approaches that can be used to detect mobile devices: On-Premise and Cloud based. This blog explains the advantages and disadvantages of each and provides free source code to enable you to evaluate which solution is right for your organisation.

Comparison Table

Detection Type On-Premise Cloud
Total Detection Time 23ms or less >200ms
Maintenance Automatic (with 51Degrees.mobi) 3rd Party
Cost Free Unlimited Detections Free for 5,000 detections (ScientiaMobile)
Availability 100% (Same as web server) Variable

On-Premise Solution

An On-Premise solution refers to a solution that runs on the local web server. All the required data is held locally and the detection rates can be extremely fast, though some memory and CPU overheads are incurred. Some on-premise solutions will also require the user to manually maintain and update the device data but overall On-Premise device detection offers an affordable, high performance and responsive way of detecting mobile devices for your website.

onpremise

Cloud Based Solution

The “Cloud” is a term used to describe any service that is computed remotely and passed back over the internet to the local web server. A Cloud device detection solution works by sending data about the requesting device to a remote server. This server then determines the device type and sends the result back over the internet to be used to offer the mobile web user a more enriched experience.

The following diagram explains the process:

cloud

The obvious advantage of the Cloud approach lies within the remote computer processing all the calculations. This relieves any overhead on the local web server; however, as detection information is passed across the internet there will always be travel time added to the total detection speed. This added distance will penalise your mobile web users, causing their experience to be far more sluggish. Updating the Cloud service is normally not a problem as a reputable service provider will be responsible for updates. The service provider will of course charge for their service, usually basing charges on the number of detections performed.

If the connection between your web server and cloud solution are slow, then your web site will slow down. If internet connection between your server and the cloud are lost at any point (if the cloud service is unreliable and drops), then you are left without a detection solution which would stop the web server operating correctly.

Comparison Test

To compare these two approaches a simple test was created that reviews the time it takes to detect if a device is mobile and to retrieve a result from the 51Degrees.mobi PHP device detection solution running on both a local On-Premise server and on a cloud. Both solutions ran on the my.PHPcloud.com hosting service, with the cloud installation running on an Amazon high-CPU, extra-large, ec2 Instance named: c1.xlarge.

serverused

Below are the following results of the test:

"is mobile" Detection Request Detection Time(ms) Cloud Detection Time(ms) Cloud Total Detection(ms) Cloud Travel Time(ms)
1 16.7 13.6 204.4 190.8
2 41.6 21.9 210 188.1
3 19.6 20.6 243 222.4
4 18 21.3 221.9 200.6
5 20.1 21 202.3 181.3
6 19.1 14.1 200 185.9
7 43.2 14.1 202 187.9
8 18 14.1 201.7 187.6
9 15.3 18.9 220.8 201.9
10 16.5 13.6 194.4 180.8
Average 22.81 17.32 210.05 192.73

As you can see the results show that although both servers managed to detect the devices in very similar times (22.81ms VS 17.32ms), the total detection time is far greater for the cloud. This is solely due to the amount of time that it takes for the data to be transferred across to the cloud and back (Cloud Travel Time). When you compare the overall time for a device to be detected between the two approaches (210.05 VS 22.81), you can easily see that using an on-premise solution is a far speedier option, being able to detect over 9 times faster than the cloud approach. Even if the cloud service took 0ms to calculate the result the overall detection time would be far slower than the on-premise detection.

So, is there a use for the cloud?

With 51Degrees.mobi solution available for PHP, Java, .NET and C supporting the majority of web sites there's no need to accept slower performance, increased complexity, and risk reduced availability using a cloud service. We also offer a hybrid of providing an on-premise solution that uses the cloud to periodically update the local device data repository. This method gives you the best of both worlds: The performance of an on-premise solution and the automatically updated device data that the cloud can offer.