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.
Error Code: ERROR_NOT_ENOUGH_DISK_SPACE
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.

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

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

References

https://doc.sitecore.com/developers/90/sitecore-experience-management/en/using-device-detection.html
https://doc.sitecore.com/developers/90/sitecore-experience-management/en/configure-sitecore-device-detection.html
https://labs.tadigital.com/index.php/2018/11/05/device-detection-in-sitecore/

Advertisements

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: https://andrewwburns.com/2019/07/19/azure-backup-fails-due-to-content-testing-screenshots-not-clearing/

    Liked by 1 person

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

    Thanks Andy. I am glad it helped you.

    Like

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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: