Start working on scenario files for workload generation
This commit is contained in:
		
							parent
							
								
									20ceb14ee7
								
							
						
					
					
						commit
						395d23cee9
					
				
							
								
								
									
										41
									
								
								scenario-definition/README.md
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								scenario-definition/README.md
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,41 @@
 | 
			
		||||
# Scenario Definition for EshopOnContainers
 | 
			
		||||
 | 
			
		||||
To use the simulation framework for microservices you have
 | 
			
		||||
to specify a scenario/workload using json (configuration) files.
 | 
			
		||||
 | 
			
		||||
The configuration files consist of:
 | 
			
		||||
 | 
			
		||||
- operations: a HTTP request 
 | 
			
		||||
- transactions: multiple operations sequentially chained together
 | 
			
		||||
- scenario: specifies which transactions are run and other workload
 | 
			
		||||
  configuration like distribution, arguments the transaction should use etc.
 | 
			
		||||
  
 | 
			
		||||
  
 | 
			
		||||
The scenario should simulate a workload the microservice application would
 | 
			
		||||
experience during a given timespan in production.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
## Scenario for eshopOnContainers
 | 
			
		||||
 | 
			
		||||
Arguments and Dynamic Variables for Transactions:
 | 
			
		||||
- userId
 | 
			
		||||
- productId
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Transactions:
 | 
			
		||||
- Customer reads items, adds item to basket, checkouts basket
 | 
			
		||||
- Customer adds item to basket, removes again, logs out
 | 
			
		||||
- Price update transaction
 | 
			
		||||
- Stock replenished for catalog item
 | 
			
		||||
- Catalog item is removed
 | 
			
		||||
- create Order draft
 | 
			
		||||
- Order cancel
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Workload configuration:
 | 
			
		||||
- dataskew on catalog items (distribution of which items are accessed/bought)
 | 
			
		||||
- distribution between different transactions
 | 
			
		||||
- how many concurrent transactions
 | 
			
		||||
- how many total transactions to be executed
 | 
			
		||||
							
								
								
									
										39
									
								
								scenario-definition/operations/op_basket_add_item.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								scenario-definition/operations/op_basket_add_item.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,39 @@
 | 
			
		||||
{
 | 
			
		||||
  "id": "basket-add-item",
 | 
			
		||||
  "type": "http",
 | 
			
		||||
  "httpMethod": "post",
 | 
			
		||||
  "arguments": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "items",
 | 
			
		||||
      "required": true,
 | 
			
		||||
      "type": "object"
 | 
			
		||||
    },
 | 
			
		||||
   {
 | 
			
		||||
      "name": "buyerId",
 | 
			
		||||
      "required": true,
 | 
			
		||||
      "type": "guid"
 | 
			
		||||
    },    
 | 
			
		||||
  ],
 | 
			
		||||
  "dynamicVariables": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "basket-item-id",
 | 
			
		||||
      "type": "unsignedInt"
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
  "payload": {
 | 
			
		||||
    "type": "json",
 | 
			
		||||
    "content": {
 | 
			
		||||
      "buyerId": "{{buyerId}}",
 | 
			
		||||
      "items": [
 | 
			
		||||
          "id": "1",
 | 
			
		||||
          "productId": "{{items}}",
 | 
			
		||||
          "productName": "string",
 | 
			
		||||
          "unitPrice": 0,
 | 
			
		||||
          "oldUnitPrice": 0,
 | 
			
		||||
          "quantity": 0,
 | 
			
		||||
          "pictureUrl": ""
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "url": "http://localhost:5101/catalog-api/api/v1/Basket"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										61
									
								
								scenario-definition/operations/op_catalog_add_item.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										61
									
								
								scenario-definition/operations/op_catalog_add_item.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,61 @@
 | 
			
		||||
{
 | 
			
		||||
  "id": "catalog-add-item",
 | 
			
		||||
  "type": "http",
 | 
			
		||||
  "httpMethod": "post",
 | 
			
		||||
  "dynamicVariables": [
 | 
			
		||||
    {
 | 
			
		||||
      "name": "item-name",
 | 
			
		||||
      "type": "string"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "item-description",
 | 
			
		||||
      "type": "string"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "price",
 | 
			
		||||
      "type": "unsignedInt"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "brand-name",
 | 
			
		||||
      "type": "string"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "available-stock",
 | 
			
		||||
      "type": "unsignedInt"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "restock-threshold",
 | 
			
		||||
      "type": "unsignedInt"
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      "name": "max-stock-threshold",
 | 
			
		||||
      "type": "unsignedInt"
 | 
			
		||||
    }     
 | 
			
		||||
  ]     
 | 
			
		||||
  "payload": {
 | 
			
		||||
    "type": "json",
 | 
			
		||||
    "content": {
 | 
			
		||||
      "id": 0,
 | 
			
		||||
      "name": "{{item-name}}",
 | 
			
		||||
      "description": "{{item-description}}",
 | 
			
		||||
      "price": "{{price}}",
 | 
			
		||||
      "pictureFileName": "",
 | 
			
		||||
      "pictureUri": "",
 | 
			
		||||
      "catalogTypeId": 1,
 | 
			
		||||
      "catalogType": {
 | 
			
		||||
        "id": 0,
 | 
			
		||||
        "type": ""
 | 
			
		||||
      },
 | 
			
		||||
      "catalogBrandId": 1,
 | 
			
		||||
      "catalogBrand": {
 | 
			
		||||
        "id": 1,
 | 
			
		||||
        "brand": "{{brand-name}}"
 | 
			
		||||
      },
 | 
			
		||||
      "availableStock": "{{available-stock}}",
 | 
			
		||||
      "restockThreshold": "{{restock-threshold}}",
 | 
			
		||||
      "maxStockThreshold": "{{max-stock-threshold}}",
 | 
			
		||||
      "onReorder": true
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
  "url": "http://localhost:5101/catalog-api/api/v1/Catalog/items"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										12
									
								
								scenario-definition/operations/op_catalog_get_items.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										12
									
								
								scenario-definition/operations/op_catalog_get_items.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,12 @@
 | 
			
		||||
{
 | 
			
		||||
  "id": "catalog-get-items",
 | 
			
		||||
  "type": "http",
 | 
			
		||||
  "httpMethod": "get",
 | 
			
		||||
  "queryParameters": [
 | 
			
		||||
    {
 | 
			
		||||
      "key": "pageSize",
 | 
			
		||||
      "value": 3
 | 
			
		||||
    }
 | 
			
		||||
  ],  
 | 
			
		||||
  "url": "http://localhost:5101/catalog-api/api/v1/Catalog/items"
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										18
									
								
								scenario-definition/transactions/add_items_to_basket.json
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								scenario-definition/transactions/add_items_to_basket.json
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,18 @@
 | 
			
		||||
transaction:
 | 
			
		||||
{
 | 
			
		||||
  "id": "add-items-to-basket",
 | 
			
		||||
    "operations": [
 | 
			
		||||
    {
 | 
			
		||||
      operationRefId: "catalog-get-items",
 | 
			
		||||
      id: "op-1",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
      operationRefId: "op-id-2",
 | 
			
		||||
      id: "second-op-in-this-transaction",
 | 
			
		||||
      arguments: [ 
 | 
			
		||||
	userId, 
 | 
			
		||||
	@first-op-in-this-transaction.response.id
 | 
			
		||||
      ]
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user