Slow workflow

20 views
Skip to first unread message

Ivan

unread,
Nov 3, 2011, 9:16:20 AM11/3/11
to ruote
Hello!
I need your help, about my server.

One part is based on sinatra and ruote, mostly.
I run the server with Thin.
I'm using HashStorage for ruote.

In it, I'm using ruote for managing user workflows, eg. user
registration:

----------->>>
Ruote.process_definition :name => "User registration workflow" do
sequence do
participant 'process user registration'

participant 'send activation mail'

concurrence do
sequence do
participant :ref => 'wait for confirmation', :tag =>
'waiting_4_confirmation'
cancel :ref => 'waiting_24'
end
sequence do
wait :for => '24h', :tag => 'waiting_24'
cancel :ref => 'waiting_4_confirmation'
end
end

participant 'finalize registration on server'
end
end
<<<-----------

I'm not sure if it's the best solution in the first place.
Anyways, when i launch this workflow, it steps from participant from
participant extremely slowly;
it takes seconds to step to the 'send activation mail' participant,
but it's just a simple string output (right now):

----------->>>
engine.register_participant 'process user registration' do |
workitem|
puts '>>> process user registration'
end
<<<-----------

Then it takes also a lot of time, about 30 sec, to load the whole
concurence definition, where it waits for 24 hours or the user
confirmation (a Mutex).

And here's something interesting:
If I access any part of the engine class, eg. engine.processes.inspect
to see what's changed, it just takes the step instantly, to one
participant to the other. (Or building the expression tree: when it's
built up until the concurence definition, there are 7 expressions in
the process).
So here it doesnt take seconds to move.

Have you ever experienced anything like this, do you have a solution?
Thank you!

John Mettraux

unread,
Nov 3, 2011, 5:50:38 PM11/3/11
to openwfe...@googlegroups.com

On Thu, Nov 03, 2011 at 06:16:20AM -0700, Ivan wrote:
>
> I need your help, about my server.
>
> One part is based on sinatra and ruote, mostly.
> I run the server with Thin.
> I'm using HashStorage for ruote.

Hello Ivan,

what version of Ruby ?

> In it, I'm using ruote for managing user workflows, eg. user
> registration:
>
> ----------->>>
> Ruote.process_definition :name => "User registration workflow" do
> sequence do
> participant 'process user registration'
>
> participant 'send activation mail'
>
> concurrence do
> sequence do
> participant :ref => 'wait for confirmation', :tag =>
> 'waiting_4_confirmation'
> cancel :ref => 'waiting_24'
> end
> sequence do
> wait :for => '24h', :tag => 'waiting_24'
> cancel :ref => 'waiting_4_confirmation'
> end
> end
>
> participant 'finalize registration on server'
> end
> end
> <<<-----------
>
> I'm not sure if it's the best solution in the first place.

You could simplify:

---8<---
Ruote.process_definition => 'User registration' do
process_user_registration
send_activation_mail
wait_for_confirmation :timeout => '24h'
finalize_registration
end)
--->8---

The timeout attribute will cancel the expression it adorns after the given time.

When it times out, it adds a __timed_out__ field to the workitem (useful for your "finalize_registration" step).

http://ruote.rubyforge.org/common_attributes.html

> Anyways, when i launch this workflow, it steps from participant from
> participant extremely slowly;
> it takes seconds to step to the 'send activation mail' participant,
> but it's just a simple string output (right now):
>
> ----------->>>
> engine.register_participant 'process user registration' do |
> workitem|
> puts '>>> process user registration'
> end
> <<<-----------

It might be interesting to turn the "noisy" output of the engine (engine.noisy = true).

> Then it takes also a lot of time, about 30 sec, to load the whole
> concurence definition, where it waits for 24 hours or the user
> confirmation (a Mutex).

Do you mean it takes 30 seconds to reach the first of the two participants in the concurrence ?

> And here's something interesting:
> If I access any part of the engine class, eg. engine.processes.inspect
> to see what's changed, it just takes the step instantly, to one
> participant to the other. (Or building the expression tree: when it's
> built up until the concurence definition, there are 7 expressions in
> the process).
> So here it doesnt take seconds to move.

If I understand correctly, ruote is very slow unless you ask it what's going on ?

> Have you ever experienced anything like this, do you have a solution?
> Thank you!

I have had various slow experiences but never with the HashStorage.

Based on your input, I prepared this small reproduction of your issue:

https://github.com/jmettraux/ivan

I experienced no slowness at all.

Maybe you can fork that project and "make it slow" so that I can help you.


Best regards,

--
John Mettraux - http://lambda.io/processi

Reply all
Reply to author
Forward
0 new messages