问题
I'm using neo4j 2.0 community edition in rest server on ubuntu.
Every time a first query is slow response after startup the neo4j.
And remain queries which is same the first one are fast response. I guess this behavior is relative to cache.
I tried to cache all primitives(node, rel, props) by following query. I executed the query using webadmin after stareted up neo4j server, but the first query performance didn't improve.
start n=node(*) match n--m return count(n)
or
match (n)-[r]-() return count(n)
All primitives size about 1.5GB, and my computer resource is enough. my neo4j.properties is here:
# 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
Is there a way that neo4j communith edition startup with cache in worm up?
Thanks
回答1:
Which version are you using?
They only way you can warm up your cache is to run your typical queries.
It is 3-fold
- warm up the filesystem caches (mmio)
- warm up the high-level caches (object-cache)
- precompile the cypher queries that you will use so cypher has not to build them for the first user.
This query should help with warmup:
match (n)-[r]-() return count(n)
If you also want to load properties too you can add:
match (n)-[r]-() where not has(n.foo) and not has(r.foo) return count(n)
What do your typical queries that are slow look like?
来源:https://stackoverflow.com/questions/20632421/can-neo4j-community-edition-start-in-warm-up