Browse Source

Start working on scenario files for workload generation

pull/2059/head
Philipp Theyssen 1 year ago
parent
commit
395d23cee9
7 changed files with 171 additions and 0 deletions
  1. +41
    -0
      scenario-definition/README.md
  2. +39
    -0
      scenario-definition/operations/op_basket_add_item.json
  3. +0
    -0
      scenario-definition/operations/op_basket_checkout.json
  4. +61
    -0
      scenario-definition/operations/op_catalog_add_item.json
  5. +12
    -0
      scenario-definition/operations/op_catalog_get_items.json
  6. +0
    -0
      scenario-definition/operations/op_catalog_update_price.json
  7. +18
    -0
      scenario-definition/transactions/add_items_to_basket.json

+ 41
- 0
scenario-definition/README.md View 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
- 0
scenario-definition/operations/op_basket_add_item.json View 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"
}

+ 0
- 0
scenario-definition/operations/op_basket_checkout.json View File


+ 61
- 0
scenario-definition/operations/op_catalog_add_item.json View 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
- 0
scenario-definition/operations/op_catalog_get_items.json View 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"
}

+ 0
- 0
scenario-definition/operations/op_catalog_update_price.json View File


+ 18
- 0
scenario-definition/transactions/add_items_to_basket.json View 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…
Cancel
Save