Parallel HTTP Requests in G Web Development Software

Updated May 9, 2024

Environment

Software

  • G Web Development Software

This article demonstrates how to configure a Web VI in G Web Development Software (GWDS) to send HTTP requests in parallel.
 

Configuring Parallel Execution

By default, the POST Buffer and GET VIs execute sequentially. This means that even if several of each VI are placed in parallel, each instance can only execute if another instance is not already running. To configure parallel execution:
  1. Place the Post Buffer or GET VI on the Block Diagram.
  2. Select the VI and then expand the Document panel on the right-hand side.
Document Panel.PNG
  1. Click Properties.
  2. Set VI reentrancy to Stateless or Stateful.
    • Stateful eliminates wait time entirely, but will use more memory that Stateless. Stateless only results in wait time if there are more calls to the VI than there are clones.
    • Refer to VI Reentrancy - G Web Development Software Manual for more information.
    • Note: HTTP communication and VIs running on Windows operating systems are indeterministic due to the nature of network protocols and Windows background processes respectively. As a result, each "parallel" start time may have a variation of a few milli-seconds. This is expected, since VIs on Windows PCs are only accurate within a few milli-seconds.
  3. Multiple POST Buffer or GET VIs can then be placed in parallel on the Block Diagram, similar to the below image.
G Web Snippet.png
Note: This image is a G Web Development Software (GWDS) snippet, which includes GWDS code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer, and drag the file onto your GWDS Web VI diagram.



 

Testing Parallel Execution

The reentrancy configured above can be tested with a LabVIEW Web Service using the same method described in Sending Multiple HTTP Requests to the Same LabVIEW Web VI and Processing Them in Parallel.
 
  1. Using the tutorial link above, create a LabVIEW Web Service with a POST method VI (this can be tested with parallel POST Buffer VIs in GWDS).
    • The tutorial creates a POST method called "Parallel.vi". This VI executes a sub VI called "AnalysisWait.vi". Both "Parallel.vi" and "AnalysisWait.vi" must be configured as Shared Clone Reentrant or Preallocated Clone Reentrant.
  2. The POST method accepts input data using a buffer, so the LabVIEW Web Service must be configured for Stream output.
    1. In the LabVIEW project, ensure that the Web Service is stopped.
    2. Right-click the Web Service and select Properties.
    3. Select the HTTP Method VI Settings tab.
    4. In the VI table, select "Parallel.vi".
    5. In the Web Service VI Properties section, select the Output Type tab.
    6. Ensure that Stream is selected, and Use headers and Buffered are enabled.
    7. Click OK and start the Web Service.

Web Service Properties.PNG

The image below illustrates the difference between Non-reentrant, Stateless and Stateful execution in GWDS. It demonstrates that:
  • The POST Buffer or GET VIs in GWDS will execute sequentially when the reentrancy in GWDS and LabVIEW is set to None.
  • When the LabVIEW Web Service VIs are reentrant, and GWDS VIs are Stateless, execution is parallel.
  • When the LabVIEW Web Service VIs are reentrant, and GWDS VIs are Stateful, the execution is parallel and has a slightly less delay than Stateless.
    • The image shows a difference in delay of 0.5 milli-seconds (ms) between Stateless and Stateful. This value may vary depending on the complexity of the code.

Comparison Execution.png