<?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/234903#M188033</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 can 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;SPAN&gt;Code in attachment, rename it to code.zip&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 19 Sep 2016 20:59:00 GMT</pubDate>
    <dc:creator>ggr</dc:creator>
    <dc:date>2016-09-19T20:59:00Z</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/234903#M188033</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>Mon, 19 Sep 2016 20:59:00 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/234903#M188033</guid>
      <dc:creator>ggr</dc:creator>
      <dc:date>2016-09-19T20:59:00Z</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/234904#M188034</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello GGR, this is fantastic work that I expect will be very useful for other community members.&lt;BR /&gt;Would Fujitsu be prepared to contribute this as an alternative Job Scheduler?&lt;/P&gt;&lt;P&gt;Thanks,&lt;BR /&gt;Greg&lt;/P&gt;&lt;P&gt;&lt;A href="https://migration33.stage.lithium.com/t5/tag/bp3/tg-p"&gt;&lt;/A&gt;‌&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Dec 2016 14:45:28 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-archive/activiti-on-websphere-and-spring-asyncjobexcutor/m-p/234904#M188034</guid>
      <dc:creator>gdharley</dc:creator>
      <dc:date>2016-12-15T14:45:28Z</dc:date>
    </item>
  </channel>
</rss>

