Hi Lukas, I was performance testing my application and surprisingly found the JPA annotation support in jOOQ to be a pretty significant bottleneck. The test I'm doing is essentially a significant amount of "get by id" and "update by id," a couple hundred threads in parallel. So the SQL is super simple. I'm looking for some guidance on what is the best route forward. I had once asked about caching the reflection information in the default mapper and I believe you said there was some option or it wasn't cached by default. Regardless, here's the details.
I highly recommend running Java Mission Control to reproduce this. Its freely available and packaged by default in the latest Java 7 JDKs. If you run it, look in the threads section for "contention." Basically what I'm seeing is that in a 60 second sample, over 30s is waiting on a lock held while the JDK is parsing the annotations. Because I have a high degree of concurrency on a small amount of tables (record classes) this leads to a significant amount of blocking. Basically, everytime you list the methods of a class, you actually get a new list with new Method instances. So when you call getAnnotation() it seems to actually parse the class bytes (or something). Then it caches the result in the Method obj. But if you get the method object over and over again, the caching is defeated. I disabled JPA by just changing the code and having isJPAenabled() return false. That sped up my application by almost 10x. I can't actually get rid of the JPA, I need the annotations. But I don't need JPA for the jOOQ mapper specifically. Specifically, I need jOOQ to generate the JPA annotations on the objects so that other programs can read the metadata, but at runtime I'm just using the generated record classes, so the JPA information is not needed by jOOQ. So is there some option to turn on caching or do I need to implemented a custom mapping provider? Thanks, Darren -- You received this message because you are subscribed to the Google Groups "jOOQ User Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
