Define a Virtual User using polling-type AMF requests
The following example is provided by Adobe and included in LCDS (http://www.adobe.com/products/livecycle/dataservices/). Follow the installation instructions and then start the LCDS server. Then, go to the following URL: http://localhost:8400/lcds-samples/traderdesktop/startfeed.jsp. This page activates a stock price fluctuation simulation.
The steps involved in the process are:
- Recording the scenario
- Defining the Virtual User
- Checking the Virtual User validity
- Viewing a load test that includes polling requests
- To create a Virtual User that uses AMF polling
- Record the scenario:
- Start recording: In the NeoLoad main window, click Record button in the toolbar. Enter "UserPolling" in the Name field.
- Access the application: The web browser opens. Enter the following URL: http://localhost.:8400/lcds-samples/traderdesktop/index.html
- Select nio polling mode:
- Select the my-nio-amf-poll mode. This corresponds to an operating mode using polling HTTP requests through NIO sockets directly handled by LCDS.
- By default, the operating mode selected is my-rtmp . This corresponds to an operating mode using the RTMP protocol. Currently NeoLoad does not support this protocol.
- Note the polling operating mode: The my-nio-amf-poll mode corresponds to an operating mode using polling requests. The average delay between these requests is 3 seconds. This means there will be a minimum 3 second delay between two updates of the Watch List. Please wait twenty seconds or so (in other words, 7 refresh cycles).
- Stop recording:
- Close the browser, then click Stop. The Post-Recording Wizard displays the Push Application window.
- NeoLoad has detected that the recorded Virtual User has used Push AMF polling. Click Finish.
- The Post-Recording Wizard creates the UserPolling_AMF Virtual User from the recorded Virtual User.
- Check the recording:
- The UserPolling user contains the raw recording of the requests.
- Select the UserPolling_AMF Virtual User, right-click, then select Show all. The polling request appears in the polling_loop loop under the push_fork fork.
- The Push messages are located in the POLL_3 polling request. The flex.samples.marketdata.Stock message is a Push message executed each time a response message contains a flex.samples.marketdata.Stock -type object.
- Define the Virtual User:
- Extract and display the received stock symbol.
First, you need to set a Variable Extractor on the Push message to extract the symbol:
- Select the flex.samples.marketdata.Stock Push message, then click Advanced.
- Create a Variable Extractor.
- Enter "Symbol" in the Variable name field.
- Check the XPath Expression box and enter "//symbol" in the corresponding field.
- Enter ">" in the Starts with field.
- Enter "<" in the Ends with field.
- Click OK to create the Variable Extractor.
Create a JavaScript action in messageFork_1 located in the flex.samples.marketdata.Stock Push message and enter the following JavaScript code: logger.debug("STOCK = "+ context.variableManager.getValue("symbol"));
The JavaScript action will display the stock symbol extracted from the message.
- Keep the appropriate Push messages: This Virtual User is only interested in the stock symbols received. Delete the flex.messaging.messages.AcknowledgeMessageExt and DefaultMessage Push messages.
- Validate the Virtual User:
- Go to the Virtual User Validation section: In the NeoLoad main window, click the green tick button in the toolbar.
- Configure the think time playback: Click on the Advanced button in the validation window. Check the Play think time box, then click OK.
- Start the Virtual User validity check: Click the Start checking button in the validation window.
- Check the server responses:
Several polling requests and Push messages have been executed. Click on any one of them to check its contents. With a Push message selected, click Response.
The speed of execution in the validation check playback is real; this avoids submitting the server to too high a polling rate. In testing, 3 seconds minimum separate each polling request.
NeoLoad allows you to work on an XML representation of the objects passing through the server. In this example, you can see the XML representation of an instance of the example class flex.samples.marketdata.Stock returned by the server.
<body class="ASObject" mappedClass="flex.samples.marketdata.Stock"><open tagClass="double">33.61</open><last tagClass="double">32.41972272641574</last><symbol tagClass="String">GE</symbol><name tagClass="String">General Electric Company</name>...</body>Here is an extract of the associated Java class:
package flex.samples.marketdata;import java.util.Date;public class Stock {protected double open;protected double last;protected String symbol;protected String name;...public double getOpen() {return open;}public void setOpen(double open) {this.open = open;}public double getLast() {return last;}public void setLast(double last) {this.last = last;}public String getSymbol() {return symbol;}public void setSymbol(String symbol) {this.symbol = symbol;}public String getName() {return name;}public void setName(String name) {this.name = name;}- View a load test that includes polling requests:
- Go to the Population Definition section: In the NeoLoad main window, click Populations.
- Define the default Population: In the Population Creation Wizard, click OK.
- Go to the Load Policy section: Click Runtime.
- Define the load policy: Enter "10" in the Simulated users field. NeoLoad will launch 10 Virtual Users using polling.
- Start the test: Click the Play button in the toolbar. Then click OK. The test starts. Wait 2 minutes.
- Results: The test results allow you to check the server performance for each Push message.
Home