Karsten Otto created JAMES-3890:
-----------------------------------

             Summary: Allow parallel execution of safe tasks
                 Key: JAMES-3890
                 URL: https://issues.apache.org/jira/browse/JAMES-3890
             Project: James Server
          Issue Type: Improvement
          Components: task
    Affects Versions: master
            Reporter: Karsten Otto


Currently, task execution in James is strictly serialized, through a single 
thread executor and the single active consumer feature of RabbitMQ. Such serial 
execution prevents tasks from interfering with each others operations. The 
majority of tasks execute in few seconds, so this is fine.

However, some tasks can take considerably longer, from minutes to even hours. 
In that case, the *long running task will effectively delay execution of any 
other task* until it is done! I noticed this while experimenting with the 
{{{}ExpireMailboxTask{}}}, throttled down to 1 user/sec for 1000 users; this 
would delay the periodic {{ReprocessingAllMailsTask}} I use for mail 
re-delivery attempts. This is rather unfortunate, since the two tasks have 
nothing in common to interfere with.

I propose a change to the task system, to allow parallel execution for certain 
long running "safe" tasks, in a twofold sense:
 # The task will not likely interfere with the operations of regular tasks.
 # The task gracefully handles issues that can arise from parallel execution. 
E.g.  when listing mails and later accessing them, some may have been deleted 
in the meantime.

The aforementioned {{ExpireMailboxTask}} would be a good candidate for this, 
maybe there are others.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscr...@james.apache.org
For additional commands, e-mail: server-dev-h...@james.apache.org

Reply via email to