How to solve the problem that insert more and more slowly

35 views
Skip to first unread message

Xin Su

unread,
May 21, 2015, 8:27:09 AM5/21/15
to ne...@googlegroups.com
Hellow everyone : 
         It takes too much of virtual memory when I insert data.I have already referred(http://neo4j.com/docs/stable/linux-performance-guide.html#_setting_the_number_of_open_files)  and (http://neo4j.com/docs/stable/configuration-caches.html).
 public  Node getOrCreateNode(GraphDatabaseService _graphDb,Object _obj,Map<String, Object> _propsMap) {
   
long start=System.currentTimeMillis();
 
   
Validate.notNull(_obj);
   
Validate.notNull(_graphDb);
 
   
UniqueNodeFactory uniqueNodeFactory=new UniqueNodeFactory(_graphDb, CUSTOM_KEY_INDEX) {
     
@Override
     
protected void initialize(Node created, Map<String, Object> properties) {
       created
.setProperty(CUSTOM_KEY, properties.get(CUSTOM_KEY));
     
}
   
};

   
Node node= uniqueNodeFactory.getOrCreate(CUSTOM_KEY,_obj);
 

   
if (MapUtils.isNotEmpty(_propsMap)) {
     
for (String p : _propsMap.keySet()) {
       
if (!p.equals(CUSTOM_KEY)) {
         
Object objValue=_propsMap.get(p);
         
if (objValue instanceof List) {
           
Object objs=Neo4jTypeConverter.convertToNeo4jPropArray((List)objValue);
           node
.setProperty(p, objs);
         
}else {
           node
.setProperty(p, objValue);
         
}
       
}
     
}
   
}
   
   
if (LOG.isDebugEnabled()) {

     
long end=System.currentTimeMillis();
     LOG
.debug(GDBConstant.PROJECT+" "+node.getId()+",耗时:"+(end-start)+"ms");
   
}
 
return node;
}

neostore.nodestore.db.mapped_memory=250M
neostore.relationshipstore.db.mapped_memory=100M
neostore.propertystore.db.mapped_memory=100M
neostore.propertystore.db.strings.mapped_memory=100M
neostore.propertystore.db.arrays.mapped_memory=100M

vm.dirty_background_ratio = 50
vm.dirty_ratio = 80


Michael Hunger

unread,
May 21, 2015, 10:08:07 AM5/21/15
to ne...@googlegroups.com
Which version of Neo4j are you using?
How many nodes do you insert in a single transaction?

Please update to 2.2.2

How much heap do you use? What disk do you have in your system and how much memory?

--
You received this message because you are subscribed to the Google Groups "Neo4j" group.
To unsubscribe from this group and stop receiving emails from it, send an email to neo4j+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Xin Su

unread,
May 24, 2015, 9:45:36 PM5/24/15
to ne...@googlegroups.com
Thanks for your reply.
I user verson 2.0.1 of Neo4j.
1000 nodes in a single transaction.
I don't hava the size of the heap.
My system has 12G memory and 300g hard drive 

在 2015年5月21日星期四 UTC+8下午10:08:07,Michael Hunger写道:

Michael Hunger

unread,
May 25, 2015, 2:21:13 PM5/25/15
to ne...@googlegroups.com
Am 25.05.2015 um 03:45 schrieb Xin Su <suxinin...@gmail.com>:

Thanks for your reply.
I user verson 2.0.1 of Neo4j.
Upgrade to 2.2.2

1000 nodes in a single transaction.
That's fine up, to 50k nodes per tx should work well

I don't hava the size of the heap.
Why not? Set it to 4-6G

My system has 12G memory and 300g hard drive 
SSD or spinning disk?

Perhaps you can share your full code? Are you sure you're not having an outer transaction around the one that is committed after 1000 nodes?

Michael

Xin Su

unread,
May 25, 2015, 9:44:14 PM5/25/15
to ne...@googlegroups.com
Thanks,I will try

在 2015年5月26日星期二 UTC+8上午2:21:13,Michael Hunger写道:
Reply all
Reply to author
Forward
0 new messages