Can I force a GLV to talk HTTP instead of WS?

Can I force a GLV to talk HTTP instead of WS?



Talking to databases that need persisted connections from serverless infrastructures is getting more and more popular. Although websocket connection establishment is not too heavy weight, I'm thinking talking HTTP fits better for my serverless use case and I'm wondering if I can force GLV's to talk HTTP instead of WS. If not supported, does it add value to support that? The current workaround is to construct HTTP requests myself, but writing java code that traverses the graph looks way more cleaner than having to create http requests with string payloads.




1 Answer
1



Gremlin Language Variants (GLVs) cannot talk over HTTP. That was an explicit design choice. Websockets made it possible to stream results back to the client rather than build up a large result set in memory to return in an HTTP payload. The HTTP endpoint in Gremlin Server that takes Gremlin strings as parameters was built mostly as a bridge from TinkerPop 2.x and Rexster which was REST-oriented in what it did, but TinkerPop doesn't really recommend building applications that way at this point.





Thanks. This is probably a broader scope follow up question, but what is the recommendation for talking Gremlin from serverless infrastructures then? One option is to initialize the cluster in the global context of these serverless functions and then keep them warm by invoking them at regular intervals. Another option would be for the server to support some sort of connection de-duping, so that a new gremlin cluster can try to reestablish connection with a server connection, that was left open previously..
– Karthik Rajan
Aug 27 at 23:02





Speaking in Java terms, the Cluster object should keep your connections alive by issuing a websocket ping at regular intervals. If you have the notion of a global context in which to store the Cluster object i would think that it would simply issue those pings from that context. are you seeing something different?
– stephen mallette
Aug 28 at 10:39


Cluster


Cluster





I'm with you thus far. However, serverless infrastructures almost always contain a cool down logic, where if the serverless function does not get triggered for a while (or if traffic is low), they either put the containers on sleep (or tear down the containers if it is deemed inactive). So when that happens, we wouldn't be sending those websocket pings. By the time the containers are woken up again, the database server would have terminated stale connections.
– Karthik Rajan
Aug 29 at 18:56





hmm - well, i don't know much about those systems, but more and more people are asking about them it seems. the cost of creating new connections isn't too high though is it? i suppose that if container comes online/offline enough times in reasonably rapid succession the server would have a lot of TCP connections waiting to get cleaned up. is that what you're worried about? or something else?
– stephen mallette
Aug 29 at 20:38





Connection establishment takes close to a second in my observation, but if we are doing that only for cold starts, it is not too bad. Server having too much connections is not too much of a concern to me (assuming servers are implemented to kill stale connections), I'm only worried about P99 latencies in this case. Thanks, I think I got the answers I was looking for here. I did try asking a question about this in the serverless tag, in case you're interested! stackoverflow.com/questions/52084483/…
– Karthik Rajan
Aug 29 at 22:23







By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Edmonton

Crossroads (UK TV series)