如何正确配置GraphDb内存

Pet*_*nik 3 graphdb

我在研究项目中使用 GraphDb Free 8.6.1,我在具有 4GB 内存的 Linux 服务器上使用默认配置运行它。

但是,它已经开始抛出指向内存不足的异常:

Caused by: org.eclipse.rdf4j.repository.RepositoryException: Query evaluation error: Insufficient free Heap Memory 238Mb for group by and distinct, threshold:250Mb, reached 0Mb (HTTP status 500)
    at org.eclipse.rdf4j.http.client.SPARQLProtocolSession.execute(SPARQLProtocolSession.java:1143)
    at org.eclipse.rdf4j.http.client.SPARQLProtocolSession.executeOK(SPARQLProtocolSession.java:1066)
    at org.eclipse.rdf4j.http.client.SPARQLProtocolSession.sendTupleQueryViaHttp(SPARQLProtocolSession.java:834)
    at org.eclipse.rdf4j.http.client.SPARQLProtocolSession.getTupleQueryResult(SPARQLProtocolSession.java:763)
    at org.eclipse.rdf4j.http.client.SPARQLProtocolSession.sendTupleQuery(SPARQLProtocolSession.java:391)
    at org.eclipse.rdf4j.repository.http.HTTPTupleQuery.evaluate(HTTPTupleQuery.java:69)
Run Code Online (Sandbox Code Playgroud)

拜托,你能帮我找出问题所在吗?如何正确配置 GraphDB?

小智 6

您观察到的行为是distinct/group by 操作的内存优化的一部分。错误消息本身与 250 mb 的默认阈值有关,它是为了让您知道您需要调整内存。当空闲堆内存小于阈值时,将抛出 QueryEvaluationException 以避免由于饥饿的 distinct/group by 操作而导致内存不足。您可以调整阈值以最大限度地减少这些错误,方法是在启动 GraphDB“-Ddefaut.min.distinct.threshold=XXX”(可以设置为阈值的内存量(以字节为单位)时传递以下参数) .

Insufficient free Heap Memory 238Mb for group by and distinct, threshold:250Mb, reached 0Mb
238Mb = free heap space reported by the JVM
250Mb = the default threshold below which the protection should raise an exception to prevent OME
0Mb = the current buffer used for distinct and group by
Run Code Online (Sandbox Code Playgroud)

我怀疑另一个操作占用了您的大部分 RAM,一旦您运行任何 DISTINCT/GROUP BY 查询,它就会立即停止,因为 OME 保护。

  • 请注意参数名称中的(不是您的)拼写错误。自 GDB-8.8 发布以来,它应该是“-Ddefault.min.distinct.threshold”而不是“-Ddefault.min.distinct.threshold”(默认情况下缺少“l”)。它已在 GDB-8.8 版本中修复/更改。 (2认同)