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.



This has been fixed in Sitecore 9.3 Initial Release –
In order to fix this bug, the Sitecore.CES.DeviceDetection.Providers.DeviceDetectionClient class is updated. The CleanUpFiles method has been implemented to delete old files when a new file is uploaded successfully.

2 thoughts on “Cleanup Device Detection Databases

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