[QUESTION] 反序列化JSON数组性能问题
从火焰图观查到JSONArray logs = JSON.parseArray(byte[] message)一步时耗费CPU,如下:
帮看下还有优化空间吗?
jdk版本: 8 fastjson版本: 2.0.48
大概是怎样的一个JSON结构?
大概是怎样的一个JSON结构?
一条数据是一个JSON数组: [{19个字段,是基本数据类型; 无嵌套},{}, {}...]
大概是怎样的一个JSON结构?
一条数据是一个JSON数组: [{19个字段,是基本数据类型; 无嵌套},{}, {}...]
一个JSON数组大概120kb。
可以提供一个样本么?
可以提供一个样本么? 类似这样
@wenshao 会不会是因为有中文导致性能变差了
可以提供文本么,不要让我手工录入一遍哈
可以提供文本么,不要让我手工录入一遍哈
[
{
"content": "[INFO][2024-04-09T17:04:31.696 +0800][line=/home/logger/webroot/abc/application/internalapi/v1/vendor/disf/spl/src/Thrift-rpc/ThriftSdk.php +251 class=Disf\\SPL\\ThriftSdk function=Disf\\SPL\\ThriftSdk::__call]_com_dirpc_info||traceid=177798uy3a6615049f00005b71d5ae4f02||spanid=80c723c-71197-4643-8a56-71dbb217b982||cspanid=6cd551f6f4bca4db4||hintcode=||hintcontent={\"xregionkeyname\":\"xxx\",\"xregionkeyvalue\":\"1\",\"Cityid\":-1,\"sample\":{\"code\":128},\"dlang\":\"zh-CN\",\"xxxUtcOffset\":\"480\"}||caller=hna-v.biz-gs-internalapi||callee=hna-v.biz-gs-ofs||caller-func=/gulfstream/internalapi/v1/hookhandler/xxxArrivedHook/push||callee-func=getOrderFeature||clazz=Disf\\SDK\\Ofs\\Thrift\\OrderFeatureServiceClient||request=Array info :[{\"orderId\":xxxx,\"featureScenes\":[{\"featureSceneType\":5,\"featureKeys\":[\"arrive_xxx_lng\",\"arrive_xxx_lat\"]}]},{\"traceId\":\"xxxx\",\"caller\":\"\",\"spanId\":\"6c551f6f4bca4db4\",\"srcMethod\":\"\",\"hintCode\":\"\",\"hintContent\":\"{\\\"xregionkeyname\\\":\\\"xxx\\\",\\\"xregionkeyvalue\\\":\\\"1\\\",\\\"Cityid\\\":1,\\\"sample\\\":{\\\"code\\\":128},\\\"dlang\\\":\\\"zh-CN\\\",\\\"xxxUtcOffset\\\":\\\"480\\\"}\"}]||errno=0||errmsg=OK||latency=1.860||footprint={addr=xxxx:xx,errno=0,latency=1.837,errmsg=OK}||response={\"errNo\":0,\"errMsg\":\"OK\",\"data\":{\"5\":{\"arrive_xxx_lat\":\"xxx\",\"arrive_xxx_lng\":\"xxx\"}}}||callerhostname=biz-internal-api-hna-sf-ae163-152.docker.gz01||callee-addr=x.x.x.x:xx||protocol=thrift||sendtimeoutms=50||recvtimeoutms=50||retry=1||retryflag=0",
"hostName": "biz-internal-api-hna-sf-ae163-152.docker.gz01",
"uniqueKey": "5915ef9d600e281b5a411079b874593d_285568140_1712653471696",
"originalAppName": "internal-api.gs.biz",
"odinLeaf": "hna-v",
"logTime": 1712653471696,
"logId": 934168,
"appName": "internal-api.gs.biz",
"queryFrom": "大数据平台",
"logName": "dirpc.log",
"isService": 1,
"pathId": 1591250,
"timestamp": "1712653471696",
"collectTime": 1712653471904,
"fileKey": "64785_1081350059",
"parentPath": "/home/hostpath/biz-internal-api-hna-sf-ae163/biz-internal-api-hna-sf-ae163-152/home/logger/data1/webroot/gulfstream/log/internalapi",
"offset": 285568140,
"preOffset": 285566618,
"ENV_ODIN_SU": "hna-v.biz-gs-internalapi"
}
]
可以提供文本么,不要让我手工录入一遍哈
[ { "content": "[INFO][2024-04-09T17:04:31.696 +0800][line=/home/logger/webroot/abc/application/internalapi/v1/vendor/disf/spl/src/Thrift-rpc/ThriftSdk.php +251 class=Disf\\SPL\\ThriftSdk function=Disf\\SPL\\ThriftSdk::__call]_com_dirpc_info||traceid=177798uy3a6615049f00005b71d5ae4f02||spanid=80c723c-71197-4643-8a56-71dbb217b982||cspanid=6cd551f6f4bca4db4||hintcode=||hintcontent={\"xregionkeyname\":\"xxx\",\"xregionkeyvalue\":\"1\",\"Cityid\":-1,\"sample\":{\"code\":128},\"dlang\":\"zh-CN\",\"xxxUtcOffset\":\"480\"}||caller=hna-v.biz-gs-internalapi||callee=hna-v.biz-gs-ofs||caller-func=/gulfstream/internalapi/v1/hookhandler/xxxArrivedHook/push||callee-func=getOrderFeature||clazz=Disf\\SDK\\Ofs\\Thrift\\OrderFeatureServiceClient||request=Array info :[{\"orderId\":xxxx,\"featureScenes\":[{\"featureSceneType\":5,\"featureKeys\":[\"arrive_xxx_lng\",\"arrive_xxx_lat\"]}]},{\"traceId\":\"xxxx\",\"caller\":\"\",\"spanId\":\"6c551f6f4bca4db4\",\"srcMethod\":\"\",\"hintCode\":\"\",\"hintContent\":\"{\\\"xregionkeyname\\\":\\\"xxx\\\",\\\"xregionkeyvalue\\\":\\\"1\\\",\\\"Cityid\\\":1,\\\"sample\\\":{\\\"code\\\":128},\\\"dlang\\\":\\\"zh-CN\\\",\\\"xxxUtcOffset\\\":\\\"480\\\"}\"}]||errno=0||errmsg=OK||latency=1.860||footprint={addr=xxxx:xx,errno=0,latency=1.837,errmsg=OK}||response={\"errNo\":0,\"errMsg\":\"OK\",\"data\":{\"5\":{\"arrive_xxx_lat\":\"xxx\",\"arrive_xxx_lng\":\"xxx\"}}}||callerhostname=biz-internal-api-hna-sf-ae163-152.docker.gz01||callee-addr=x.x.x.x:xx||protocol=thrift||sendtimeoutms=50||recvtimeoutms=50||retry=1||retryflag=0", "hostName": "biz-internal-api-hna-sf-ae163-152.docker.gz01", "uniqueKey": "5915ef9d600e281b5a411079b874593d_285568140_1712653471696", "originalAppName": "internal-api.gs.biz", "odinLeaf": "hna-v", "logTime": 1712653471696, "logId": 934168, "appName": "internal-api.gs.biz", "queryFrom": "大数据平台", "logName": "dirpc.log", "isService": 1, "pathId": 1591250, "timestamp": "1712653471696", "collectTime": 1712653471904, "fileKey": "64785_1081350059", "parentPath": "/home/hostpath/biz-internal-api-hna-sf-ae163/biz-internal-api-hna-sf-ae163-152/home/logger/data1/webroot/gulfstream/log/internalapi", "offset": 285568140, "preOffset": 285566618, "ENV_ODIN_SU": "hna-v.biz-gs-internalapi" } ]
一个数组中大概50条