Hi Marcel,

Below is my method, I am using DerbyPersistenceManager. 

Is there anyway, we can by pass using persistence manager? 
What are the trade offs of not using persistence manager?

public ArrayList getBulletinList(String bulletinType, String model) throws
RepositoryException {
                
                log.info("Entering .....");
                long startTime = System.currentTimeMillis();
                //String query = "//" + PRIMARY_NODE + "/child::*";
                //String query = "//element(*, bulletin)";
                //String query = "//element(*, " + NODE_TYPE + " )";
                String query ="/jcr:root/BULLETIN//element(*, " + NODE_TYPE
+")[jcr:deref(@btnmodel='" + model +"') and" +
                                                                                
                        " jcr:deref(@btnbulletin_type='"+ bulletinType +"')] 
order by
jcr:score() descending";
                
                
                ArrayList list = new ArrayList();
                
                long getResultsStartTime = System.currentTimeMillis();
                
                QueryResult results = getQueryResults(query);
                
                long getResultsEndTime = System.currentTimeMillis();
                log.info("getting nodes from Resultset took " + 
(getResultsEndTime -
getResultsStartTime) + " ms");
                
                NodeIterator it =  results.getNodes();
                

                log.debug("Size is  " + it.getSize());
                BulletinDTO dto = null;
                //while (it.hasNext()) {
                long loopStartTime = System.currentTimeMillis();
                for (int i= 0; i < it.getSize(); i++){
                        
                        Node n = (Node) it.next();
                        
                        //log.debug("Node name is  " + n.getName());
                        
                        dto = new BulletinDTO();
                        dto.setName(n.getName());
                        dto.setUuid(n.getUUID());
                        dto.setBulletinId(n.getProperty(ID).getLong());
                
dto.setBulletinTypeRef(n.getProperty(REF_BULLETIN_TYPE).getNode().getUUID());
                        
dto.setModelRef(n.getProperty(REF_MODEL).getNode().getUUID());
                        dto.setContent(n.getProperty(REF_TOPIC).getStream());
                        list.add(dto);
                        
                }
                long loopEndTime = System.currentTimeMillis();
                log.info("To loop through and populate 1000 dtos it took" + 
(loopEndTime -
loopStartTime) + " ms");
                
                long finishTime = System.currentTimeMillis();
                log.debug("Finished in " + (finishTime - startTime) + "ms");
                log.info("Finished");
                return list;

                }

metrics from log are 
13-43-2007 11:43:16:726 - INFO -
com.entity.data.daoimpl.GenericDAOImpl.getQueryResults() :Finished in 500 ms
13-43-2007 11:43:16:726 - INFO -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :getting nodes
from Resultset took 500 ms
13-43-2007 11:43:16:742 - DEBUG -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :Size is  10000
13-43-2007 11:43:32:226 - INFO -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :To loop through
and populate 1000 dtos it took15484 ms
13-43-2007 11:43:32:226 - DEBUG -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :Finished in
16000ms

I made another call with in same session, their logs are

13-43-2007 11:43:32:414 - INFO -
com.entity.data.daoimpl.GenericDAOImpl.getQueryResults() :Finished in 188 ms
13-43-2007 11:43:32:414 - INFO -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :getting nodes
from Resultset took 188 ms
13-43-2007 11:43:32:430 - DEBUG -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :Size is  10000
13-43-2007 11:43:33:305 - INFO -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :To loop through
and populate 1000 dtos it took875 ms
13-43-2007 11:43:33:305 - DEBUG -
com.entity.data.daoimpl.BulletinDAOImpl.getBulletinList() :Finished in
1079ms





Marcel Reutegger wrote:
> 
> Kisu San wrote:
>> This has significantly increased the performance. Thanks Marcel.  Now it
>> is
>> taking 9547 milli seconds to get 1000 matching nodes out of 10,000 nodes. 
>> Initially it was 222,406 milli seconds.
>> 
>> Anymore tips to improve this performance further?
> 
> that requires more detailed analysis. what persistence manager do you use?
> maybe 
> getting the 1000 nodes through the persistence manager takes the time. Is
> the 
> time spent looping over the result node iterator, or is it still spent on
> the 
> first hasNext() call? what's the exact query do you execute?
> 
> if the loop takes 10 seconds to run, you can also create a couple of
> thread 
> dumps while the program runs. this will show you quite easily where the
> time is 
> spent.
> 
>>>> param name="respectDocumentOrder" value="false"/
>> 
>> I have tried this some time back, but it did not help at all. I have
>> created
>> the nodes with this value 'true' and then changed to 'false' at the time
>> of
>> firing query.
>> 
>> It seems that jackrabbit did not pick up these changes. I thought when I
>> logout and login to session, it will pick up the new repository.xml
>> changes. 
>> Am I wrong here. Do I need to do anything else.
> 
> you have to restart the whole repository, otherwise the change won't have
> any 
> effect.
> 
> regards
>   marcel
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Problem-with-NodeIterator-tf4791277.html#a13724414
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Reply via email to