Q:

Artifactory - Intermittently Slow response times

We are having issues with gradle builds when integrated with our local Artifactory 5.8.4 server.  Gradle gives exceptions like this: Read timed out.
To troubleshoot this, we used the following (redacted) curl command, and occasionally it will take up to 30-60 seconds to respond:
time curl -u username:password http://localhost:8081/artifactory/libs-snapshot/com/redacted/product/maven-metadata.xml

below is the output from the request.log on the artifactory server:
20180219144146|30190|REQUEST|172.x.x.51|username|GET|/libs-snapshot/com/redacted/product/maven-metadata.xml|HTTP/1.1|200|411

the value 30190 shows that the request is taking 30sec to process for some reason
any ideas of what we can try to resolve this?
--- update ---
as requested by @DrorBereznitsky, i have attached a trace to this endpoint (using curl) below.  Note that the delay seems to be before the trace even starts - this can be seen by the output of the time command showing a clock duration of: real 0m30.316s
[root@afactory ]# time curl -u username:password http://localhost:8081/artifactory/libs-snapshot/com/redacted/product/maven-metadata.xml?trace
Request ID: c1fdcf4f
Repo Path ID: libs-snapshot:com/redacted/product/maven-metadata.xml
Method Name: GET
User: username
Time: 2018-02-23T10:14:36.281+01:00
Thread: http-nio-8081-exec-35
Steps: 
2018-02-23T10:14:36.281+01:00 Received request
2018-02-23T10:14:36.281+01:00 Request source = 127.0.0.1, Last modified = 01-01-70 00:59:59 +01:00, If modified since = -1, Thread name = http-nio-8081-exec-35
2018-02-23T10:14:36.281+01:00 Executing any BeforeDownloadRequest user plugins that may exist
2018-02-23T10:14:36.281+01:00 Retrieving info from {} repository '{}' type 
2018-02-23T10:14:36.281+01:00 Consulting the virtual repo download strategy
2018-02-23T10:14:36.281+01:00 Trying to retrieve resource info from the local storage
2018-02-23T10:14:36.281+01:00 Unable to find resource in libs-snapshot:com/redacted/product/maven-metadata.xml
2018-02-23T10:14:36.281+01:00 Intercepting cached virtual resource with 'PomInterceptor'
2018-02-23T10:14:36.281+01:00 Intercepting cached virtual resource with 'MavenMetadataInterceptor'
2018-02-23T10:14:36.281+01:00 Searching for info in aggregated repositories
2018-02-23T10:14:36.281+01:00 Preparing list of aggregated repositories to search in
2018-02-23T10:14:36.281+01:00 Appending the nested virtual repository 'libs-snapshot'
2018-02-23T10:14:36.281+01:00 Appending the nested virtual repository 'remote-repos'
2018-02-23T10:14:36.281+01:00 Appending the nested virtual repository 'remote-repos'
2018-02-23T10:14:36.281+01:00 Appending collective local repositories
2018-02-23T10:14:36.281+01:00 Appending collective local cache repositories
2018-02-23T10:14:36.281+01:00 Appending collective remote repositories
2018-02-23T10:14:36.281+01:00 Intercepting info request with 'PomInterceptor'
2018-02-23T10:14:36.281+01:00 Intercepting info request with 'MavenMetadataInterceptor'
2018-02-23T10:14:36.282+01:00 The requested resource isn't pre-resolved
2018-02-23T10:14:36.282+01:00 Target repository isn't virtual - verifying that downloading is allowed
2018-02-23T10:14:36.282+01:00 Creating a resource handle from 'libs-snapshot-local:com/redacted/product/maven-metadata.xml'
2018-02-23T10:14:36.282+01:00 Identified requested resource as a file
2018-02-23T10:14:36.282+01:00 Requested resource is an ordinary artifact - using normal content handle with length '411'
2018-02-23T10:14:36.284+01:00 Unable to find resource in ext-snapshot-local:com/redacted/product/maven-metadata.xml
2018-02-23T10:14:36.287+01:00 Info request was intercepted by 'MavenMetadataInterceptor'
2018-02-23T10:14:36.287+01:00 Received resource from an interceptor - returning
2018-02-23T10:14:36.287+01:00 Returning resource as found in the aggregated repositories
2018-02-23T10:14:36.287+01:00 Intercepting found resource with 'PomInterceptor'
2018-02-23T10:14:36.287+01:00 Intercepting found resource with 'MavenMetadataInterceptor'
2018-02-23T10:14:36.287+01:00 Requested resource is found = true
2018-02-23T10:14:36.287+01:00 Request is HEAD = false
2018-02-23T10:14:36.287+01:00 Request is for a checksum = false
2018-02-23T10:14:36.288+01:00 Target repository is not remote or doesn't store locally = true
2018-02-23T10:14:36.288+01:00 Requested resource was not modified = false
2018-02-23T10:14:36.288+01:00 Responding with found resource
2018-02-23T10:14:36.288+01:00 Executing any AltResponse user plugins that may exist
2018-02-23T10:14:36.288+01:00 Alternative response status is set to -1 and message to 'null'
2018-02-23T10:14:36.288+01:00 Found no alternative content handles
2018-02-23T10:14:36.288+01:00 Retrieving a content handle from target repo
2018-02-23T10:14:36.288+01:00 The requested resource is already resolved - using a string resource handle
2018-02-23T10:14:36.288+01:00 Executing any BeforeDownload user plugins that may exist
2018-02-23T10:14:36.288+01:00 Responding with selected content handle
2018-02-23T10:14:36.300+01:00 Request succeeded

real    0m30.316s
user    0m0.002s
sys 0m0.011s

A:

Answering my own question:
I was able to workaround/resolve this, by changing the following Artifactory LDAP settings:
[1] Changed the LDAP URL so it includes the full DN to the OU that contains our users:
ldaps://redacted-server-hostname:636/ou=company-staff,ou=company-users,dc=subdomain,dc=company,dc=com

[2] Disabled Search Sub-tree option.
this seems to have improved performance markedly 

