You should leave most heap available for the graph and keep index cache only if scenarios where it becomes a severe bottleneck. Do you have actual problems with the performance of index lookups or are you just comparing index.get to db.getNodeById and takes measures preemtively? I'm just saying that this might never be a problem to you.
2011/3/23 孤竹 <[email protected]> > Yes, I know I can't assign the IDS. But I can got some node's ID ,and cache > it in some place( i.e. in the cache). > > > when I need to search something , I got the id in the cache . Is it better > ? > > > At last, I wonder what size is property of the index? Depends On the memory > I gived to Neo4j ? > > > Is there a suggest rate ? for example , If the max-memory for Neo4j is 1G, > and the index is better less than 500M ? > > > ------------------ 原始邮件 ------------------ > 发件人: "mattias"<[email protected]>; > 发送时间: 2011年3月23日(星期三) 下午4:24 > 收件人: "Neo4j user discussions"<[email protected]>; > > 主题: Re: [Neo4j] neo4j reade with getNodeById && index.with... > > > And also to circumvent this different in performance for not-very-big > indexes you can make use of the built-in caching (for the new API)... see > > http://docs.neo4j.org/chunked/snapshot/indexing-lucene-extras.html#indexing-lucene-caching > > 2011/3/23 Tobias Ivarsson <[email protected]> > > > It is correct that getNodeById is much faster than an index lookup, but > IDs > > are assigned by Neo4j, there is no way for you as a user to assign IDs, > > which makes it a very blunt tool for looking up entities. To know which > id > > corresponds to a particular name or similar attribute, you would have to > go > > through an index, and that is exactly what the Neo4j index API does for > > you. > > > > By the way, the LuceneIndexService is a deprecated API, use > > GraphDatabaseService#index() instead: > > > > > http://components.neo4j.org/neo4j/1.3.M04/apidocs/org/neo4j/graphdb/GraphDatabaseService.html#index() > > > > Cheers, > > Tobias > > > > On Wed, Mar 23, 2011 at 3:45 AM, 孤竹 <[email protected]> wrote: > > > > > HI,all > > > > > > I Found something interesting, The test as follow: > > > > > > public static void main(String args[]) { > > > GraphDatabaseService db = new EmbeddedGraphDatabase("testDB"); > > > indexService = new LuceneIndexService(db); > > > Long startTime = System.currentTimeMillis(); > > > for(int i =0 ;i <10000;i++){ > > > Node node = getNodeByIndexProperty(db,String.valueOf(i)); > > > } > > > Long endTime = System.currentTimeMillis(); > > > System.out.println("time = " + (endTime - startTime)); > > > } > > > public static Node getNodeByIndexProperty(GraphDatabaseService db, > > > String keyValue) { > > > // Node node = indexService.getSingleNode(KEY_NAME, keyValue); > > > Node node = db.getNodeById(Long.valueOf(keyValue)); > > > return node; > > > } > > > > > > When I try to use the method indexService.getSingleNode...... with 9999 > > > times, It will take 2 seconds (nearly) , BY when I use > db.getNodeById.... > > > same times, It just take 350 millisecond . Does it mean getById is > faster > > > than use index ? or Does that mean the natural index is better than > index > > if > > > I can use it ? > > > > > > thanks for your help ,and replies, that help me very much! > > > _______________________________________________ > > > Neo4j mailing list > > > [email protected] > > > https://lists.neo4j.org/mailman/listinfo/user > > > > > > > > > > > -- > > Tobias Ivarsson <[email protected]> > > Hacker, Neo Technology > > www.neotechnology.com > > Cellphone: +46 706 534857 > > _______________________________________________ > > Neo4j mailing list > > [email protected] > > https://lists.neo4j.org/mailman/listinfo/user > > > > > > -- > Mattias Persson, [[email protected]] > Hacker, Neo Technology > www.neotechnology.com > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > _______________________________________________ > Neo4j mailing list > [email protected] > https://lists.neo4j.org/mailman/listinfo/user > -- Mattias Persson, [[email protected]] Hacker, Neo Technology www.neotechnology.com _______________________________________________ Neo4j mailing list [email protected] https://lists.neo4j.org/mailman/listinfo/user

