[ 
https://issues.apache.org/jira/browse/OPENEJB-1955?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13505759#comment-13505759
 ] 

Howard W. Smith, Jr. commented on OPENEJB-1955:
-----------------------------------------------

Okay, well, i'm really impressed with some results that I'm seeing already via 
a few setHint() I just added to 2 separate queries.

I did the following:

OrdersFacade.filterBy()
1. this retrieves data selected by user (usually current date)
2. this is the most commonly-used (or popular) query
3. added the following to this (dynamic sql) query:

.setHint("eclipselink.query-results-cache", "true");


OrdersFacade.findAllConfirmed()
1. retrieves data for the entire year, based on the date range selected by user 
(same date range passed to OrdersFacade.filterBy(), above)
2. this is called everytime OrdersFacade.filterBy(), above, is called
3. in production, this query is dynamic SQL
4. today, I changed this to be a namedQuery
5. with the code changes below, bval is NOT called!!!
6. added the following to this query:

q = getEntityManager().createNamedQuery(namedQuery);
q.setParameter("from", dateFrom, TemporalType.TIMESTAMP)
 .setParameter("to", dateTo, TemporalType.TIMESTAMP)
 .setHint("eclipselink.query-results-cache", "true")
 .setHint("eclipselink.read-only", "true");

Remember you told me to do the 'warmup'? I assume that can be the first 
retrieve, that can be cached, or at least the query results can be cached. So, 
I was just testing all of the code changes (above), and I can tell that the 
cache is being used. Here are the test results:

1. WARMUP: login to app and findAllConfirmed() for the first time: took 5,599 ms

2. Selected a FROM date, 11/19/2012, and findAllConfirmed() took 191 ms

3. Selected TO date, 11/23/2012 (which results in larger result set), and 
findAllConfirmed() took 102 ms

4. Selected a row on datatable and clicked VIEW, and then clicked Browse to 
return to page with dataTable, and findAllConfirmed() took 100 ms

I may need to add the following code changes to many other queries that I've 
defined in the app. Of course, I have to be careful to make sure that I don't 
add 'read-only' query hint everywhere, but I think it is safe to add read-only 
query hint to findAllConfirmed().

                
> TomEE 1.5.1 SNAPSHOT (and CDI beans) running slow on my production server
> -------------------------------------------------------------------------
>
>                 Key: OPENEJB-1955
>                 URL: https://issues.apache.org/jira/browse/OPENEJB-1955
>             Project: OpenEJB
>          Issue Type: Question
>          Components: container system
>    Affects Versions: 1.6.0
>         Environment: Windows Server 2003, 32-bit, PrimeFaces 3.5 SNAPSHOT, 
> PrimeFaces Push (Atmosphere/websockets) configured;
> Internet connection is powered by Verizon Wireless 4G
>            Reporter: Howard W. Smith, Jr.
>            Priority: Minor
>              Labels: 2003, atmosphere, server, tomee, windows
>             Fix For: 1.6.0
>
>         Attachments: 20121128_profileLogin1_getOrderNumberList.jpg, 
> 20121128_profileLogin1.jpg, 20121128_profileLogin2_getOrderNumberList.jpg, 
> 20121128_profileLogin2.jpg, 20121128_profileLogin3_getOrderNumberList.jpg, 
> 20121128_profileLogin3.jpg, 20121128_profileLogin_filterByDynamicSQL.jpg, 
> 20121128_profileLogin_filterByNamedQuery.jpg, catalina.2012-11-27.log, 
> jvisualvm_20121127.csv, jvisualvm_20121127.html, jvisualvm_20121127.nps, 
> jvisualvm.csv, jvisualvm.html, jvisualvm.nps, 
> jvisualvm_tomee_excel_smaller.csv, jvisualvm_tomee.html, jvisualvm_tomee.nps, 
> jvisualvm_tomee_smaller.csv, jvisualvm_tomee_smaller.html, web.xml
>
>   Original Estimate: 612h
>  Remaining Estimate: 612h
>
> I was working with Romain and Mark Struberg on this one, and decided to open 
> an issue, so I could attach files and continue discussion here.
> My TomEE/CDI-managed-beans web application is running really slow on 
> production server (Windows Server 2003 32-bit Verizon Wireless 4G internet 
> connection); runs faster on Windows Server 2008 64bit (cablemodem internet 
> connection).
> Currently in production, the Glassfish 3.1.2.2 and JSF-managed-beans version 
> of the web application is running much faster than the 
> TomEE/CDI-managed-beans version of the web application.
> Per Romain and Mark, I ran jvisualvm to provide some benchmarks.
> Please review attached files and confirm and advise.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to