简体   繁体   English

如何比较没有缓存的neo4j查询的性能?

[英]How to compare performance on neo4j queries without cache?

I've been trying to compare queries performance in neo4j. 我一直在尝试比较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. 为了提高查询效率,我添加了索引,使用profile分析了结果,并在使用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. 在大多数查询中,DB Hits使用第二个选项(使用USING INDEX)要好得多,行数相同或更少,但时间性能似乎不可靠:在几个查询中添加USING INDEX虽然性能更好但速度较慢通过重新执行查询,参数(db命中和行)和时间变得更好。

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). 为了阻止缓存的干扰,转到属性文件,将neo4j.properties中的cache_type更改为none并重新启动neo,但看起来每次相同查询的结果都会更快(直到某一点) 。

What will be the best way to test it? 测试它的最佳方法是什么?

Neo4j has (up to 2.2.x) a two layered cache architecture . Neo4j具有(高达2.2.x) 两层缓存架构 With cache_type=node you switch of just the object cache. 使用cache_type=node您只需切换对象缓存。 To disable page cache, you can use dbms.pagecache.memory=0 . 要禁用页面缓存,可以使用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. 但是,如果禁用所有缓存,则基本上可以测量IO子系统的速度,因为每个查询都会进入裸机并从磁盘读取。

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. 在旁注:在Neo4j 2.3中,对象缓存将消失,我们只有页面缓存。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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