Yep - if ntds.dit integrity checks, online defragmentation, and restarting AD DS are all failing, you might not want to keep trying to compact the database. Most AD performance problems are caused by replication, DNS, disk I/O, indexing/query patterns, or excessive directory objects rather than the physical size of ntds.dit.
Start by checking Active Directory replication health. Run repadmin /replsummary and repadmin /showrepl and look for replication failures, high latency, lingering objects, or repeated retries. A domain controller that cannot replicate reliably can also appear slow because LDAP queries and authentication may be affected by stale or inconsistent directory data.
Next, check DNS, because AD relies heavily on DNS for locating domain controllers and services. Verify that domain controllers use appropriate internal AD DNS servers rather than external DNS servers, and run dcdiag /test:dns to identify registration or resolution problems. Slow or incorrect DNS resolution can make authentication and LDAP operations appear significantly slower.
Also investigate disk performance on the domain controller. ntds.dit and the AD database logs are heavily dependent on storage latency. Look at disk response time, IOPS, queue length, and available space, particularly for the volumes containing ntds.dit and the transaction logs. Moving the database and logs to appropriately provisioned, low-latency storage can provide a much larger performance improvement than database compaction.
You should also examine LDAP query activity if the problem is primarily slow directory searches or applications querying AD. Large, unindexed LDAP searches, searches against many attributes, or applications repeatedly querying the entire directory can consume significant CPU and database resources. Event logs and directory diagnostic logging can help identify expensive LDAP operations. If a particular application is responsible, optimizing its LDAP filters and queries is often more effective than modifying the database itself.
Finally, check the overall health of the domain controller with dcdiag, review the Directory Service, DNS Server, and System event logs, and monitor CPU, memory, disk latency, and network utilization. If the DC is overloaded, adding memory/CPU or introducing additional domain controllers can help distribute authentication and LDAP workloads. If the esentutl /g check is actually reporting database corruption, however, that is a different problem and should be addressed as a directory database-recovery issue rather than treated as a normal performance optimization.
If the above response helps answer your question, remember to "Accept Answer" so that others in the community facing similar issues can easily find the solution. Your contribution is highly appreciated.
hth
Marcin