jvm - OrientDB 集群模式下的 Java OutOfMemory 错误
问题描述
我正在尝试使用 select 和本机 API 驱动程序连接以从 OrientDB 数据库中读取一个大表(5,000,000 行)。当我连接到本地数据库时,应用程序会加载一段时间,然后显示这样的消息:
java.lang.OutOfMemoryError: Java heap space
以下是我为 JVM 定义的参数以提高性能。如果没有这些参数,我会得到GC overhead limit
错误:
-Xmx800m -Dstorage.diskCache.bufferSize=7200 -server -XX:+PerfDisableSharedMem
为了修复这个错误并运行应用程序,我应该在此设置或集群设置中进行哪些更改?
OrientDB 使用 Docker 以集群模式设置:
version: '3'
services:
node1:
image: orientdb:latest
command: /orientdb/bin/server.sh -Ddistributed=true
volumes:
- /orientdb/config1:/opt/orientdb/config
- /orientdb/databases1:/orientdb/databases
- /orientdb/backup1:/orientdb/backup
- ./data:/orientdb/bin/data
environment:
ORIENTDB_ROOT_PASSWORD: 'pwd1'
ORIENTDB_NODE_NAME: node1
ports:
- "2424:2424"
- "2480:2480"
node2:
image: orientdb:latest
command: /orientdb/bin/server.sh -Ddistributed=true
volumes:
- /orientdb/config2:/opt/orientdb/config
- /orientdb/databases2:/orientdb/databases
- /orientdb/backup2:/orientdb/backup
- ./data2:/orientdb/bin/data
environment:
ORIENTDB_ROOT_PASSWORD: 'pwd1'
ORIENTDB_NODE_NAME: node2
depends_on:
- node1
OrientDB 配置设置:
val orientGraph = new OrientGraph("url","user","password")
我如何运行查询:
val orientTableRows:OrientDynaElementIterable = orientGraph.command(new OCommandSQL("select count(*) as count from Table1"))
.execute()
具有 OrientDB 依赖项的 build.sbt 文件:
val orientDbVersion = "3.0.4"
libraryDependencies ++= Seq(
"com.orientechnologies" % "orientdb-graphdb" % orientDbVersion,
"com.orientechnologies" % "orientdb-distributed" % orientDbVersion,
"com.orientechnologies" % "orientdb-core" % orientDbVersion,
"com.orientechnologies" % "orientdb-client" % orientDbVersion,
"com.orientechnologies" % "orientdb-server" % orientDbVersion,
"com.orientechnologies" % "orientdb-test-commons" % orientDbVersion,
"com.orientechnologies" % "orientdb-tools" % orientDbVersion,
"com.orientechnologies" % "orientdb-etl" % orientDbVersion,
"com.tinkerpop.blueprints" % "blueprints-core" % "2.6.0"
)
解决方案
推荐阅读
- sql-server - 如何将表格转换为平面文件,每个字段都在新行上
- pytorch - 为什么torch.cuda.device的设备参数可能大于torch.cuda.device_count()?
- lua - 如何使一行代码在循环中运行一次,并且只运行下一行代码,直到前一行运行一次?
- javascript - 将 NProgress 与“React.lazy”一起使用
- c# - “System.IO.File”不包含“ReadLines”的定义
- node.js - 在 Azure AppService 中运行 Angular 应用程序时可能导致“ng:未找到”的原因是什么?
- java - 加载大量文本时加快附加到java swing中的jTextArea
- c# - for (var i = 0; i < count; i++) { } == for (var i = 0; i < count; i++) { }。这是什么符号,为什么要使用它?
- javascript - 我不断收到“不变式失败:浏览器历史记录需要 DOM”错误
- php - $this->_objectProperty 中的下划线是什么意思?