.Net Application performance – Active Directory issue

We received a .Net application for performance testing recently. Our tests indicated performance issues with almost all the transactions. As we increased the load, the performance degraded further.

With the help of Dynatrace we could see that all the transactions had common bottleneck – active directory authentication. Under increased load it was taking around 70 sec for active directory authentication.

We initially thought it might be a .Net thread pool issue as performance went bad with increased load. Additionally there was another .Net application that we were testing which showed significant performance improvement after making changes to default .Net thread configuration. But when we made thread configuration changes for this application, nothing happened, no improvements at all.

Development team did an investigation on their end, made some code changes and gave us a new build. Performance was significantly better with the new build. On asking development team about what changes were made, they informed that in the previous build they were fetching entire active directory and storing it as an object in the memory. Authentication was then being done using that object. In the new build they were simply authenticating user directly against active directory, they were no more fetching active directory data and storing it as an object.

Development team had no explanation for why in the first build they were fetching entire active directory and storing it as an object.