棱锥螺纹不工作

2024-09-22 18:26:10 发布

您现在位置:Python中文网/ 问答频道 /正文

from concurrent.futures import ThreadPoolExecutor,as_completed
from rexpro import RexProConnection
query="g.V('node_type','x').count()"

future=[]
conns=[ RexProConnection('localhost', 8184, 'graph') for each in range(30)]
with ThreadPoolExecutor(max_workers=40) as executor:
    for each in range(30):
    future.append(executor.submit(conns[each].execute,query))
count=0
for f in as_completed(future):
    count=count+f.result()    
    print "count="+str(count)

我正在尝试优化我们的一个API,我们正在对titan数据库进行多次调用。我用顺序版本和上面提到的使用future的API进行了少量测试,测试表明,如果我们使用future,它的性能比顺序版本好50%,但问题是,当我把代码与金字塔框架集成时,它并没有显示出任何性能改进,这对我来说就像是金字塔的问题。我真的很感谢你的帮助。在


Tags: infromimportforascountrangefuture