Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtp (Exim 4.80) (envelope-from ) id 1Z9zyZ-0000Tq-K4 for pgsql-jdbc@arkaria.postgresql.org; Tue, 30 Jun 2015 18:09:43 +0000 Received: from localhost ([127.0.0.1] helo=postgresql.org) by malur.postgresql.org with smtp (Exim 4.84) (envelope-from ) id 1Z9zyZ-0007FI-31 for pgsql-jdbc@arkaria.postgresql.org; Tue, 30 Jun 2015 18:09:43 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA384:256) (Exim 4.84) (envelope-from ) id 1Z9zyY-0007Dw-3K for pgsql-jdbc@postgresql.org; Tue, 30 Jun 2015 18:09:42 +0000 Received: from mail-pd0-x232.google.com ([2607:f8b0:400e:c02::232]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.84) (envelope-from ) id 1Z9zyU-0000jz-9w for pgsql-jdbc@postgresql.org; Tue, 30 Jun 2015 18:09:41 +0000 Received: by pdbci14 with SMTP id ci14so10118987pdb.2 for ; Tue, 30 Jun 2015 11:09:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=content-type:mime-version:subject:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ocsFiwuEJkgRhHUXXO04l74tBj3U0zgBh4dhIzfCIBY=; b=d06uDzL50KP+NAMvLuDMc3PSBHU6i7LSldEC71or8pFKhGVkwtEVqYZnw7WUXpmo4J +xzJ9L8DlRZot32EmCibjD9j6QW1zT/1W1Ay/B1eK2wFYOxQWiddEpuMy7R3ijxQDQa4 HuYNrATGBh7r1FbjxaesJMFvR+qfjFJ9GgwJouR9BqFqa2m1qZM6mpsAxKjo0KayJ1gL NwE+7NErSbib9VlX3kq7H/EHp0mItBabaCOOOyiwRnGinDU8TOOl9IER/ZxQ+DqRTM2E TxqRYFs0ELC7pG40sp1FbAQ1hkWqCqLAUbKLxE9DHTo9sE0u8Un8SPaslas+JEyGXce4 ezSw== X-Received: by 10.68.202.7 with SMTP id ke7mr46095255pbc.114.1435687776002; Tue, 30 Jun 2015 11:09:36 -0700 (PDT) Received: from [10.10.21.80] (otra.opentable.com. [199.16.144.7]) by mx.google.com with ESMTPSA id gj9sm46260646pbc.77.2015.06.30.11.09.35 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 30 Jun 2015 11:09:35 -0700 (PDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Subject: Re: Adding new dependencies for in-core From: Steven Schlansker In-Reply-To: <013001d0b35e$253ae9a0$6fb0bce0$@eu> Date: Tue, 30 Jun 2015 11:09:33 -0700 Cc: List Content-Transfer-Encoding: quoted-printable Message-Id: <0DC27A9D-1556-427B-91FF-4D4FBD1F52E2@gmail.com> References: <011501d0b357$26f1eca0$74d5c5e0$@eu> <3A641C7E-04D2-4554-8CDC-37A11E0178AB@gmail.com> <013001d0b35e$253ae9a0$6fb0bce0$@eu> To: Markus KARG X-Mailer: Apple Mail (2.1878.6) X-Pg-Spam-Score: -2.7 (--) List-Archive: List-Help: List-ID: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: X-Mailing-List: pgsql-jdbc Precedence: bulk Sender: pgsql-jdbc-owner@postgresql.org I'm having trouble believing any end user will replace the caching strategy= for prepared statements. Maybe one or two Gentoo refugees will, and they = will probably misconfigure it horribly anyway ;) On Jun 30, 2015, at 10:56 AM, Markus KARG wrote: > I see. Just to throw in a different idea: Possibly we might need caches in > other places too at a later time, so maybe we might like to apply strategy > design pattern instead of becoming directly dependent of one particular > class? I mean, it is nice that the linked hash map actually implies LRU, = but > if we want LRU, it might be a better design choice, to explicitly model t= his > as a class "LruCacheStrategy" which allows us to even configure or replace > the strategy later? >=20 > -----Original Message----- > From: Steven Schlansker [mailto:stevenschlansker@gmail.com]=20 > Sent: Dienstag, 30. Juni 2015 19:09 > To: Markus KARG > Cc: List > Subject: Re: [JDBC] Adding new dependencies for in-core >=20 > It is a Concurrent *Linked* HashMap, which presumably facilitates LRU > removal. >=20 > On Jun 30, 2015, at 10:06 AM, Markus KARG wrote: >=20 >> Vladimir, >>=20 >> sorry for being so ingorant not to give it a deeper thought, but what is > in CLHM what is not also in java.util.concurrent.ConcurrentHashMap? >>=20 >> -Markus >>=20 >> -----Original Message----- >> From: pgsql-jdbc-owner@postgresql.org > [mailto:pgsql-jdbc-owner@postgresql.org] On Behalf Of Vladimir Sitnikov >> Sent: Dienstag, 30. Juni 2015 14:21 >> To: List >> Subject: [JDBC] Adding new dependencies for in-core >>=20 >> Hi, >>=20 >> I've had a quick look into https://github.com/pgjdbc/pgjdbc/issues/345 >> (Share parsed query texts across different connections) and it looks like > https://github.com/ben-manes/concurrentlinkedhashmap would be useful to > implement the cache. >>=20 >> We don't need all the stuff CLHM has, but I see no easy&scalable way of > doing concurrent map with eviction by mere java.util.concurrent stuff. >>=20 >> Well, I can do lock splitting (i.e. use multiple small LRU caches instead > of a single big cache), however that looks like reinventing the wheel. >>=20 >> Can you suggest what is the best way of adding CLHM dependency? >> Should it be added in plain? >> Should it be shaded? (i.e. renamed to org.postgresql.clhm...) >>=20 >> I'm more inclined to the "add regular dependency" approach. >>=20 >> I expect similar question might appear if we consider using netty for IO. >>=20 >> -- >> Regards, >> Vladimir Sitnikov >>=20 >>=20 >> --=20 >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-jdbc >>=20 >>=20 >>=20 >> --=20 >> Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) >> To make changes to your subscription: >> http://www.postgresql.org/mailpref/pgsql-jdbc >=20 >=20 >=20 >=20 > --=20 > Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) > To make changes to your subscription: > http://www.postgresql.org/mailpref/pgsql-jdbc --=20 Sent via pgsql-jdbc mailing list (pgsql-jdbc@postgresql.org) To make changes to your subscription: http://www.postgresql.org/mailpref/pgsql-jdbc