2013-12-17 47 views
1

我在ubuntu上的其他服務器上使用neo4j 2.0社區版。
每次啓動neo4j後,第一個查詢都是慢響應。 並保持與第一個相同的查詢是快速響應。我想這種行爲是相對於緩存。
我試圖通過以下查詢緩存所有原語(節點,rel,道具)。我在啓動neo4j服務器之後使用webadmin執行查詢,但第一個查詢性能沒有提高。Neo4j社區版開始熱身?

start n=node(*) match n--m return count(n) 

match (n)-[r]-() return count(n) 

所有原始大小約爲1.5GB,而我的計算機資源是不夠的。 我neo4j.properties是在這裏:

# Default values for the low-level graph engine 
all_stores_total_mapped_memory_size=1500M 
eostore.nodestore.db.mapped_memory=150M 
neostore.relationshipstore.db.mapped_memory=200M 
neostore.propertystore.db.mapped_memory=600M 
neostore.propertystore.db.strings.mapped_memory=500M 
neostore.propertystore.db.arrays.mapped_memory=10M 

# Enable this to be able to upgrade a store from an older version 
#allow_store_upgrade=true 

# Enable this to specify a parser other than the default one. 
cypher_parser_version=2.0 

# Keep logical logs, helps debugging but uses more disk space, enabled for 
# legacy reasons To limit space needed to store historical logs use values such 
# as: "7 days" or "100M size" instead of "true" 
keep_logical_logs=true 

# Autoindexing 

# Enable auto-indexing for nodes, default is false 
#node_auto_indexing=true 

# The node property keys to be auto-indexed, if enabled 
#node_keys_indexable=name,age 

# Enable auto-indexing for relationships, default is false 
#relationship_auto_indexing=true 

# The relationship property keys to be auto-indexed, if enabled 
#relationship_keys_indexable=name,age 

dump_configuration=true 

是否有Neo4j的communith Edition啓動與蠕蟲了緩存的方法嗎?

謝謝

回答

2

你正在使用哪個版本?

他們只有你可以預熱緩存的方式是運行你的典型查詢。

這是3倍

  1. 熱身文件系統緩存(MMIO)
  2. 熱身高級緩存(對象緩存)
  3. 預編譯,你會用這樣的暗號查詢cypher並沒有爲第一個用戶構建它們。

該查詢應預熱幫助:

match (n)-[r]-() return count(n)

如果你也想太加載屬性,你可以添加:

match (n)-[r]-() where not has(n.foo) and not has(r.foo) return count(n)

,請問您是典型的查詢緩慢的樣子?

+0

我正在使用2.0版穩定社區版。我想知道在啓動之後執行查詢是指緩存文件系統還是對象緩存。我的典型查詢就像這個查詢:「match(u:User {uid:{uid}}) - [:READ] - >(b:Book)< - [:READ] - (u2:User)with (u2)作爲user_rank order by user_rank desc limit 100匹配u2 - [:READ] - >(b2:Book)with b2,count(b2)作爲排名順序排名desc limit 1000 match(u:User {uid :{uid}})其中不是(b2)< - [:READ] - (u)返回b2.name,通過rank desc limit 100排序「」我用參數查詢uid。 – Michael

+0

我的圖表模型示例如下鏈接: http://console.neo4j.org/?id=27ke5p 實際模型包含320K圖書和50K用戶,一個用戶擁有約10本閱讀書籍。 – Michael

+0

我上面的查詢打算按照用戶相似性推薦圖書。我注意到,如果where子句中的比較節點很大,則使用非模式的響應時間較慢,所以我選擇使用with clause來過濾節點。 謝謝 – Michael