Fiware ORION:如何减少/v2/实体的响应时间

Fiware ORION:如何减少/v2/实体的响应时间,fiware,fiware-orion,Fiware,Fiware Orion,我已经和docker一起部署了物联网堆栈。这些是用过的容器: fiware/orion:2.1.0 使用的命令行选项:-corsOrigin\uu ALL-corsMaxAge 600-dbhost mongo orion-logLevel DEBUG-logForHumans-t 180-199 fiware/IoAgent json:1.9.0 给定:以下设备模板: { "devices": [ { "device_id": "sen

我已经和docker一起部署了物联网堆栈。这些是用过的容器:

  • fiware/orion:2.1.0
使用的命令行选项:
-corsOrigin\uu ALL-corsMaxAge 600-dbhost mongo orion-logLevel DEBUG-logForHumans-t 180-199

  • fiware/IoAgent json:1.9.0

给定:以下设备模板:

{
    "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"
                }
            ]
        }
    ]
}
何时:在运行以下shell脚本的物联网代理上注册大量设备:

# 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
和:正在尝试从Orion获取这些实体

curl --request GET \
  --url 'http://localhost:1026/v2/entities/?limit=1000' \
  --header 'fiware-service: test' \
  --header 'fiware-servicepath: /test'

然后:响应时间太长。它介于13447ms15516ms之间


  • 我已检查Orion命令行参数-cprowardlimit是否等于0,但这会导致命令执行不起作用。它通过以下404错误执行
那么,有没有办法在不中断命令执行的情况下减少此响应时间?


可以肯定的是。。。你的意思是
GEThttp://localhost:1026/v2/entities?limit=1000
-cprowardlimit
不是0时,请求大约需要15秒,不是吗?是@fgalan,这些是执行orion的当前命令行参数<代码>-corsOrigin\uu ALL-corsMaxAge 600-dbhost mongo orion-logLevel DEBUG-logForHumans-t 180-199。我不使用
-cprowardlimit
参数。如果我使用此参数,我将失去命令的执行。在使用
-cprowardlimit 0
的情况下(我知道,您不能使用该配置,但只是为了了解…),需要多长时间才能获得
http://localhost:1026/v2/entities?limit=1000
?你好@fgalan,使用
-cprowardlimit 0
时,响应时间约为232ms。要完全确定。。。你的意思是
GEThttp://localhost:1026/v2/entities?limit=1000
-cprowardlimit
不是0时,请求大约需要15秒,不是吗?是@fgalan,这些是执行orion的当前命令行参数<代码>-corsOrigin\uu ALL-corsMaxAge 600-dbhost mongo orion-logLevel DEBUG-logForHumans-t 180-199。我不使用
-cprowardlimit
参数。如果我使用此参数,我将失去命令的执行。在使用
-cprowardlimit 0
的情况下(我知道,您不能使用该配置,但只是为了了解…),需要多长时间才能获得
http://localhost:1026/v2/entities?limit=1000
?Hi@fgalan,使用
-cprowardlimit 0
响应时间约为232ms。
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