cancel
Showing results for 
Search instead for 
Did you mean: 

Maximum frequency for querying input.cgi

Posted on May 05, 2015 at 04:39

Hello there, again,

I am trying to query the MCU over WiFi module, using ajax GET requests sent by a browser. The idea is: upon detecting the ''+WIND:56:Insert message to client: '' response, MCU responds appropriately, and this cycle repeats itself periodically.

I've noticed that a sizable number of  GET requests is being rejected or there is no response, especially if the period between sending the requests is less than 500 ms.

I should also say that every request from the browser is sent only after some kind of response from to the previous request, so it never happens that there is more than one pending request.

With 750 ms between ajax requests, it works okay, but I was hoping to do better. What are your experiences regarding this type of communication, aka constant polling of input.cgi?

P.S. I am using input.cgi and ouptut.cgi as means of communication and data exchange between the MCU and the browser, but if you feel there is a better way, do tell 🙂

#input-cgi
20 REPLIES 20
Posted on May 05, 2015 at 11:04

Hi Marko,

what you are experiencing is well known,

Since there is not a lot of RAM inside the module (we are talking about 20Kb, more or less) in ''idle'' state, you can not hold down F5 key on browser.

When RAM goes down to 8Kb, incoming connection is rejected.

Please note that 12 seconds are needed to clear http state after connection is closed. This is called time_wait state.

This is what happened till FW3.3.x

From FW3.4 on, there is a variable called ''ip_wait_timeout'' (default is 12 secs).

Set this variable to a lower value to speedup RAM clean. I expect this improves your polling application.

Hope it helps

jerry

Posted on May 05, 2015 at 11:37

Hey Jerry,

Thanks very much for your prompt response!

I am assuming that is the configuration variable.

What would you say is the acceptable low limit for this ''ip_wait_timeout'' variable?

Thanks!

Posted on May 05, 2015 at 12:00

Yes, it's a new config var.

There is no a low good value. I mean, that value should be higher and higher. Google for ''timewait state''.

You can start from default 12s, and half this value (6, 3, etc) till you reach a good value (for your polling application).

Thanks to you.

j

Posted on May 05, 2015 at 12:15

Ok, thanks, I'll do just that :D

Btw, if you don't mind, let me hijack my own thread for just one more question, related to this.

Sometimes, the loading of the pages is really slow, sometimes it's really fast. Are you famililar with this? Is there anything I can do do make it reliably faster?

Thanks very much!

Posted on May 05, 2015 at 12:55

I think it is the same problem.

Is there is enough RAM, connection is accepted, and web server is able to reply. If not so, connection is aborted, and browser needs to perform a new query later.

To help internal webserver, avoid (limit the number of) nested HTML pages. Every page/object is an HTTP Get Request, and, so, an HTTP Connection (stored for time_wait time)

j

Posted on May 05, 2015 at 13:07

Ah, I see! Will keep it in mind, thanks!

Posted on May 08, 2015 at 16:23

Hi again,

I just noticed that, actually, setting the ''ip_wait_variable'' doesn't seem to work!

Here's what I am sending to the module:

AT+S.SCFG=ip_wait_timeout,6<CR>

(to shorten the wait state to 6s)

Firmware version is 3.4 (150331-4db547e-SPWF01S)

I am receiving:

ERROR: Unrecognized key

What could've gone wrong?

Posted on May 08, 2015 at 17:37

Marko,

first of all, that value should be in milliseconds. Default is 12000. If you want to set as 6 seconds, 6000 is needed.

Then, FW3.4 is 150410-c2e37a3.

Where did you get your (150331-4db547e) release?

j

Posted on May 08, 2015 at 18:39

Ah, I see, thanks!

I got it from the contact from ST upon request, about a couple of weeks ago. Should I switch to different version?