我正在尝试使用select API和本机API驱动程序从OrientDB数据库读取一个大表(5,000,000行)。当我连接到本地数据库时,应用程序将加载一段时间,然后显示以下消息:
java.lang.OutOfMemoryError: Java heap space
以下是我为JVM定义的参数,以提高性能。没有这些参数,我会得到GC overhead limit
错误:
-Xmx800m -Dstorage.diskCache.bufferSize=7200 -server -XX:+PerfDisableSharedMem
我应该在此设置或群集设置中进行哪些更改以修复此错误并运行应用程序?
使用Docker以集群模式设置OrientDB:
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"
)