04-22-2011 07:22 PM
The only mention I've found anywhere about using multiple web method instances is in this post:
"If the web method VI is marked reentrant, than multiple requests can be handled concurrently (and your application logic should account for that fact). If the web method is not marked reentrant, than only one request at a time can call the VI and subsequent request threads will block waiting to be able to call your VI." darenw, talking about web services in 8.6.
This makes plenty of sense and is what I expect. However, I find this not to be the case [using 2010 SP1]. My example is very simple:
Make the web method VI consist only of a "Wait (ms)" function set to wait for 10000 ms [10 s]. Check the "reentrant execution" box in the VI Properties dialog. Add the web method VI to a RESTful Web Service build spec and build and deploy. Then type the URL for the web method into two browser windows and send both queries at close to the same time. The first window will take 10s waiting for a response before finishing, as expected. The second window will take 20s--apparently the second instance of the web method VI does not start running until the first instance is completed.
Not only does this conflict the the quote above, but it's a poor behavior for web services in general [and it's fatal to my application in particular]. [To be complete I should add that running the web method VI in multiple parallel instances in the same container VI results in a 10s run as expected].
Is this a bug or what?
[this is an appendage to this ongoing discussion but is distinct enough from the original topic that I decided it should get its own--I apologize for the clutter if that was the wrong decision]
04-25-2011 06:06 PM
I was able to reproduce the same issue that you're talking about in LV 2010 as well as 2010 SP1 with a re-entrant VI. I'm in the process of trying the same thing using LV 8.6 and 2009 to see if I can re-create the problem there as well. I'll let you know what I find and if it is, in fact, an issue with just LV 2010.
04-26-2011 11:21 AM
I reproduced the issue on 2009 and 8.6 as well. Have you actually tried running this web method VI in 8.6? If you did and were able to make it work correctly, the next step is to figure out if any settings/ configurations were changed between versions. If you haven't tried it on 8.6, then we'll try to figure out if it's a setting in LV causing this or a web server setting of some sort.
04-26-2011 11:47 AM
Austin: I appreciate the help!
I don't have access to 8.6. It's hard to understand how this could be an intentional feature unless LabVIEW believes that web services users will only be serving single clients.
04-27-2011 11:05 PM
I just noticed something else, perhaps this is why this behavior has gone unnoticed:
When I run instances of the web method VI on two different computers, they run as reentrant VI's just fine. Two browsers in the same computer? Not so much. This should at the very least give a clue as to what's going on. It also means that the behavior isn't going to affect very many users very often.
04-28-2011 03:23 PM - edited 04-28-2011 03:24 PM
Thanks for the additional info. That'll help us try to narrow this down. That's good to hear that it does actually work in different browser windows, though.
04-28-2011 03:30 PM
Just to be clear:
It DOES work on two different computers.
It DOESN'T work in two browser windows on the same computer.
04-28-2011 03:37 PM
That's what I meant, but I worded that poorly. Thanks for the clarification.
08-10-2011 02:05 AM
Just some more clarification
I did a similar test to pltrogon using LabVIEW 2010 SP1 on Windows Server 2008 R2 with a VI which waits 10 seconds and then returns the current time (hour/minutes/seconds). This web service VI is set to be re-entrant with the 'preallocate clone for each instant' option. It turns out the browser you use makes the difference, as seen from the time stamps returned:
That's why getting the page on two different computers shows the expected re-entrant execution.
As a check, if I set the VI to be not re-entrant, only one instance of the VI runs at the time, as seen from the times returned in the browser window.
My conclusion:
LabVIEW (2010 SP 1) is doing what is expected, you just have to use a client which sends multiple requests to the same page at the same time, and doesn't let the second request wait until the first request is finished.
10-05-2011 09:20 PM
Any progress on this? I had forgotten about this issue, and now on our big deployment night, people are only streaming data at (data rate)/(number of clients active), regardless of browser [firefox, ie, chrome]. I should note that this situation is different than the one biggeveen addressed because we're dealing with multiple clients sending single requests. I am not observing reentrant behavior even though I should.