Open RyanRamchandar opened 7 years ago
Did you do any analysis on WHERE this delay might be introduced? I.e. at which moment is it logged in the runtime? I probably would make sense to break your tests into two parts:
I encountered the same problem. However, when the first connect is reached, the message is immediate. Message delay occurred after a period of time.
What was expected: The SSE event stream at
/rest/events/
should emit events in a timely fashion (within 100ms) from the time an action triggers that event, ie. REST calls posting commands/state to Items, adding/removing Things, etc.What happens instead: There is a noticeable, unpredictable, delay between doing an action and the event emitted from the SSE stream. This delay can range from nearly instantaneous <100ms upwards to 30 seconds or more.
Steps to reproduce: I have not found a repeatable way to reproduce the delay though it occurs frequently enough to be an issue. That being said, I was able to exhibit the delay using ApacheBench (tool used to benchmark REST APIs).
I performed a test (admittedly extreme) of sending 10,000 POST requests from 32 concurrent threads:
$ ab -p POST -T text/plain -c 32 -n 10000 http://192.168.1.200:8080/rest/items/thing_442c052dc972_switch1
Where POST is a file that has the text
ON
.The command took about 3 min to complete and gave these results:
I then observed the event stream at
/rest/events
and saw that 1000's of ItemCommandEvents and ItemStateEvent were still happening. This continues on for more than 10 minutes afterwards.Background: We have custom devices that POST commands to Items, eg. Switch Item ON, and listens to the SSE stream at
/rest/events
for ItemCommandEvents. A appropriate device listens to the event stream and acts on ItemCommandEvent that they care about and turn on their switch.Some observations:
openHAB setup: openHAB2 is the 2.0.0 release running on a Pine64 (we have also tested on a MacBook Pro 2015 but the same delay is exhibited)