本实例中包括xml、json、pb、msgpack四种的通信格式,采用http通信格式
在实例中我只采用了一个java对象,数据量较小,所以差异并不是非常的明显,但足以说明问题。
客户端压缩后的byte数组的长度与耗时
pb client length:30 cost time:61
pb client length:30 cost time:28
pb client length:30 cost time:27
pb client length:30 cost time:28
服务端解压缩耗时:
cost time:37
xml client length:116 cost time:112
xml client length:116 cost time:47
xml client length:116 cost time:39
xml client length:116 cost time:38
cost time:99
json client length:52 cost time:139
json client length:52 cost time:136
json client length:52 cost time:138
json client length:52 cost time:136
cost time:132
msgpack client length:28 cost time:334
msgpack client length:28 cost time:191
msgpack client length:28 cost time:188
msgpack client length:28 cost time:189
cost time:269
附上msgpack数据的单独实例