windows – LookupAccountName is taking 20 seconds after system reboot

I am using LookupAccountName to get sid and domain name for the user.

My system (Windows 10) is connected to domain controller. If I reboot the system, the LookupAccountName call takes more than 20 seconds. After first call, any subsequent call takes only few ms.

Could this be related to any configuration issue on the domain controller or on the system where the program is being executed?

Is there a way to improve this?