Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EclipseLink » Performance Issue(High number of QueryKeyExpression objects)
icon4.gif  Performance Issue [message #530956] Mon, 03 May 2010 03:55 Go to next message
Sarkan is currently offline Sarkan
Messages: 10
Registered: May 2010
Junior Member
Dear All,

I was testing my project on following environment:

server : OC4J
JVM-Heap: 2056
Technology used: EJB3, Eclipselink, icefaces
Profiling: JProfiler
os: Linux

The issue we are facing during our load testing is a very high number of QueryKeyExpression objects are created during the load of 50 users which is consuming almost 40-50% of memory allocated.

I just want to know is there any configuration using which we can control number of objects created by eclipselink classes.

Urgent reply would be highly appreciated.

Thanks,

[Updated on: Mon, 03 May 2010 07:28]

Report message to a moderator

Re: Performance Issue [message #531070 is a reply to message #530956] Mon, 03 May 2010 11:30 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

That is odd, what is the query you are executing?

Have you already logged in, before the query? If not, it could be the startup initialization of all of your named queries.

How many expressions are being created, and what is the size of your project?


James : Wiki : Book : Blog : Twitter
Re: Performance Issue [message #531079 is a reply to message #531070] Mon, 03 May 2010 12:16 Go to previous messageGo to next message
Sarkan is currently offline Sarkan
Messages: 10
Registered: May 2010
Junior Member
Hi,

# We are having around 500 tables/entities containing around 1000 NamedQueries defined using annotations.

# Logging only after the server startup completely, not sure what you mean by "Have you already logged in, before the query?".

# QueryKeyExpression object counts - 1170008


we tried to increase the heap size but it doesn't help, do we have any configuration that we can try to bring this count low??





Re: Performance Issue [message #531178 is a reply to message #531079] Tue, 04 May 2010 02:17 Go to previous messageGo to next message
No real name is currently offline No real name
Messages: 2
Registered: May 2010
Junior Member
Hi,

I don't have a solution, but apparently the same 'problem'. For us, the heap is running low, too, but we have over 3 million of these objects (exact counter for both servers after running a load test with over 50 users here: 3,252,219 and 3,673,138).

Our environment (quite the same) - clustered x2:
server : OC4J 10g
JVM-Heap: 1024
Technology used: EJB3, EclipseLink, icefaces
Profiling/Monitoring: dynaTrace
os: suse enterprise Linux

Nearly 300 MB reports dynaTrace as being used by this single object which is from my perspective a little bit too much.

I'm not saying basically that there is a bug or something like that, it could be that the application code is using eclipselink in a not so optimal way which results in this.

The size of the project here is around 1000 tables with a not so easy to count named queries (I'm guessing 500).

Any advice on what I can analyze would be really helpful!

Thanks

[Updated on: Tue, 04 May 2010 02:22]

Report message to a moderator

Re: Performance Issue [message #531956 is a reply to message #531079] Thu, 06 May 2010 11:16 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

A million for 1000 queries definitely seems like something is wrong. Unless you have some insanely big queries, I would expect at most 10 per query, so around 10,000. Expressions are also used by mappings so for 500 classes you could have another few thousand.

Can you try using a memory profiler such as JProfiler to determine what is holding onto these queries?

Also ensure the gc has run, if you have a lot of memory the gc may have just not cleaned them up yet.

Is it just one specific query that causes the issue, or does this occur at startup after you first access to JPA, or does it gradually get worse as the application is used?

Are you executing a lot of dynamic queries?

Are you creating multiple persistence unit factories?



James : Wiki : Book : Blog : Twitter
Re: Performance Issue [message #532612 is a reply to message #531956] Mon, 10 May 2010 11:09 Go to previous messageGo to next message
Gunjan Bohra is currently offline Gunjan Bohra
Messages: 2
Registered: May 2010
Junior Member
I have same problem
Can we able to control QueryKeyExpression object by some paramater into XML. .
Or do we need to do some extract code for not to create excess object of QueryKeyExpression.java while no of user increase over server they can be shared.

In my project we are following 3 layer architecture and we are using EJB object to our UI layer so they are bind with my jsp till jsp is not going to be closed .
I checked into memory internally EJB VO holds by JSP and QueryKeyExpression VO holds by EJB object and they are just going to be double as I open different screen .

Re: Performance Issue [message #533352 is a reply to message #530956] Thu, 13 May 2010 09:45 Go to previous messageGo to next message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

I assume you are using some sort of memory profiler to determine the number of QueryKeyExpression instances.

If you cannot determine what is holding onto these instances please include the number of instances of other EclipseLink classes, or make the full dump available (attach to a bug).

Key classes are:
RelationExpression
CompoundExpression
ReadAllQuery
ReportQuery
ReportObjectQuery
ServerSession
ClientSession
UnitOfWorkImpl
EntityManagerFactoryImpl
RelationalDescriptor

Could you also try setting the following in a SessionCustomizer,

session.getProject().setJPQLParseCacheMaxSize(0);

and,

for (ClassDescriptor descriptor : session.getDescriptors().values()) {
descriptor.getQueryManager().setExpressionQueryCacheMaxSize( 0);
}

Does this have any affect?


James : Wiki : Book : Blog : Twitter
Re: Performance Issue [message #534736 is a reply to message #533352] Thu, 20 May 2010 04:10 Go to previous messageGo to next message
Sarkan is currently offline Sarkan
Messages: 10
Registered: May 2010
Junior Member
Hi James,

Above code doesn't help but one thing we noticed is once we remove the batch.join from the queries the number of QueryKeyExpression object reduced drastically.

But on the other hand the number of SQL's increased as expected.

Can you explore on this issue a bit more with above information and let us know if this is a bug or is there any solution which allow us to use Batch.Join and keeps the QueryKeyExpression object count low.

Thanks,
Re: Performance Issue [message #534940 is a reply to message #530956] Thu, 20 May 2010 13:57 Go to previous message
James Sutherland is currently offline James Sutherland
Messages: 1939
Registered: July 2009
Location: Ottawa, Canada
Senior Member

What do you mean by Batch.Join? Are you using batch reading, the BATCH query hint? Please include the code for your query.

Assuming you are using batch reading, and using LAZY, and caching, and have a very large cache size (what is your cache size?). The issue code be that the BatchValueHolder will hold the batch query which is defined from copying the original query and anding it with the mapping's query. This is a copy of the Expressions, but will only be one per query. However if you did a lot of these queries, you could get a lot of these expressions cached. Say if each query has 10 expressions, and you executed 100,000 independent queries and cached these 100,000 objects, and never instantiated their LAZY relationships, then you could get 1,000,000 expressions.

Please include the instance counts for the classes I listed in my previous reply, as well as your entities.

If you only use batch reading when you intend to instantiate the relationships, this may avoid the issue.

You also seem to be holding onto a lot of your objects, maybe decrease your cache size, or investigate how many of your own objects are in memory and what is holding onto them.

Also try the EclipseLink 2.1 release. Batch reading has been improved to prepare the batch queries, so this should reduce the number of expressions to 1 per named query, instead of 1 per executed query.




James : Wiki : Book : Blog : Twitter
Previous Topic:Problem with EclipseLink JPA 1.0 and Glassfish 2.1
Next Topic:Help with mapping a inherited relationship as a @OneToOne
Goto Forum:
  


Current Time: Fri Aug 29 04:17:24 EDT 2014

Powered by FUDForum. Page generated in 0.01755 seconds