我已经在docker上部署了物联网堆栈。这些是使用过的容器:
使用的命令行选项: -corsOrigin __ALL -corsMaxAge 600 -dbhost mongo-orion -logLevel DEBUG -logForHumans -t 180-199
给予:以下设备模板:
{
"devices": [
{
"device_id": "sen-n",
"entity_name": "sen-n",
"entity_type": "sensor",
"transport": "HTTP",
"protocol": "IoTA-JSON",
"endpoint": "http://nodered:1880/notification",
"commands": [
{
"name": "ping",
"type": "command"
}
],
"attributes": [
{
"object_id": "status",
"name": "status",
"type": "Text"
}
],
"static_attributes": [
{
"name": "name",
"type": "Text",
"value": "Sensor n"
}
]
}
]
}
时间:在运行以下外壳程序脚本的 IoT代理上注册大量设备:
# Bash execution example: sudo chmod +x run.sh --> ./run.sh 1100
# Sh execution example: sh run.sh 1100
#!/bin/bash
for n in $(seq "$1")
do
echo "Inserting $n device"
curl --request POST \
--url 'http://localhost:4041/iot/devices' \
--header 'Content-Type: application/json' \
--header 'fiware-service: test' \
--header 'fiware-servicepath: /test' \
--data '{"devices":[{"device_id":"sen-'$n'","entity_name":"sen-'$n'","entity_type":"sensor","transport":"HTTP","protocol":"IoTA-JSON","endpoint":"http://nodered:1880/notification","commands":[{"name":"ping","type":"command"}],"attributes":[{"object_id":"status","name":"status","type":"Text"}],"static_attributes":[{"name":"name","type":"Text","value":"Sensor '$n'"}]}]}'
done
AND :尝试从Orion获取这些实体。
curl --request GET \
--url 'http://localhost:1026/v2/entities/?limit=1000' \
--header 'fiware-service: test' \
--header 'fiware-servicepath: /test'
时间:。响应时间过长。它在 13447ms 和 15516ms 之间。
- 我已经检查了Orion命令行参数 -cprForwardLimit ,该参数等于 0 ,但这导致命令的执行无法正常进行。通过以下 404错误。
orion | INFO@07:32:34 logMsg.h[1832]: Starting transaction from 172.18.0.1:38752/v1/updateContext
orion | DEBUG@07:32:34 rest.cpp[1414]: Got 417 of payload of 417 bytes
orion | INFO@07:32:34 rest.cpp[885]: Service Path 0: '/test'
orion | INFO@07:32:34 connectionOperations.cpp[94]: Database Operation Successful (query: { _id.id: "sen1", _id.type: "sensor", _id.servicePath: { $in: [ /^/test$/ ] } })
orion | INFO@07:32:34 connectionOperations.cpp[177]: Database Operation Successful (query: { query: { $or: [ { contextRegistration.entities: { $in: [ { id: "sen1", type: "sensor" }, { type: "sensor", id: "sen1" } ] } }, { contextRegistration.entities.id: { $in: [] } } ], expiration: { $gt: 1552548754 }, contextRegistration.attrs.name: { $in: [ "ping" ] }, servicePath: { $in: [ /^/test$/ ] } }, orderby: { _id: 1 } })
orion | INFO@07:32:34 connectionOperations.cpp[177]: Database Operation Successful (query: { query: { $or: [ { contextRegistration.entities: { $in: [ { id: "sen1", type: "sensor" }, { type: "sensor", id: "sen1" } ] } }, { contextRegistration.entities.id: { $in: [] } } ], expiration: { $gt: 1552548754 }, servicePath: { $in: [ /^/test$/ ] } }, orderby: { _id: 1 } })
orion | DEBUG@07:32:34 restReply.cpp[75]: Response 6: responding with 237 bytes, Status Code 200
orion | DEBUG@07:32:34 restReply.cpp[76]: Response payload: '{"contextResponses":[{"contextElement":{"type":"sensor","isPattern":"false","id":"sen1","attributes":[{"name":"ping","type":"command","value":""}]},"statusCode":{"code":"404","reasonPhrase":"No context element found","details":"sen1"}}]}'
orion | INFO@07:32:34 logMsg.h[1916]: Transaction ended
那么,有没有办法在不中断命令执行的情况下减少此响应时间?