Jump to content

REST interface can be slow


brandwidth

Recommended Posts

I rely quite a lot on the REST interface to pass state into and out of the ISY from variables - sometimes it can be very slow (e.g. a request for /rest/vars/definitions/1 can take >20s to return the results).

Spending time debugging this today - I may consider caching the definitions results and refreshing it occasionally (I don't add/remove variables often) as it seems to be the slowest part of everything.

Has anyone else seen this issue?

Link to comment

Just thought of this.  Where's the majority of the slowness?  When setting a var?  That should be super fast.  Or is it doing a query for a lot of info and then you process on the backend?  If you're looking to pull a lot of state info from ISY you may want to use the websocket or a direct socket for getting data real time.

Link to comment

F/W 5.0.15A

Devices: ~50, all Insteon (there are a few other things via Polyglot)

The slowness is when I read all the variables to grab their IDs. Websocket may be the way to go, agreed.

I'm using http - everything's on my subnet so I'm not concerned about http

The only programs I have which loop do so no more than once per minute, and it's rare for more than six or seven of them to be looping at the same time.

I've improved logging on the machine that's running the other services, so I should be able better to identify where the slowdowns are occurring.

Thanks for the suggestions - updates to come :)

Link to comment

I have one program which runs every minute, all it does is update sixteen variables on the ISY.

If I disable it, the instances of the REST interface taking >20s to set a variable go away.

Just rebooted my ISY, and left the program in question disabled... will see if that stops the issue.

Since the slowness occurs when setting variables, I don't think PyISY will help, but I'll take a look - thanks for the tip, @Jimbo.

Link to comment
6 hours ago, brandwidth said:

I have one program which runs every minute, all it does is update sixteen variables on the ISY.

If I disable it, the instances of the REST interface taking >20s to set a variable go away.

Just rebooted my ISY, and left the program in question disabled... will see if that stops the issue.

Since the slowness occurs when setting variables, I don't think PyISY will help, but I'll take a look - thanks for the tip, @Jimbo.

Of the 16 vars being set are they all valid?  Possibly an invalid variable set is hanging things until it times out?

Link to comment
On 8/24/2019 at 5:24 PM, brandwidth said:

 (e.g. a request for /rest/vars/definitions/1 can take >20s to return the results).

Not sure it helps but my rest command from Blue Iris to the ISY via http looks different:

http://user:password@192.168.0.69/rest/vars/set/2/38/1

I also use similar rest between my alarmserver to set 15 variables in the ISY and commands are almost instant and has worked for years...

mike

Link to comment
14 hours ago, simplextech said:

Of the 16 vars being set are they all valid?  Possibly an invalid variable set is hanging things until it times out?

That program is running on ISY (I should have stated that, sorry) - and all the variables are valid.

Still some weirdness going on - I'm going to dig into it more, and I'll report back in case any of this is helpful to others. I've had super-fast responses from REST for years, but something is now filling up the IO queues...I'll get to the bottom of it!

Link to comment

By ‘running on the ISY’ (and by saying you are using the REST API) - can I assume that you have the ‘Host’ field set to the actual IP address of the ISY in the network resources (and not 127.0.0.1 or localhost).

Using any kind of loopback interface has been known to cause deadlocks and crashes in ISY - and that could be the cause of your issues.

Link to comment
3 minutes ago, MWareman said:

By ‘running on the ISY’ (and by saying you are using the REST API) - can I assume that you have the ‘Host’ field set to the actual IP address of the ISY in the network resources (and not 127.0.0.1 or localhost).

Using any kind of loopback interface has been known to cause deadlocks and crashes in ISY - and that could be the cause of your issues.

1. The program I'm referring to is an ISY program which directly sets 15 variables once per minute - it doesn't use network resources at all, i.e. I don't have the ISY talking to itself via REST

2. I have other Python/PHP scripts running on a server which use the REST API. Good to know that loopback can be problematic - thanks!

Link to comment

Archived

This topic is now archived and is closed to further replies.


×
×
  • Create New...