synapse icon indicating copy to clipboard operation
synapse copied to clipboard

Unresponsive UI when running multiple instances

Open JBBianchi opened this issue 3 years ago • 2 comments

What happened: When starting a lot of concurrent instances in parallel, the UI becomes unresponsive.

What you expected to happen: The UI to stay responsive.

How to reproduce it:

  • Create a workflow, e.g.:
{
   "id":"order-dog",
   "version":"1.0.0",
   "specVersion":"0.8",
   "name":"Order pet",
   "description":"A workflow used to order a pet on the Swagger pet store",
   "constants":{
      "category":"string"
   },
   "functions":[
      {
         "name":"get-user-by-name",
         "type":"rest",
         "operation":"https://petstore.swagger.io/v2/swagger.json#getUserByName"
      },
      {
         "name":"create-user",
         "type":"rest",
         "operation":"https://petstore.swagger.io/v2/swagger.json#createUser"
      },
      {
         "name":"login-user",
         "type":"rest",
         "operation":"https://petstore.swagger.io/v2/swagger.json#loginUser"
      },
      {
         "name":"get-pets-by-status",
         "type":"rest",
         "operation":"https://petstore.swagger.io/v2/swagger.json#findPetsByStatus"
      },
      {
         "name":"create-order",
         "type":"rest",
         "operation":"https://petstore.swagger.io/v2/swagger.json#placeOrder"
      }
   ],
   "states":[
      {
         "name":"Retrieve dog",
         "type":"operation",
         "actions":[
            {
               "name":"Get user info",
               "functionRef":{
                  "refName":"get-user-by-name",
                  "arguments":{
                     "username":"${ .username }"
                  }
               },
               "actionDataFilter":{
                  "toStateData":"${ .user }"
               }
            },
            {
               "name":"Create user",
               "functionRef":{
                  "refName":"get-user-by-name",
                  "arguments":{
                     "username":"${ .username }",
                     "firstName":"test",
                     "lastName":"test",
                     "email":"[email protected]",
                     "password":"test"
                  }
               },
               "actionDataFilter":{
                  "toStateData":"${ .user }"
               },
               "condition":"${ .user == null }"
            },
            {
               "name":"Login",
               "functionRef":{
                  "refName":"login-user",
                  "arguments":{
                     "username":"${ .username }",
                     "password":"${ .password }"
                  }
               },
               "actionDataFilter":{
                  "useResults":false
               }
            },
            {
               "name":"Get Dog To Order",
               "functionRef":{
                  "refName":"get-pets-by-status",
                  "arguments":{
                     "status":"available"
                  }
               },
               "actionDataFilter":{
                  "results":"${ . | map(select(.category.name == $CONST.category))[0] }",
                  "toStateData":"${ .dogToOrder }"
               }
            }
         ],
         "transition":"Check if dog exists"
      },
      {
         "name":"Check if dog exists",
         "type":"switch",
         "dataConditions":[
            {
               "name":"Yes",
               "condition":"${ .dogToOrder != null }",
               "transition":"Place order"
            }
         ],
         "defaultCondition":{
            "end":true
         }
      },
      {
         "name":"Place order",
         "type":"operation",
         "actions":[
            {
               "name":"Place order",
               "functionRef":{
                  "refName":"create-order",
                  "arguments":{
                     "body":{
                        "petId":"${ .dogToOrder.id }",
                        "quantity":"${ .quantityToOrder }",
                        "complete":true
                     }
                  }
               },
               "actionDataFilter":{
                  "toStateData":"${ .order }"
               }
            }
         ],
         "end":true
      }
   ]
}
  • Start 5 to 10 instances in a row, running at the same time, e.g.:
{
    "username": "string",
    "quantityToOrder": 1
}
  • Try to suspend one

Environment: Self-hosted

JBBianchi avatar May 23 '22 15:05 JBBianchi

@JBBianchi yielding (Task.Yield) in CPU intensive tasks seem to resolve the issue for others out there. Might apply to this case too.

cdavernas avatar May 28 '22 08:05 cdavernas

@cdavernas feel free to have a look/try, I unfortunately don't know where those "CPU intenstive" tasks would be, I didn't find the source per se.

JBBianchi avatar May 31 '22 07:05 JBBianchi

@JBBianchi Hasn't this been resolved by #283 ? It sure does look like it to me, compared to before said PR 😄

cdavernas avatar Oct 26 '22 12:10 cdavernas