Cleanup Device Detection Databases

Once we faced below error during deployment on one of Content Delivery instance:

Failed to deploy web package to App Service.
More Information: Web Deploy detected insufficient space on disk.
Microsoft.Web.Deployment.DeploymentException: The error code was 0x80070070.
System.IO.IOException: There is not enough space on the disk.

Device Detection- Disk Space

While troubleshooting, one of our DevOps engineer noticed that there were 216 Device Detection Database Files of total 52,988,077,045 bytes in /wwwroot/App_Data/DeviceDetection folder.

Device Detection Databases

We manually deleted old versions of databases at that time and raised Sitecore support ticket.

As per Sitecore,

Device Detection is enabled by default from Sitecore 9.0 and 51Degrees is default provider. New version of database is downloaded to the instance when a user visits site on a device which is not added to the database yet. And old versions of databases are not deleted automatically.

Sitecore provided below workarounds for the issue:

1. Manually delete old versions of databases form /App_Data/DeviceDetection folder.
2. Configure Sitecore.Tasks.CleanupAgent agent to check /App_Data/DeviceDetection folder.

Patch configuration to delete device detection databases which are added 30 days ago. You can configure maxAge as per the frequency of database version creation.

      <agent type="Sitecore.Tasks.CleanupAgent">
          <remove folder="/App_Data/DeviceDetection" pattern="DeviceDetectionDB-*.db" maxAge="30.00:00:00" recursive="false" />          

Sitecore has registered this behavior as a bug and the reference number is 328306.


Tagged: , , ,

2 thoughts on “Cleanup Device Detection Databases

  1. Andy Burns July 19, 2019 at 9:34 am Reply

    Ha! Brilliant. I’ve just found similar on one of our systems – the App Service Backup had failed as there was more than 10GB to back up, and we had 5.3GB of old device detection databases.

    We’ve also had a similar issue due to Content Testing Screenshots you might be interested in:

    Liked by 1 person

  2. Khushboo Sorthiya July 20, 2019 at 9:38 am Reply

    Thanks Andy. I am glad it helped you.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: