Q:

Report database Rebuild ridiculously slow

I'm running Sitecore 9.0.1 and trying to rebuild a reporting database. The problem is that the process is ridiculously slow. How slow? Here's a screenshot:

After 26 hours 127 items were processed of 178.839 in total. I went over the logs of the processing and reporting server, they show no error but this:
ManagedPoolThread #8 17:12:01 WARN  Authentication on CES Discovery service failed.
Exception: System.Net.WebException
Message: The remote server returned an error: (403) Forbidden.
Source: System
   at System.Net.HttpWebRequest.GetResponse()
   at Sitecore.CES.Client.WebClient.<>c__DisplayClass6_0.<ExecuteRequest>b__0()
   at Sitecore.CES.Client.WebClient.Execute[T](Func`1 action, String requestUri)
   at Sitecore.CES.Client.ResourceConnector`1.Request(String endpoint, Object[] parameters)
   at Sitecore.CES.Discovery.EndpointSource.GetEndpoint(String serviceName)

ManagedPoolThread #8 17:12:01 ERROR Could not update device detection database
Exception: System.ArgumentNullException
Message: Null ids are not allowed.
Parameter name: endpointUri
Source: Sitecore.Kernel
   at Sitecore.Diagnostics.Assert.ArgumentNotNullOrEmpty(String argument, String argumentName)
   at Sitecore.CES.Client.WebClient.DownloadBinaryContent(String endpointUri, String resourcePath, DownladBinaryContentParameters parameters)
   at Sitecore.CES.DeviceDetection.Providers.FiftyOneDegrees.FiftyOneDeviceDetectionClient.GetNewerVersion()
   at Sitecore.CES.DeviceDetection.Providers.FiftyOneDegrees.FiftyOneDeviceDetectionClient.DoUpdate(String serviceName, String& newDatabasePath, String& newDatabaseVersion)
   at Sitecore.CES.DeviceDetection.Providers.DeviceDetectionClient.Update()

Could this cause this kind of behavior? This problem happens across all Sitecore servers we run for this client, CM, CD, PROC, REP, all. Or is there anything else there?
Does anyone has any tip on what could cause such slowliness?
thank you

A:

I have applied the hotfix as instructed by George Tucker and increased the number of history workers as instructed by Chris Auer, in my case I have raised from 1 to 500. I'm getting much better speed now, around 1.500 items per minute! I have no idea if the hotfix had any role on this because I did both things before running the rebuild again.
Update
Setting history workers to 500 was too much for the server, Sitecore recommended me to set to 16 as I had a single dedicated server for processing. But one of the problems I was having after raising the number of history workers was that after some time the processing (rate of items processed per minute) was slowing down almost to a halt, independent of the number of history workers.
After contacting Sitecore they said it was something to do with the implementation of the processing server and sent me Sitecore.Support.230550.dll and Sitecore.Support.230550.config. After patching the processing server with these files my rebuild was completed sucessfully after 10 hours of processing (arounf 320K items).

