It is likely because the caching infrastructure needs to load the nodes
once, and then can progressively optimize traversals after that.

A common practice to boost "first user" request performance is to
"pre-cache" certain frequently accessed content by executing a dummy
traversal/query when you start your application or web application.




-----Original Message-----
From: user-boun...@lists.neo4j.org [mailto:user-boun...@lists.neo4j.org] On
Behalf Of Darren Jensen
Sent: Thursday, December 17, 2009 8:16 AM
To: user@lists.neo4j.org
Subject: [Neo] traverser speed on first execution

Hi Neo4j users,

My model is based on a typical Yellow Pages style business directory which
basically consists of Categories (like "Hotels", "Restaurants", "Swimming
Pools" etc) and Listings (e.g. "Marriott Hotel"). A listing can be placed
under one or more Categories and a Category can contain one or more
Listings.

I have written a simple traverser that returns all the Listings in a
Category. I am testing with a Category that contains 566 listing nodes. I am
wondering why the first time the code executes, it is much slower than
subsequent executes? Can you tell me a little bit more about what is
happening under the hood please? Is the first execution slower becuase Neo4j
has to setup the traverser or is it to setup the transaction? Are there any
improvements that I can make to speed up the first execution?

Here are the execution times (in order of execution):

Duration: 661 ms
Duration: 128 ms
Duration: 82 ms
Duration: 82 ms
Duration: 121 ms
Duration: 31 ms
Duration: 25 ms
Duration: 20 ms
Duration: 12 ms
Duration: 8 ms
Duration: 7 ms
Duration: 6 ms
Duration: 4 ms

This is the traverser code (which is executed in a transaction):

Traverser listingInCategoryTraverser = categoryNode.traverse(
    Traverser.Order.BREADTH_FIRST,
    StopEvaluator.END_OF_GRAPH,
    ReturnableEvaluator.ALL_BUT_
START_NODE,
    RelTypes.CATEGORIZED_AS,
    Direction.INCOMING );

Many thanks for any comments and ideas!

Darren
_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

_______________________________________________
Neo mailing list
User@lists.neo4j.org
https://lists.neo4j.org/mailman/listinfo/user

Reply via email to