We have implemented AWS Neptune DB as the graph implementation for our solution, I am having an issue with the connection being timed out multiple times.
This is our local development environment (this is a springboot application) where we access the neptune DB via an ALB and we have setup the traversal like below:
@Bean
public GraphTraversalSource createReadGraphTraversalSource(){
LOGGER.debug("Connecting to neptune endpoint : {}", neptuneDBEndpoint);
Cluster cluster = Cluster.build()
.addContactPoint(neptuneDBEndpoint)
.port(80)
.enableSsl(false)
.serializer(Serializers.GRAPHBINARY_V1D0)
.create();
LOGGER.trace("Read Traversal source setup successfully");
return traversal().withRemote(DriverRemoteConnection.using(cluster));
}
We then create TraversalSources from the GraphTraversalSource object and use this to query as below:
public List<ObjectTO> findLeadsByProject(String projectSid) throws DatabaseException, RecordNotFoundException {
List objectVs = null;
try (GraphTraversal<Vertex, Vertex> graphTraversal = readG.V(parentVSid)) {
leadVs = graphTraversal.out(GraphEdgeLabels.pHasO.name()).hasLabel(GraphVertexLabels..name()).valueMap()
.toList();
objectVs.forEach(vertexMap->{
final ObjectTO objectTO = objectTOSupplier.get();
objectTO.setSystemAttributes((Map<EnumAttributes, String>) vertexMap);
objectVs.add(objectTO);
});
} catch (Exception e) {
throw new DatabaseException(e);
}
if (objectVs.isEmpty()) {
throw new RecordNotFoundException();
}
return objectVs;
}
My call to this DAO API is pretty conventional, RestController -> Service -> DAO API.
The issue that i am facing is that when i make a query i can see that the DAO API returns the results to the service API and the service API does the same to the Rest API but some error happens in there and my API call ends with a 500 internal server error. The Rest API error is not an issue as this is something that i need to take care of, but what is troubling me is that subsequent calls to this API ends up with the following error.
java.util.concurrent.TimeoutException: Timed-out waiting for connection on Host{address=neptune-aws-alb.amazonaws.com/X.XXX.XX.XX:80, hostUri=ws://X.XXX.XX.XX:80/gremlin} - possibly unavailable
I am not sure why this error is happening.