[Backlogmanager] [FIWARE-JIRA] (HELP-15571) [fiware-stackoverflow] IoT Agents: How to reduce the response time for /v2/entities

Jose Manuel Cantera (JIRA) jira-help-desk at jira.fiware.org
Thu Mar 14 10:24:00 CET 2019


     [ https://jira.fiware.org/browse/HELP-15571?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Jose Manuel Cantera updated HELP-15571:
---------------------------------------
    Summary: [fiware-stackoverflow] IoT Agents: How to reduce the response time for /v2/entities  (was: [fiware-stackoverflow] ORION: How to reduce the response time for /v2/entities)

> [fiware-stackoverflow] IoT Agents: How to reduce the response time for /v2/entities
> -----------------------------------------------------------------------------------
>
>                 Key: HELP-15571
>                 URL: https://jira.fiware.org/browse/HELP-15571
>             Project: Help-Desk
>          Issue Type: Monitor
>          Components: FIWARE-TECH-HELP
>            Reporter: Backlog Manager
>            Assignee: Jose Gato Luis
>              Labels: fiware, fiware-orion
>
> Created question in FIWARE Q/A platform on 14-03-2019 at 08:03
> {color: red}Please, ANSWER this question AT{color} https://stackoverflow.com/questions/55157273/orion-how-to-reduce-the-response-time-for-v2-entities
> +Question:+
> ORION: How to reduce the response time for /v2/entities
> +Description:+
> I've deployed the iot stack with docker. These are the used containers:
> fiware/orion:2.1.0
> fiware/iotagent-json:1.9.0
> GIVEN: The following device template:
> {
>     "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"
>                 }
>             ]
>         }
>     ]
> }
> WHEN: Register a large amount of devices on the IoT agent running the following shell script:
> # 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: Trying to get these entities from Orion.
> curl --request GET \
>   --url 'http://localhost:1026/v2/entities/?limit=1000' \
>   --header 'fiware-service: test' \
>   --header 'fiware-servicepath: /test'
> THEN: The response time is too long, around 15516 ms
>   
>   I have checked the Orion command line argument -cprForwardLimit equal to 0 but this causes the execution of commands not to work. It through the following 404 error.
>   
> orion            | INFO at 07:32:34  logMsg.h[1832]: Starting transaction from 172.18.0.1:38752/v1/updateContext
> orion            | DEBUG at 07:32:34  rest.cpp[1414]: Got 417 of payload of 417 bytes
> orion            | INFO at 07:32:34  rest.cpp[885]: Service Path 0: '/test'
> orion            | INFO at 07:32:34  connectionOperations.cpp[94]: Database Operation Successful (query: { _id.id: "sen1", _id.type: "sensor", _id.servicePath: { $in: [ /^/test$/ ] } })
> orion            | INFO at 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 at 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 at 07:32:34  restReply.cpp[75]: Response 6: responding with 237 bytes, Status Code 200
> orion            | DEBUG at 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 at 07:32:34  logMsg.h[1916]: Transaction ended
>   So, is there a way to reduce this response time without breaking the command execution?



--
This message was sent by Atlassian JIRA
(v6.4.1#64016)


More information about the Backlogmanager mailing list

You can get more information about our cookies and privacy policies clicking on the following links: Privacy policy   Cookies policy