Quoting Simon Hildrew <[email protected]>:
Hi folks,
I'm trying to get to the bottom of why my call to list security groups in
nova is very slow.
This is some of my code (scala):
val context = ContextBuilder.newBuilder("openstack-nova")
.endpoint(origin.endpoint)
.credentials(s"${origin.tenant}:${origin.user}", origin.secret)
.build(classOf[ComputeServiceContext])
val compute = context.getComputeService
val securityGroupExtension = compute.getSecurityGroupExtension.get
val secGroups = securityGroupExtension.listSecurityGroups
val result = secGroups.map ( fromJCloud(_, existingGroups) )
Most of this is very quick, but when debugging I see that the call to
listSecurityGroups is slow. In one example run this took 6 minutes and 17
seconds to retrieve 32 security groups.
I've started to dig into this by observing the calls to the API. During the
six minute method call, 93 separate requests are made to the openstack
apis. The first is a call to GET /v2/<id>/extensions and the following 92
are calls to GET /v2/<id>/os-security-groups. These 92 calls all get an
identical response from the API and the calls are made with about 4 seconds
delay.
The wire and header logging (if you haven't already enabled that)
might help your investigations here. It'll add overhead too, of
course, but that should be reasonably constant [1].
As regards the code, NovaSecurityGroupExtension is where you'll want
to start looking. It might be interesting to break out your call into
separate listSecurityGroupsInLocation [3] calls to see if that helps
narrow down the cause...
Hope that helps!
ap
[1] http://jclouds.apache.org/documentation/reference/jclouds-logging/
[2]
https://github.com/jclouds/jclouds/blob/master/apis/openstack-nova/src/main/java/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.java#L97
[3]
http://javadocs.jclouds.cloudbees.net/org/jclouds/openstack/nova/v2_0/compute/extensions/NovaSecurityGroupExtension.html#listSecurityGroupsInLocation(org.jclouds.domain.Location)