Return-Path: X-Original-To: apmail-ignite-user-archive@minotaur.apache.org Delivered-To: apmail-ignite-user-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4175518BC6 for ; Fri, 22 Apr 2016 08:10:00 +0000 (UTC) Received: (qmail 45400 invoked by uid 500); 22 Apr 2016 08:10:00 -0000 Delivered-To: apmail-ignite-user-archive@ignite.apache.org Received: (qmail 45348 invoked by uid 500); 22 Apr 2016 08:10:00 -0000 Mailing-List: contact user-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: user@ignite.apache.org Delivered-To: mailing list user@ignite.apache.org Received: (qmail 45337 invoked by uid 99); 22 Apr 2016 08:10:00 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 22 Apr 2016 08:10:00 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 406E2C0D4D for ; Fri, 22 Apr 2016 08:09:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: 1.179 X-Spam-Level: * X-Spam-Status: No, score=1.179 tagged_above=-999 required=6.31 tests=[DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, HTML_MESSAGE=2, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_PASS=-0.001] autolearn=disabled Authentication-Results: spamd4-us-west.apache.org (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id fZrXawnbIA-L for ; Fri, 22 Apr 2016 08:09:57 +0000 (UTC) Received: from mail-qk0-f181.google.com (mail-qk0-f181.google.com [209.85.220.181]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTPS id 881205F239 for ; Fri, 22 Apr 2016 08:09:56 +0000 (UTC) Received: by mail-qk0-f181.google.com with SMTP id n63so35729648qkf.0 for ; Fri, 22 Apr 2016 01:09:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to; bh=PsWdGbGIFGu/OY+hCDnprEAC9WdLT/7t0YkWcC11nXs=; b=mk6Q4i2I/xVUU3WkgyJRhoxuMGdyvKYpWGk5DB1K3Yv9/1hkKMgZRdBsDAcbyWzORz l2PdrDBI/4nAUaeVuv89UVC/KyXHKL25bMsZvF8JNlbdlbE0foGmbgsrzBtk6KE2lDTa 14mVeXC5xaQZjCqE1MBQsCtIh6wpcf1MjHMOlUiKmFQpmsPK/zFc2d2efWv4H3+f5JJG fjiFweoI1rkVIgQ1ZMOdc7J84xXZFCbzr6l8bdB4bZO28dlspiFqqVGUAbVlpml1E7Y2 fFexPSUTqSOAJOYoBZgAP1PhUatx5omHIDY/TRhb685kWaD7A2oYf+29szfxZOJ3NZdY ePtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to; bh=PsWdGbGIFGu/OY+hCDnprEAC9WdLT/7t0YkWcC11nXs=; b=gwmiiEQPLzv5he+VInuhRt7Xky7xuOyPjtbaQxQccrgl0iXS5aKk3Z21iaZ+7gQdzB HzL+z48XtOHTVuFi3CmfKEfT7pCkKKXjt+s3ttLNFZH57QKM+nJ+nCy0hyBb+4P/ujCU D9mn5Ii02EoQVke4VneZrXzo26ET1VBwk09Xt64QIWbd4O6Tk81gVpB63gK+9F9Kswih ozp6skaT4EZnUNS1+PwlQ8ecE8T+OUJtMby/wO9iXRGsGDpSy80Tx0DGItkFbc19sjj4 W0WJkzNoP6L/lQadJKRJ/oLvJFhI5rRsJvOILBkVMdkPDIhlspy3o6BN5DLY0k3ajban NMJg== X-Gm-Message-State: AOPr4FVC3E1usNNDy5InVk+DGAavVo1zprD4b44bi++jsUECfLpBfJ98mdkD4V8JsXqPJNpQjVGJ0eXaEVBzwg== MIME-Version: 1.0 X-Received: by 10.55.90.130 with SMTP id o124mr3639253qkb.178.1461312589581; Fri, 22 Apr 2016 01:09:49 -0700 (PDT) Received: by 10.140.104.42 with HTTP; Fri, 22 Apr 2016 01:09:49 -0700 (PDT) In-Reply-To: <1461250959756-4415.post@n6.nabble.com> References: <1461250959756-4415.post@n6.nabble.com> Date: Fri, 22 Apr 2016 11:09:49 +0300 Message-ID: Subject: Re: Write-behind and foreign keys in DB From: Alexei Scherbakov To: user@ignite.apache.org Content-Type: multipart/alternative; boundary=001a114e7202cedf3205310e5938 --001a114e7202cedf3205310e5938 Content-Type: text/plain; charset=UTF-8 Hi, You should not use write-behind mode in such scenario. Concerning performance issues: are you using connection pooling library? If no, I recommend you to use a library like c3p0 for connection pooling and prepared statement caching. 2016-04-21 18:02 GMT+03:00 vetko : > Hi All, > > I am experiencing an issue while trying to use write-behind on caches > connected to tables which have foreign key constraints between them. > Seemingly the write-behind mechanism is not executing the updates/inserts > in > a deterministic order, but rather is trying to push all the collected > changes per each cache consecutively in some unknown order. But as we have > foreign keys in the tables, the order of the operation matters, so parent > objects should be inserted/updated first, and children only after that > (otherwise foreign key violations are thrown from the DB). > > It seems that the current implementation is trying to workaround this > problem on a trial-and-error basis > (org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore:888), which > means > that it will periodically retry to flush the changes again and again for > the > caches in case of which a constraint violation occured. So the "child" > cache > will periodically retry to flush, until the "parent" cache gets flushed > first. This ultimately will result in getting the data into the DB, but it > also means a lot of unsuccessful tries in case of complex hierarchical > tables, until the correct order is "found". This results in poor > performance > and unnecessary shelling of the DB. > > Do you have any suggestions how could I circumvent this issue? > > (Initially I were trying with write-through, but it resulted in VERY poor > performance, because the CacheAbstractJdbcStore is seemingly opening a new > prepared statement for each insert/update operation.) > > (Using Ignite 1.4) > > > > -- > View this message in context: > http://apache-ignite-users.70518.x6.nabble.com/Write-behind-and-foreign-keys-in-DB-tp4415.html > Sent from the Apache Ignite Users mailing list archive at Nabble.com. > -- Best regards, Alexei Scherbakov --001a114e7202cedf3205310e5938 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi,

You should not use write-behind mod= e in such scenario.
Concerning performance issues: are you using = connection pooling library?
If no, I recommend you to use a libra= ry like c3p0 for connection pooling and prepared statement caching.



2016-04-21 18:02 GMT+03:00 vetko <Attila.Ve= tesi@wolterskluwer.com>:
Hi= All,

I am experiencing an issue while trying to use write-behind on caches
connected to tables which have foreign key constraints between them.
Seemingly the write-behind mechanism is not executing the updates/inserts i= n
a deterministic order, but rather is trying to push all the collected
changes per each cache consecutively in some unknown order. But as we have<= br> foreign keys in the tables, the order of the operation matters, so parent objects should be inserted/updated first, and children only after that
(otherwise foreign key violations are thrown from the DB).

It seems that the current implementation is trying to workaround this
problem on a trial-and-error basis
(org.apache.ignite.cache.store.jdbc.CacheAbstractJdbcStore:888), which mean= s
that it will periodically retry to flush the changes again and again for th= e
caches in case of which a constraint violation occured. So the "child&= quot; cache
will periodically retry to flush, until the "parent" cache gets f= lushed
first. This ultimately will result in getting the data into the DB, but it<= br> also means a lot of unsuccessful tries in case of complex hierarchical
tables, until the correct order is "found". This results in poor = performance
and unnecessary shelling of the DB.

Do you have any suggestions how could I circumvent this issue?

(Initially I were trying with write-through, but it resulted in VERY poor performance, because the CacheAbstractJdbcStore is seemingly opening a new<= br> prepared statement for each insert/update operation.)

(Using Ignite 1.4)



--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Writ= e-behind-and-foreign-keys-in-DB-tp4415.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.



--

Best regards,
Alexei Scherb= akov
--001a114e7202cedf3205310e5938--