如何比较没有缓存的neo4j查询的性能? [英] How to compare performance on neo4j queries without cache?
问题描述
我一直在尝试比较neo4j中的查询性能。
I've been trying to compare queries performance in neo4j.
为了提高查询效率,我添加了索引,使用配置文件分析了结果,在使用USING INDEX时尝试做同样的事情。
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.
在大多数查询中,DB Hits使用第二个选项(使用USING INDEX)要好得多,行数相同或者更少,但时间性能似乎不可靠:在几个查询中添加USING INDEX虽然性能参数(db hits& rows)更好,但通过重新执行查询得到的效果要好得多。
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.
为了阻止缓存的干扰,转到属性文件,将neo4j.properties中的cache_type更改为none并重新启动neo,但它仍然看起来像是同一个查询的结果每次都会更快(直到某一点)。
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有(最多2.2.x)a 两层缓存架构。使用 cache_type = node
,您只需切换对象缓存。要禁用页面缓存,可以使用 dbms.pagecache.memory = 0
。但是,如果禁用所有缓存,则基本上可以测量IO子系统的速度,因为每个查询都会进入裸机并从光盘读取。
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.
在旁注:在Neo4j 2.3中,对象缓存将消失,我们只有页面缓存。
On a side note: in Neo4j 2.3 the object cache will go away and we just have the page cache.
这篇关于如何比较没有缓存的neo4j查询的性能?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!