简体   繁体   中英

How to compare performance on neo4j queries without cache?

I've been trying to compare queries performance in neo4j.

In order to make the queries more efficient, I added index, analysed the result using profile, and tried doing the same while using the USING INDEX.

On most queries, DB Hits were much better using the second option (with the USING INDEX), rows were the same or less, but the time performance seems not to be reliable: on several queries adding the USING INDEX was slower though the better performance parameters (db hits & rows)and times got much better by re-executing a query.

In order to stop the cache's interfering, went to the the properties file, changed the cache_type in the neo4j.properties to none and restarted neo, but it still seems like the results of the same query comes faster each time (until a certain point).

What will be the best way to test it?

Neo4j has (up to 2.2.x) a two layered cache architecture . With cache_type=node you switch of just the object cache. To disable page cache, you can use dbms.pagecache.memory=0 . However if all caches are disabled you basically measure the speed of your IO subsystem since every query goes down to the bare metal and reads from disc.

I recommend a different approach: enable both caches and run the queries you want to compare multiple times to warm up caches. Take measurement on warmed cache since this is much closer to a real production scenario.

On a side note: in Neo4j 2.3 the object cache will go away and we just have the page cache.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM