Return-Path: X-Original-To: apmail-openjpa-users-archive@minotaur.apache.org Delivered-To: apmail-openjpa-users-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id EAD357B7B for ; Mon, 12 Sep 2011 22:00:32 +0000 (UTC) Received: (qmail 57145 invoked by uid 500); 12 Sep 2011 22:00:32 -0000 Delivered-To: apmail-openjpa-users-archive@openjpa.apache.org Received: (qmail 57120 invoked by uid 500); 12 Sep 2011 22:00:32 -0000 Mailing-List: contact users-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: users@openjpa.apache.org Delivered-To: mailing list users@openjpa.apache.org Received: (qmail 57112 invoked by uid 99); 12 Sep 2011 22:00:32 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Sep 2011 22:00:32 +0000 X-ASF-Spam-Status: No, hits=1.6 required=5.0 tests=FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_LOW,SPF_PASS,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of curtisr7@gmail.com designates 209.85.215.41 as permitted sender) Received: from [209.85.215.41] (HELO mail-ew0-f41.google.com) (209.85.215.41) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 12 Sep 2011 22:00:27 +0000 Received: by ewy9 with SMTP id 9so2275953ewy.0 for ; Mon, 12 Sep 2011 15:00:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=tA1J+aBBCDN6o40KCizuqvVNLSl0Ec16OsA7imFUT3U=; b=twvD+USRU3XibiLIBfWgC5U/5ka+OXNNI7XQIgpmbqj4VaNs9cuQXBf9BaMhEzoCql E6ZsU/FAEeXjM86RLmmmA/9hzMKGmeS5ZkfMQ5WWS2toha8usXDHuJsYtMKM0bH53lWE p1PQVCl7rDnytDK4b9UBXPXi/cji2TI9nkBWE= MIME-Version: 1.0 Received: by 10.213.21.5 with SMTP id h5mr14131ebb.39.1315864805581; Mon, 12 Sep 2011 15:00:05 -0700 (PDT) Received: by 10.213.108.206 with HTTP; Mon, 12 Sep 2011 15:00:05 -0700 (PDT) In-Reply-To: References: Date: Mon, 12 Sep 2011 17:00:05 -0500 Message-ID: Subject: Re: Speed of fetching simple entities using OpenJPA From: Rick Curtis To: users@openjpa.apache.org Content-Type: multipart/alternative; boundary=0015174c131c4f23bb04acc5a6bd --0015174c131c4f23bb04acc5a6bd Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable > I could submit a zip including the tests and a persistence.xml tomorrow, = i guess. That would probably be the most expedient way to figure out what is going on. > Does anyone on the openjpa dev team run such performance tests? We don't have anything (that I'm aware of) that runs as part of our builds. You are correct that it would be easy enough write a smallish benchmark roo= t out potential regressions ... if someone invested the time. That being said= , we're continually assessing the performance of OpenJPA to ensure that it is competitive with other providers. On Mon, Sep 12, 2011 at 2:12 PM, Michael Pflueger wrote: > Hi, here's the code: > > em =3D emf.createEntityManager(); > CriteriaBuilder cb =3D em.getCriteriaBuilder(); > CriteriaQuery cqte =3D > cb.createQuery(TestEntity.class); > Root rte =3D cqte.from(TestEntity.class); > TypedQuery qte =3D > em.createQuery(cqte).setMaxResults(2000000); > long queryTime =3D System.currentTimeMillis(); > List entities =3D qte.getResultList(); > int cnt =3D 0; > long sum =3D 0; > for(TestEntity te : entities) { > cnt++; > sum +=3D te.getId(); > if(cnt % 2000 =3D=3D 0) { > em.clear(); > } > } > // > > TestEntity just has that single ID attribute. > I could submit a zip including the tests and a persistence.xml tomorrow, = i > guess. > > Does anyone on the openjpa dev team run such performance tests? > I guess those could be automated and run regularly against trunk so > regressions are spotted quickly. > > Michael > > -----Urspr=FCngliche Nachricht----- > Von: Rick Curtis [mailto:curtisr7@gmail.com] > Gesendet: Montag, 12. September 2011 20:44 > An: users@openjpa.apache.org > Betreff: Re: Speed of fetching simple entities using OpenJPA > > Michael - > > I wouldn't expect to see that large of a difference of JPA vs JDBC. Can y= ou > describe your scenario a little better? Are you issuing just a single JPQ= L > to select all of your Entities? > > Thanks, > Rick > > On Mon, Sep 12, 2011 at 1:36 PM, Michael Pflueger > wrote: > > > Hi, > > I compared JDBC and OpenJPA speed of fetching simple entities (consisti= ng > > only of a single ID attribute). The speed difference seems quite severe= . > > > > With JDBC, I can read 2 million entities in about 3 seconds when OS/DB > > caches are warm. > > With OpenJPA using slice (a single slice), it takes a bit above 30 > seconds, > > so about ten times as long, more than I would expect. > > Using a direct connection without slice reduces this time to about 24 > > seconds, ~8 times as much as the JDBC version. > > > > In the JDBC test I also create objects from the rows, so both tests > include > > object creation overhead of the entities (plus a sum calculation of the > > IDs). > > > > I'm doing this test using PostgreSQL and an up to date OpenJPA 2.2 > > snapshot. > > Entities are enhanced using javaagent enhancement. > > > > I tried optimizing OpenJPA performance with: > > > value=3D"always"> > > > > > > > > > value=3D"fetch-groups(DetachedStateField=3Dfalse)"/> > > > > But those didn't seem to affect performance in any significant way. > > > > Now, is such a large performance hit expected, and what would be the > > reason? > > It would be nice if some performance numbers like these would be in the > > documentation, by the way, to be better able to judge for what > applications > > OpenJPA can be used/what performance penalties one has to expect, > depending > > on the situation. > > > > Regards, > > Michael > > ___________________________________________________ > > > > SMA Solar Technology AG > > Aufsichtsrat: Guenther Cramer (Vorsitzender) > > Vorstand: Juergen Dolle, Roland Grebe, Uwe Hertel, Pierre-Pascal Urbon, > > Marko Werner > > Handelsregister: Amtsgericht Kassel HRB 3972 > > Sitz der Gesellschaft: 34266 Niestetal > > USt-ID-Nr. DE 113 08 59 54 > > WEEE-Reg.-Nr. DE 95881150 > > ___________________________________________________ > > > > > > > -- > *Rick Curtis* > --=20 *Rick Curtis* --0015174c131c4f23bb04acc5a6bd--