Measure serialization and deserialization time

前端 未结 1 2029
伪装坚强ぢ
伪装坚强ぢ 2021-01-22 22:56

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,

1条回答
  •  醉话见心
    2021-01-22 23:12

    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.

    0 讨论(0)
提交回复
热议问题