This page documents Content-driven Robots. This functionality is supported starting with Polygraph v4.3.0.
1. For the impatient
2. Introduction
3. Configuration
Content content1 = { client_behavior = { req_types = ["Basic": 70%, "Range": 10%, "Upload"]; req_methods = ["GET": 80%, "HEAD", "POST"]; ranges = [ range1, range2: 10%, range3 ]; recurrence = 20%; }; ... }; ... then make your Robot(s) use Server(s) that have content1 ...
Polygraph Robot configurations have many properties that control what kind of requests to send. But in the real world, HTTP client behavior often depends on the web site content. For example, a web surfer may never revisit huge, static movie downloads but often come back to a collection of smaller, often updated images. Content-driven Robots feature helps simulate those dependencies.
Content-driven Robot properties are configured using PGL ClientBehavior type and Content client_behavior field. That field controls Robot behavior when the Robot requests objects of the corresponding "content type". When a Robot is making a request, it selects the content type before many other request properties. The Robot then uses Content.client_behavior fields, falling back to the Robot own properties for missing parameters.
The following example illustrates how to configure a Robot to make different request types for different objects:
// Only IMS GET and POST requests. Content content1 = { client_behavior.req_types = ["IMS"]; client_behavior.req_methods = ["GET": 80%, "POST"]; }; // Small number of Range requests and low recurrence. Content content2 = { client_behavior.req_types = ["Basic", "Range": 1%]; client_behavior.ranges = [ range1, range2: 10%, range3 ]; client_behavior.recurrence = 10%; } // No content-driven properties. Content content3; Server S = { contents = [ content1, content2, content3 ]; }; Robot R = { recurrence = 50%; // used for content1 and content3 post_contents = [ content3 ]; // required for content1 req_methods = [ "HEAD" ]; // used for content3 };ClientBehavior fields are a subset of Robot PGL type. But not all Robot fields are available in the ClientBehavior PGL type. See ClientBehavior PGL reference for the list of currently supported content-driven Robot properties.