<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Activiti on Websphere and Spring AsyncJobExcutor in Alfresco Archive</title>
    <link>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/235320#M188450</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Context&lt;/STRONG&gt;&lt;SPAN&gt; : Make long story short, it has been decided in my company to use Activiti, we have strong knowledge in EMC Workflow Engine. We have deployed it in a hurry in production on IBM Websphere Application Server.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Not enough load/perfomance tests, the inevitable happens : the server crashed.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;After some investigations, blog posts &amp;amp; forums readings we found a solutions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[h2]1. Work Manager et Timer Scheduler[/h2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Managing your own thread on a WAS is never a good idea. Even if the new class ManagedAsyncJobExecutor use a threads pool of the container this is not suitable for the WAS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It use work manager - a pool of threads - and managed it by itself.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I re-wrote the existing DefaultAsyncJobExecutor using the spring class org.springframework.core.task.AsyncTaskExecutor, it works like the java java.util.concurrent.ExecutorService.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;This interface is mainly implemented by two classes&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;one for a Servlet Container : org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor&lt;/LI&gt;&lt;LI&gt;one for a Applicaton Container : org.springframework.scheduling.commonj.WorkManagerTaskExecutor (needs the jndi name of the work manager)&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The AbstractAsyncJobExecutor starts two threads two retrieve jobs to treat. Regarding the code, this is just a runnable snippet that is scheduled.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I rewrite the two classes AcquireAsyncJobsDueRunnable &amp;amp; AcquireTimerJobsRunnable, the common code (99%) has been mutualized in AbstractAcquireJobsRunnable.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I use the time scheduler to avoid Thread.sleep(). I use the Spring implementation because of the WAS, but a standard java one does exist java.util.concurrent.ScheduledExecutorService.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I think this is better to use this than a thread.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The philosophy is still the same :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;The Async executor starts schedule of execution of the AcquireAsyncJobsDueRunnable &amp;amp; AcquireTimerJobsRunnable&lt;/LI&gt;&lt;LI&gt;When the scheduler is executed, two tasks are executed by the AsyncTaskExecutor - one for each runnable&lt;/LI&gt;&lt;LI&gt;They check the database to retrieve jobs and put runnable task for each job in the AsyncTaskExecutor.&lt;/LI&gt;&lt;LI&gt;if there is no more job to treat or if the queue of the AsyncTaskExecutor is full, the AbstractAcquireJobsRunnable schedule its next execution.&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN&gt;I'm a little bit annoyed with the term AsyncJobExecutor because it does more than just executing job. It rerieves jobs to treat and then only executes them.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It is more a AsyncJobExecutorManager or something like that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;One more strange thing is that AcquireAsyncJobsDueCmd constructor requires a AsyncJobExecutor object. In fact, it only needs lockTimeInMillis and maxJobsPerAcquistions params.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Globally, the rewriting of the classes is more OOP / Spring compliant.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[h2]2. Transaction Manager[/h2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;We use the inappropriate transactionManager : org.springframework.jdbc.datasource.DataSourceTransactionManager.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;For WAS, you have to use : org.springframework.transaction.jta.WebSphereUowTransactionManager&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;[h2]3. Websphere Application Server Config[/h2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Define a workmanager :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;name : workmanager/listener&lt;/LI&gt;&lt;LI&gt;Work request queue size　: 0&lt;/LI&gt;&lt;LI&gt;Work request queue full action　: FAIL&lt;/LI&gt;&lt;LI&gt;Alarm threads : 15&lt;/LI&gt;&lt;LI&gt;Minimum threads : 10&lt;/LI&gt;&lt;LI&gt;Max threads : 200&lt;/LI&gt;&lt;LI&gt;Threads priority : 5&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN&gt;Define a scheduler :&lt;/SPAN&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;name : timer/listener&lt;/LI&gt;&lt;/UL&gt;&lt;BR /&gt;&lt;SPAN&gt;[h2]4. Activiti 6 and message queue based async executor[/h2]&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The mechanism explained below is applicable for Activiti 6 OOTB.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Following this post &lt;/SPAN&gt;&lt;A href="http://www.jorambarrez.be/blog/2016/07/20/message-queue-async-executor-benchmark/" rel="nofollow noopener noreferrer"&gt;http://www.jorambarrez.be/blog/2016/07/20/message-queue-async-executor-benchmark/&lt;/A&gt;&lt;SPAN&gt;, we can adapt the mechanism like this based on the producer / consumer pattern.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;UL&gt;&lt;LI&gt;Use a scheduler to schedule tasks to retrieve jobs&lt;/LI&gt;&lt;LI&gt;job are put in a queue (java, jms, whatever.)&lt;/LI&gt;&lt;LI&gt;use a second scheduler to read this queue and put the job in the workmanager&lt;/LI&gt;&lt;/UL&gt;&lt;SPAN&gt;I dont know if it will be more efficient, but it a regulate the load of the executor&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Feel Free to ask more details of the solutions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks for providing such a great product.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;FIles in attachment, rename it to codE.zip&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 20 Sep 2016 18:12:14 GMT</pubDate>
    <dc:creator>ggr</dc:creator>
    <dc:date>2016-09-20T18:12:14Z</dc:date>
    <item>
      <title>Activiti on Websphere and Spring AsyncJobExcutor</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/235320#M188450</link>
      <description>Context : Make long story short, it has been decided in my company to use Activiti, we have strong knowledge in EMC Workflow Engine. We have deployed it in a hurry in production on IBM Websphere Application Server.Not enough load/perfomance tests, the inevitable happens : the server crashed.After so</description>
      <pubDate>Tue, 20 Sep 2016 18:12:14 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/235320#M188450</guid>
      <dc:creator>ggr</dc:creator>
      <dc:date>2016-09-20T18:12:14Z</dc:date>
    </item>
    <item>
      <title>Re: Activiti on Websphere and Spring AsyncJobExcutor</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/235321#M188451</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hi GGR, thanks for the detailed post, really interesting!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Wouldn't it be easier to use the org.activiti.spring.SpringAsyncExecutor here? It seems you're using Spring anyway. This SpringAsyncExecutor expects a taskExecutor to be injected (which maps to what you have). or is this how you are using it already?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. and 3. thanks for posting that. useful for many others.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. I'm not sure yet how this would regulate the load of the executor better/differently?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Currently, the thread based solution uses a blockinqueue, when it's full the acquiring will also be throttled.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In general, the current implementations works pretty much like you describe (except a second scheduler is not used, it's passed to the queue itself).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So am I right that maybe you're looking for different/interfaces here?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;gt; Thanks for providing such a great product.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Many thanks!&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 27 Sep 2016 11:49:47 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/235321#M188451</guid>
      <dc:creator>jbarrez</dc:creator>
      <dc:date>2016-09-27T11:49:47Z</dc:date>
    </item>
    <item>
      <title>Re: Activiti on Websphere and Spring AsyncJobExcutor</title>
      <link>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/235322#M188452</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;HI,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Of course, it will be easier, but you cant retrieve the threadpoolexecutor of a WAS.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;We are using a WAS because of the organization policy, but I am not convinced that this is safer/robust/scalable than a tomcat.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. Two point for this :&lt;/SPAN&gt;&lt;BR /&gt;&lt;EM&gt;Considering the use of Thread.sleep() / scheduling of task&lt;/EM&gt;&lt;BR /&gt;&lt;SPAN&gt;If you a have only a limited number of threads to work with - 10, 3 will be allocated to retrieve the jobs and 7 will process the jobs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;If the queue is full, the 3 retrieving job will be sleeping instead of processing jobs.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;EM&gt;Regulation of the load&lt;/EM&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I do not know - because I do not have testing enough - if the regulation will be better.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have studied your "queue based async executor" of v6, and I think this a really good solution.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Indeed, we plan to use it : we want to split the execution of job by process to mitigate the risk.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Architecture will be something like :&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* one oracle DB&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* one server to retrieve jobs&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* As many queues/JMS as processes definition&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;* at least one job executor per queues.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The only things that bother me, is that there is not enough abstraction, and the standard implementation &amp;amp; the jms executor one does not share the same interfaces/abstract class.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;On the other hand, I understand the legacy and the need that the engine can be started with the less configuration possible.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 05 Oct 2016 06:50:15 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/235322#M188452</guid>
      <dc:creator>ggr</dc:creator>
      <dc:date>2016-10-05T06:50:15Z</dc:date>
    </item>
  </channel>
</rss>

