测量序列化和反序列化时间 [英] Measure serialization and deserialization time

查看:82
本文介绍了测量序列化和反序列化时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

除了我先前的问题外,还有没有一种方法可以测量gremlin服务器对来自客户端的查询请求进行序列化和反序列化所花费的时间?例如,如果客户端是一个Java应用程序,它将查询请求发送到运行在远程服务器上的gremlin服务器,那么有没有一种方法可以测量从gremlin服务器接收到该请求的时间到将其反序列化,然后再运行查询? >

非常感谢

解决方案

否-我想不出如何直接做到这一点,但是当您这样编写计时要求时:

从gremlin服务器收到请求的时间开始,将其反序列化,然后再运行查询

听起来您只关心测量反序列化时间,在这种情况下,我建议您不要使用Gremlin Server本身,直接为反序列化器编写性能测试.您可以针对驱动程序MessageSerializer实现编写测试,该实现可以在deserializeRequest().您可以在TinkerPop的用于序列化的微型基准中看到所有这些工作方式的示例 解决方案

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.

这篇关于测量序列化和反序列化时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆