问题
In addition to my previous question please, is there a way to measure the time it takes gremlin server to serialize and deserialize a query request from the client? For example, if the client is a java application that sends query request to gremlin server running on a remote server, is there a way to measure the time from the point gremlin server receives the request, deserializes it, before running the query?
Many thanks
回答1:
No - I can't think of how to do that directly, but when you write your timing requirement like this:
the time from the point gremlin server receives the request, deserializes it, before running the query
it sounds like you only care about measuring the deserialization time in which case I'd suggest that you get Gremlin Server itself out of the way and write performance tests for the deserializer directly. You could write your tests against the driver MessageSerializer
implementations which can be found here. Those classes are used by both the driver and the server for all serialization/deserialization activities.
I'm not sure what kind of benchmark you are looking to write, but in the most simple case you could just instantiate the serializer you care about testing, for example, GraphSONMessageSerializerV3d0
, construct a RequestMessage
as a ByteBuf
(the only "hard" part) and time the method call to deserializeRequest()
. You can see an example of how all this works in TinkerPop's micro-benchmarks for serialization here which uses the JMH toolkit.
来源:https://stackoverflow.com/questions/60299092/measure-serialization-and-deserialization-time