JMeter 基准测试 JSON 与 MessagePack

JMeter benchmark JSON vs MessagePack

我想使用 JMeter 对具有与 JSON

不同的数据序列化格式的服务器到服务器通信 (Java Spring) 进行基准测试

文章Why not JSON? is suggesting MessagePack

MessagePack is an efficient binary serialization format. It lets you exchange data among multiple languages like JSON. But it's faster and smaller.

我可以使用 JMeter 作为基准发送 JSON 消息与 MessagePack 相比吗?它可以比较什么?我可以检查接收方获取请求的时间还是发送方准备和发送请求的时间?或者还有其他 considerations/known 问题阻止了这两者?

You can use JMeter for literally anything, in case of MessagePack you can go for MessagePack Serializer for Java - this will allow you creating binary request payloads on JMeter side i.e. using JSR223 PreProcessor and Groovy language (it's 99.9% Java-compatible so example code will work just fine)

With regards to metrics, they should be the same as usually, your main targets should be:

  1. Response time (lower is better)
  2. Throughut - number of requests per unit of time (higher is better)

Given JSON and MessagePack are served by the same host network-specific metrics like Latency and Connect Time and be ignored. Check out JMeter Glossary for main metrics listed and explained.

I would also pay attention to server-side metrics like CPU or Memory usage as potentially deserialising binary data and serialising it back can be more resources intensive so my expectation is that MessagePack implementation will have larger footprint. You can use i.e. SSHMon Listener or JMeter PerfMon Plugin in order to check your system under test resources usage while your test is 运行 - this way you will be able to correlate increasing load with increasing resources consumption.