From notifications-return-30427-apmail-ofbiz-notifications-archive=ofbiz.apache.org@ofbiz.apache.org Fri Feb 7 08:20:02 2020 Return-Path: X-Original-To: apmail-ofbiz-notifications-archive@minotaur.apache.org Delivered-To: apmail-ofbiz-notifications-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by minotaur.apache.org (Postfix) with SMTP id E909219B8D for ; Fri, 7 Feb 2020 08:20:01 +0000 (UTC) Received: (qmail 80842 invoked by uid 500); 7 Feb 2020 08:20:01 -0000 Delivered-To: apmail-ofbiz-notifications-archive@ofbiz.apache.org Received: (qmail 80808 invoked by uid 500); 7 Feb 2020 08:20:01 -0000 Mailing-List: contact notifications-help@ofbiz.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ofbiz.apache.org Delivered-To: mailing list notifications@ofbiz.apache.org Received: (qmail 80781 invoked by uid 99); 7 Feb 2020 08:20:01 -0000 Received: from mailrelay1-us-west.apache.org (HELO mailrelay1-us-west.apache.org) (209.188.14.139) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 07 Feb 2020 08:20:01 +0000 Received: from jira-he-de.apache.org (static.172.67.40.188.clients.your-server.de [188.40.67.172]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A5A78E29AA for ; Fri, 7 Feb 2020 08:20:00 +0000 (UTC) Received: from jira-he-de.apache.org (localhost.localdomain [127.0.0.1]) by jira-he-de.apache.org (ASF Mail Server at jira-he-de.apache.org) with ESMTP id 24E0D780207 for ; Fri, 7 Feb 2020 08:20:00 +0000 (UTC) Date: Fri, 7 Feb 2020 08:20:00 +0000 (UTC) From: "Nicolas Malin (Jira)" To: notifications@ofbiz.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (OFBIZ-11200) Refactoring old job process MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/OFBIZ-11200?page=3Dcom.atlassia= n.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=3D170= 32193#comment-17032193 ]=20 Nicolas Malin commented on OFBIZ-11200: --------------------------------------- Hi [~lektran] can you have few time for a quick review and criticize my app= roach ? =C2=A0 > Refactoring old job process > --------------------------- > > Key: OFBIZ-11200 > URL: https://issues.apache.org/jira/browse/OFBIZ-11200 > Project: OFBiz > Issue Type: Improvement > Components: framework > Affects Versions: Trunk > Reporter: Nicolas Malin > Assignee: Nicolas Malin > Priority: Minor > Labels: job, service > Attachments: OFBIZ-11200.patch > > > Currently to purge old job, we use the thread job manager to check if som= e job need to be run and if the pool is empty, check the old job to purge. > I detected a problem when you have many job's server and two pools. > In my case, I have a first pool that run regular job and a second that re= ceive huge asynchrone services (by persist call). > Server who manage the second pool have rarely the possibility to purge th= eir jobs that, by the way, increase JobSandbox table > Server who manage the first pool, call often the purge process, but the t= able size generate a long query time to purge few element. Long query time,= run often, this purge process consume 15% of the database load (with corre= ct reindex) > After analyze, I propose this refactoring : > * When you call JobSandbox table for a purge, use a limit on the query wi= th the max thread pool because when you have the database return, you purge= only with this limit so this help the database to not scan the whole table= . Other small improvement, do not sort the result (no functional gain). Wi= th this each query pass to 3.5s at 0.30s (on postgres). > * Purge by the pool thread is nice, each server can only purge their own = job (filtered on run_by_instance_id), to help an overloaded server, I was r= ehabiliting service purgeOldJobs that you can run with specific parameter t= o make assistance. > * Last, all job services are historical on class org.apache.ofbiz.service= .ServiceUtil, I moved them all in a new dedicate class org.apache.ofbiz.ser= vice.job.JobServices -- This message was sent by Atlassian Jira (v8.3.4#803005)