Details
-
Type: Monitor
-
Status: Open
-
Priority: Major
-
Resolution: Unresolved
-
Affects Version/s: None
-
Fix Version/s: None
-
Component/s: FIWARE-TECH-HELP
-
Labels:
-
HD-Enabler:Orion
Description
Created question in FIWARE Q/A platform on 14-03-2019 at 08:03
Please, ANSWER this question AT 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": [
],
"attributes": [
],
"static_attributes": [
]
}
]
}
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":[
],"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@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:
})
orion | INFO@07:32:34 connectionOperations.cpp[177]: Database Operation Successful (query: { query: { $or: [ { contextRegistration.entities: { $in: [
,
{ 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: [
,
{ 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":[
]},"statusCode":{"code":"404","reasonPhrase":"No context element found","details":"sen1"}}]}'
orion | INFO@07:32:34 logMsg.h[1916]: Transaction ended
So, is there a way to reduce this response time without breaking the command execution?
Activity
- All
- Comments
- History
- Activity
- Transitions
2019-03-14 09:06|CREATED monitor | # answers= 0, accepted answer= False