十年網(wǎng)站開發(fā)經(jīng)驗(yàn) + 多家企業(yè)客戶 + 靠譜的建站團(tuán)隊(duì)
量身定制 + 運(yùn)營(yíng)維護(hù)+專業(yè)推廣+無憂售后,網(wǎng)站問題一站解決
創(chuàng)建60000個(gè)CI, 耗時(shí)1分51秒, 平均1秒創(chuàng)建540個(gè)CI, 每個(gè)CI包含屬性3-7個(gè)屬性
創(chuàng)新互聯(lián)公司專注于日土企業(yè)網(wǎng)站建設(shè),響應(yīng)式網(wǎng)站設(shè)計(jì),購物商城網(wǎng)站建設(shè)。日土網(wǎng)站建設(shè)公司,為日土等地區(qū)提供建站服務(wù)。全流程按需定制開發(fā),專業(yè)設(shè)計(jì),全程項(xiàng)目跟蹤,創(chuàng)新互聯(lián)公司專業(yè)和態(tài)度為您提供的服務(wù)
In [11]: py2neo_initialzation.create_ci(10000)
10000X6CIs
Tue Dec 24 17:04:43 2013
Tue Dec 24 17:06:34 2013
創(chuàng)建50000個(gè)關(guān)聯(lián)關(guān)系,耗時(shí)4分27秒,平均1秒創(chuàng)建187個(gè)relationship.
In [12]: py2neo_initialzation.create_relationship(10000)
Tue Dec 24 17:07:23 2013
Tue Dec 24 17:11:50 2013
測(cè)試代碼:
from py2neo import node,rel from py2neo import neo4j import time import datetime g=neo4j.GraphDatabaseService('http://localhost:7474/db/data') import cmdb.py2neo_function as neofunction # data initialize #storage def create_ci(total_ci): print '%dX6CIs' % total_ci print time.ctime() for i in range(total_ci): storage_name='storage_%d' % i small_server_name='aix_%d' % i lpar_name='lpar_%d' % i db_name='db_%d' % i was_name='was_%d' % i app_name='app_%d' % i g.create(node(ci_class='storage',city='Shanghai',district='PuDong',name=storage_name,rack=1,capacity=300), node(ci_class='small_server',city='Shanghai',district='PuDong',name=small_server_name,cpu_count=16,mem_GB=64), node(ci_class='lpar',city='Shanghai',district='PuDong',name=lpar_name,cpu_count=1,mem_GB=2), node(ci_class='db_instance',name=db_name,type='db2',version='9.1'), node(ci_class='was_node',name=was_name,version='6.1'), node(ci_class='application',name=app_name) ) print time.ctime() def create_relationship(total_ci): #get the nodes #get all storeage nodes print 'get all storage nodes, count number about %d' % total_ci print datetime.datetime.now() storage_list=neofunction.SearchNodes(g,'ci_class','storage') print datetime.datetime.now() #get all small_server nodes small_server_list=neofunction.SearchNodes(g,'ci_class','small_server') g.create((small_server_list[0],'depend_on',storage_list[0])) #get all lpar nodes lpar_list=neofunction.SearchNodes(g,'ci_class','small_server') #get all was nodes was_list=neofunction.SearchNodes(g,'ci_class','was_node') #get all db_instance nodes dbi_list=neofunction.SearchNodes(g,'ci_class','db_instance') #get all app nodes app_list=neofunction.SearchNodes(g,'ci_class','application') print time.ctime() for i in range(total_ci): g.create((lpar_list[i],'depend_on',small_server_list[i])) g.create((dbi_list[i],'running_on',lpar_list[i])) g.create((was_list[i],'running_on',lpar_list[i])) g.create((app_list[i],'depend_on',dbi_list[i])) g.create((app_list[i],'depend_on',was_list[i])) print time.ctime()