我的目标是在有大约 50M 顶点的图中导入 25M 边。目标时间:
当前的导入速度约为 150 边/秒。远程连接的速度约为 100 边/秒。
- 提取 20,694,336 行(171 行/秒)- 20,694,336 行 -> 加载 20,691,830 个顶点(171 个顶点/秒)总时间:35989762ms [0 个警告,4 个错误]
- 提取 20,694,558 行(156 行/秒)- 20,694,558 行-> 加载 20,692,053 个顶点(156 个顶点/秒)总时间:35991185ms [0 个警告,4 个错误]
- 提取 20,694,745 行(147 行/秒)- 20,694,746 行-> 加载 20,692,240 个顶点(147 个顶点/秒)总时间:35992453ms [0 个警告,4 个错误]
- 提取 20,694,973 行(163 行/秒)- 20,694,973 行-> 加载 20,692,467 个顶点(162 个顶点/秒)总时间:35993851ms [0 个警告,4 个错误]
- 提取 20,695,179 行(145 行/秒)- 20,695,179 行-> 加载 20,692,673 个顶点(145 个顶点/秒)总时间:35995262ms [0 个警告,4 个错误]
我试图在 etl 配置中启用并行,但看起来它在 Orient 2.2.12 中完全被破坏(与 2.1 中的多线程更改不一致?)并且在上面的日志中只给了我 4 个错误。哑并行模式(运行 2 个以上的 ETL 进程)也无法用于 plocal 连接。
我的配置:
{
"config": {
"log": "info",
"parallel": true
},
"source": {
"input": {}
},
"extractor": {
"row": {
"multiLine": false
}
},
"transformers": [
{
"code": {
"language": "Javascript",
"code": "(new com.orientechnologies.orient.core.record.impl.ODocument()).fromJSON(input);"
}
},
{
"merge": {
"joinFieldName": "_ref",
"lookup": "Company._ref"
}
},
{
"vertex": {
"class": "Company",
"skipDuplicates": true
}
},
{
"edge": {
"joinFieldName": "with_id",
"lookup": "Person._ref",
"direction": "in",
"class": "Stakeholder",
"edgeFields": {
"_ref": "${input._ref}",
"value_of_share": "${input.value_of_share}"
},
"skipDuplicates": true,
"unresolvedLinkAction": "ERROR"
}
},
{
"field": {
"fieldNames": [
"with_id",
"with_to",
"_type",
"value_of_share"
],
"operation": "remove"
}
}
],
"loader": {
"orientdb": {
"dbURL": "plocal:/mnt/disks/orientdb/orientdb-2.2.12/databases/df",
"dbUser": "admin",
"dbPassword": "admin",
"dbAutoDropIfExists": false,
"dbAutoCreate": false,
"standardElementConstraints": false,
"tx": false,
"wal": false,
"batchCommit": 1000,
"dbType": "graph",
"classes": [
{
"name": "Company",
"extends": "V"
},
{
"name": "Person",
"extends": "V"
},
{
"name": "Stakeholder",
"extends": "E"
}
]
}
}
}
数据样本:
{"_ref":"1072308006473","with_to":"person","with_id":"010703814320","_type":"is.stakeholder","value_of_share":10000.0} {"_ref":"1075837000095", "with_to":"person","with_id":"583600656732","_type":"is.stakeholder","value_of_share":15925.0} {"_ref":"1075837000095","with_to":"person"," with_id":"583600851010","_type":"is.stakeholder","value_of_share":33150.0}
服务器的规格是:Google Cloud 上的实例、PD-SSD、6CPU、18GB RAM。
顺便说一句,在同一台服务器上,我设法在使用远程连接导入顶点时达到约 3k/秒(它仍然太慢,但对于我当前的数据集来说是可以接受的)。
问题是:是否有任何可靠的方法可以提高导入速度,比如每秒插入 10k 或至少 5k?我不想关闭索引,它仍然是数百万条记录,而不是数十亿条记录。
更新
几个小时后,性能继续恶化。
- 提取 23,146,912 行(56 行/秒)- 23,146,912 行-> 加载 23,144,406 个顶点(56 个顶点/秒)总时间:60886967ms [0 个警告,4 个错误]
- 提取 23,146,981 行(69 行/秒)- 23,146,981 行-> 加载 23,144,475 个顶点(69 个顶点/秒)总时间:60887967ms [0 个警告,4 个错误]
- 提取 23,147,075 行(39 行/秒)- 23,147,075 行-> 加载 23,144,570 个顶点(39 个顶点/秒)总时间:60890356ms [0 个警告,4 个错误]