Note that there are some explanatory texts on larger screens.

plurals
  1. POAwful performance of JPA batch processing compared to Hibernate or JDBC
    primarykey
    data
    text
    <p>I needed to create a batch recently which reads over a table with millions of rows. The table has about 12 columns and I only need to do a <code>read</code> operation. But I needed all fields therefore I thought about using persistence objects.</p> <p>I really used only the most basic code only to achieve that and with no tweaks. <code>JPA</code> was quite annoying because it forced me to use custom paging with <code>maxResults</code> and <code>minResults</code>. You can view the approximate code hyperlinks below, if you are interested. There really is nothing else to it, beside the default XML files etc.</p> <p>The JPA code: <a href="http://codeviewer.org/view/code:297e" rel="nofollow">http://codeviewer.org/view/code:297e</a><br> The Hibernate code: <a href="http://codeviewer.org/view/code:297f" rel="nofollow">http://codeviewer.org/view/code:297f</a><br> The JDBC code: same as above, but with "d" on the end (sorry I can only post 2 links)<br></p> <p>The result in time of finished operations was something like that. I am only talking of read-operations:</p> <pre><code>JPA: Per 5 seconds: 1.000||Per Minute: 12.000||Per Hour: 720.000 Hibernate: Per 5 seconds: 20.000||Per Minute: 240.000||Per Hour: 14.400.000 JDBC: Per 5 seconds: 50.000-80.000||Per Minute: 600.000-960.000||Per Hour: 36.000.000-57.600.000 </code></pre> <p>I can't explain it, but JPA is ridiculous. It can only be a big bad joke. The funny thing is that it startet with the same speed as the Hibernate code, but after about 30.000 records it became slower and slower until it got stable at 1.000 read operations per 5 seconds. It has reached that point after finishing approximately 100.000 records. But honestly... there is no point in that speed.</p> <p>Why is that so? Please explain it to me. I really don't know what I'm doing wrong. But I also think it shouldn't be that slow, even with default settings. It can't be and it must not be! In comparison to that Hibernate and <code>JDBC</code> speed is acceptable and stable all the time.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload