GotSpeech.NET

The online community for Microsoft Speech Server developers
Welcome to GotSpeech.NET Sign in | Join | Help
in Search
Computer-Talk

Performance issue with subflows

Last post 05-12-2008, 1:16 PM by marshallharrison. 14 replies.
Sort Posts: Previous Next
  •  05-08-2008, 8:44 AM 5448

    Performance issue with subflows

    I have a large app for a client that is using subflows as described here - http://gotspeech.net/blogs/marshallharrison/archive/2008/01/14/creating-subflows.aspx.

    We are experiencing slow load times (2 or 3 minutes) in VS2005 and long compile times of around 10 minutes. When calling the app on the server it sometimes throws out of memory errors. When it does run it takes 30-45 seconds to move from one subflow to another. This cases long pauses between the last prompt in one subflow and the first prompt in the next subflow.

    The application is structured like this:

    Main workflow = A

    Subflows are B,C,D,E,F etc


    Workflow A calls B which calls C which calls D which calls E etc. The call flow as designed by the client sometimes calls pieces from different places so the pieces were written as subflows to avoid duplicating code everywhere.

    If all of the subflows are just stubs then everything goes well at compile and run time (though it still takes 8 seconds and the client wants <= 5). As the subflows get built out the compile time goes up as does the time it takes to move from one subflow to the next at runtime.

    It's almost like it has to compile B - F in order to compile A then in order to compile B it needs to compile C - F etc.

    Does anyone know how nested subflows are used by MSS? Is there a bug/issue when nesting subflows?

    In order to move from A to B at runtime does MSS have to load B and C and D and E etc?

    Are there any tricks for speeding up the loading? We have tried caching the prompts but that was no help.


    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
  •  05-09-2008, 7:38 AM 5459 in reply to 5448

    Re: Performance issue with subflows

    Okay - I've got my answer.

    Nesting of SpeechSequenceActivity is a big no-no.

    I'll blog about this soon.


    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
  •  05-09-2008, 10:01 AM 5467 in reply to 5459

    Re: Performance issue with subflows

    Is there a workaround?
  •  05-09-2008, 10:17 AM 5468 in reply to 5467

    Re: Performance issue with subflows

    Using SpeechSequentialWorkflowActivity and InvokeWorkflow looks promsing but we are still testing and waiting on word from Microsoft.

     


    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
  •  05-09-2008, 12:34 PM 5485 in reply to 5468

    Re: Performance issue with subflows

    Hey Marshall

    I have had very good success so far with InvokeWorkflow. I am down 5 levels and no problems with speed

    Brian 

     


    Brian Campbell
    Speech Developer
    Micro Design Centre Inc.
    905-918-3027
  •  05-09-2008, 12:51 PM 5486 in reply to 5485

    Re: Performance issue with subflows

    For the project that we are working on, we initially started using WorkflowActivities and using invokes from the MainWorkflow to flow through the program. We encountered errors when trying to pass variables from one nested workflow to another nested workflow. We then moved onto SpeechSequenceActivities that were nested off of the MainWorkflow, which we are currently using without any real performance problems.
     

  •  05-09-2008, 1:08 PM 5488 in reply to 5485

    Re: Performance issue with subflows

    Brian,

    How are you sharing data between the workflows?

    I need to store some data set by the other workflows and then save the data to a db on desconnect. Whatever method I use has to be able to maintain seperate data for concurrent calls. Can't hae caller's financial data getting mingle with someone else's.

    Also how big are your nested workflows? 

    Jon,

    We didn't have issues either until we had to nest the SpeechSequenceActivities. The problem with nesting seems to be that the whole nested tree gets cloned and that eats up memery and screws up the performance.


    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
  •  05-09-2008, 1:21 PM 5490 in reply to 5488

    Re: Performance issue with subflows

    I had help on that from Anthony in this thread

    http://gotspeech.net/forums/thread/3530.aspx

    The biggest workflow is 3 If/Else Activities, holding a total of 10 other activities...(QA, Statement etc)...and in one spot it records input from the user and then translates using System.Speech.Recognition.

    The smallest is 3 Activities

    Brian


    Brian Campbell
    Speech Developer
    Micro Design Centre Inc.
    905-918-3027
  •  05-09-2008, 1:35 PM 5492 in reply to 5490

    Re: Performance issue with subflows

    So to make sure we are on the same page -

    You use InvokeWorkflow and your call tree looks something like this (5 layers deep)? A==>B==>C==>D==>E

    And you pass a parm from A to B which then passes it to C?

    We have a dataHolder class that we instantiate inthe main workflow and all nested workflows need to be able to update data in the dataHolder.


    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
  •  05-09-2008, 1:46 PM 5494 in reply to 5492

    Re: Performance issue with subflows

    Yes if we use your example A==>B==>C==>D==>E

    I have a class called CurrentUser that gets instantiated after the user successfully logs in during Workflow A

    I pass that class from workflow A to Workflow B to Workflow C....etc...etc

    In Workflow E, I use a property from the CurrentUser class when I add a record to a table in the database

    I also have situations where I change the value of a property in Workflow E and then pass it back up to Workflow A

    The only catch was the bug that is discussed in the thread I point to earlier...other than that it seems to work pretty well

    Brian


    Brian Campbell
    Speech Developer
    Micro Design Centre Inc.
    905-918-3027
  •  05-09-2008, 8:07 PM 5500 in reply to 5494

    Re: Performance issue with subflows

    So you pass it down through the chain.

    I wish there was some way for the lower workflows to access something in the main workflow rather than passing it down.


    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
  •  05-12-2008, 8:46 AM 5515 in reply to 5500

    Re: Performance issue with subflows

    Marshall,

    For our login activity, we created a property on the main workflow and set the user ID there, and then access it from our sub activities like this:

    Code in MainWorkflow:

    Private _ActiveUser As Nullable(Of DAL.User)

    Public Property ActiveUser() As Nullable(Of DAL.User)
            Get
                Return _ActiveUser
            End Get
            Set(ByVal value As Nullable(Of DAL.User))
                _ActiveUser = value
            End Set
        End Property

    Code in Subworkflow:

    Dim parentWorkflow As MainWorkflow = Nothing

    parentWorkflow = CType(Me.Workflow, MainWorkflow) 

    parentWorkflow.ActiveUser = newUser 

    We first off create the variable for parentWorkflow and set it to nothing, then in a later sub procedure we set it to the main workflow with the second line of code. Then when we finally build the user object, we set the ActiveUser object which is on the MainWorkflow to newUser. We can then access the user information anywhere in our application like this:

    Code in SubActivity:

    Private parentWorkflow As MainWorkflow = Nothing

    parentWorkflow = CType(Me.Workflow, MainWorkflow)

    dim UserID as Integer = Me.parentWorkflow.ActiveUser.Value.UserID

     


    Hope this helps. 

  •  05-12-2008, 12:01 PM 5519 in reply to 5515

    Re: Performance issue with subflows

    Were you using SpeechSequentialWorkflowActivity  and InvokeWorflow?

    We were doing that when we weer using SpeechSequenceActivity so naturraly we tried it with SpeechSequentialWorkflowActivity. It works and we can address it but it doesn't keep separate instances for each call. We tested with 2 calls and the data was getting mixed up between the calls.


    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
  •  05-12-2008, 12:39 PM 5521 in reply to 5519

    Re: Performance issue with subflows

    Yes, we are using SpeechSequenceActivities. We also tried with workflows first and realized the same thing, which turn our heads to using Activities. As for the performance degrading, we have yet to experience it.
  •  05-12-2008, 1:16 PM 5522 in reply to 5521

    Re: Performance issue with subflows

    I don't think you wil experience any unless you nest the SpeechSequenceActivities. I'm not sure yet how many layers you can nest before problems start occurring but when you nest them you get some pretty heavy deep cloning that goes on.
    Marshall Harrison
    Microsoft MVP, Office Communications Server


    www.GoldSys.com
    W: 303.447.2774
    H: 904.342-6205

    the gotspeech guy
View as RSS news feed in XML