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,
]]>Sarkan2010-05-03T07:55:10-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/531070/#msg_531070
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 Sutherland2010-05-03T15:30:14-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/531079/#msg_531079
# 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??

]]>Sarkan2010-05-03T16:16:48-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/531178/#msg_531178
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).

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]]>No real name2010-05-04T06:17:26-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/531956/#msg_531956
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 Sutherland2010-05-06T15:16:59-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/532612/#msg_532612
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 .

]]>Gunjan Bohra2010-05-10T15:09:04-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/533352/#msg_533352
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).

Does this have any affect?
]]>James Sutherland2010-05-13T13:45:31-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/534736/#msg_534736
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,]]>Sarkan2010-05-20T08:10:58-00:00Re: Performance Issuehttps://www.eclipse.org/forums/index.php/mv/msg/167434/534940/#msg_534940
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.