garbage-collection - Neo4j cpu 卡在 GC 上

标签 garbage-collection neo4j jvm

突然间,工作一个月后,CPU 几乎没有使用(1% 到 5% 之间)。 Neo4j 服务器在垃圾收集方面卡住了 100% cpu。

我在 ubuntu 4 处理器服务器上运行 neo4j-entherprise 2.0.3(未嵌入)。

这是我的 neo4j 配置: 包装:

wrapper.java.additional=-Dorg.neo4j.server.properties=conf/neo4j-server.properties
wrapper.java.additional=-Djava.util.logging.config.file=conf/logging.properties
wrapper.java.additional=-Dlog4j.configuration=file:conf/log4j.properties

#********************************************************************
# JVM Parameters
#********************************************************************

wrapper.java.additional=-XX:+UseConcMarkSweepGC
wrapper.java.additional=-XX:+CMSClassUnloadingEnabled

# Remote JMX monitoring, uncomment and adjust the following lines as needed.
# Also make sure to update the jmx.access and jmx.password files with appropriate permission roles and passwords,
# the shipped configuration contains only a read only role called 'monitor' with password 'Neo4j'.
# For more details, see: http://download.oracle.com/javase/6/docs/technotes/guides/management/agent.html
# On Unix based systems the jmx.password file needs to be owned by the user that will run the server,
# and have permissions set to 0600.
# For details on setting these file permissions on Windows see:
#     http://download.oracle.com/javase/1.5.0/docs/guide/management/security-windows.html
wrapper.java.additional=-Dcom.sun.management.jmxremote.port=3637
wrapper.java.additional=-Dcom.sun.management.jmxremote.authenticate=true
wrapper.java.additional=-Dcom.sun.management.jmxremote.ssl=false
wrapper.java.additional=-Dcom.sun.management.jmxremote.password.file=conf/jmx.password
wrapper.java.additional=-Dcom.sun.management.jmxremote.access.file=conf/jmx.access

# Some systems cannot discover host name automatically, and need this line configured:
#wrapper.java.additional=-Djava.rmi.server.hostname=$THE_NEO4J_SERVER_HOSTNAME

# disable UDC (report data to neo4j..)
wrapper.java.additional=-Dneo4j.ext.udc.disable=true

# Uncomment the following lines to enable garbage collection logging
wrapper.java.additional=-Xloggc:data/log/neo4j-gc.log
wrapper.java.additional=-XX:+PrintGCDetails
wrapper.java.additional=-XX:+PrintGCDateStamps
wrapper.java.additional=-XX:+PrintGCApplicationStoppedTime
#wrapper.java.additional=-XX:+PrintPromotionFailure
#wrapper.java.additional=-XX:+PrintTenuringDistribution

# Uncomment the following lines to enable JVM startup diagnostics
#wrapper.java.additional=-XX:+PrintFlagsFinal
#wrapper.java.additional=-XX:+PrintFlagsInitial

# Java Heap Size: by default the Java heap size is dynamically
# calculated based on available system resources.
# Uncomment these lines to set specific initial and maximum
# heap size in MB.
#wrapper.java.initmemory=512
wrapper.java.maxmemory=3072

#********************************************************************
# Wrapper settings
#********************************************************************
# path is relative to the bin dir
wrapper.pidfile=../data/neo4j-server.pid

#********************************************************************
# Wrapper Windows NT/2000/XP Service Properties
#********************************************************************
# WARNING - Do not modify any of these properties when an application
#  using this configuration file has been installed as a service.
#  Please uninstall the service before modifying this section.  The
#  service can then be reinstalled.

# Name of the service
wrapper.name=neo4j

默认值:

# Default values for the low-level graph engine
neostore.nodestore.db.mapped_memory=25M
neostore.relationshipstore.db.mapped_memory=120M
neostore.propertystore.db.mapped_memory=90M
neostore.propertystore.db.strings.mapped_memory=100M
neostore.propertystore.db.arrays.mapped_memory=100M

我能做什么?

编辑:

存储文件大小:

[
  {
    "description": "Information about the sizes of the different parts of the Neo4j graph store",
    "name": "org.neo4j:instance=kernel#0,name=Store file sizes",
    "attributes": [
      {
        "description": "The total disk space used by this Neo4j instance, in bytes.",
        "name": "TotalStoreSize",
        "value": 401188207,
        "isReadable": "true",
        "type": "long",
        "isWriteable": "false ",
        "isIs": "false "
      },
      {
        "description": "The amount of disk space used by the current Neo4j logical log, in bytes.",
        "name": "LogicalLogSize",
        "value": 24957516,
        "isReadable": "true",
        "type": "long",
        "isWriteable": "false ",
        "isIs": "false "
      },
      {
        "description": "The amount of disk space used to store array properties, in bytes.",
        "name": "ArrayStoreSize",
        "value": 128,
        "isReadable": "true",
        "type": "long",
        "isWriteable": "false ",
        "isIs": "false "
      },
      {
        "description": "The amount of disk space used to store nodes, in bytes.",
        "name": "NodeStoreSize",
        "value": 524160,
        "isReadable": "true",
        "type": "long",
        "isWriteable": "false ",
        "isIs": "false "
      },
      {
        "description": "The amount of disk space used to store properties (excluding string values and array values), in bytes.",
        "name": "PropertyStoreSize",
        "value": 145348280,
        "isReadable": "true",
        "type": "long",
        "isWriteable": "false ",
        "isIs": "false "
      },
      {
        "description": "The amount of disk space used to store relationships, in bytes.",
        "name": "RelationshipStoreSize",
        "value": 114126903,
        "isReadable": "true",
        "type": "long",
        "isWriteable": "false ",
        "isIs": "false "
      },
      {
        "description": "The amount of disk space used to store string properties, in bytes.",
        "name": "StringStoreSize",
        "value": 128,
        "isReadable": "true",
        "type": "long",
        "isWriteable": "false ",
        "isIs": "false "
      }
    ],
    "url": "org.neo4j/instance%3Dkernel%230%2Cname%3DStore+file+sizes"
  }
]

最佳答案

假设您的机器有 16 GB RAM。

首先是设置 neostore.xxx.mapped_memory 设置以匹配商店文件的大小。我假设它们的总数为 5 GB -> 您还剩下 11 GB。请参阅http://docs.neo4j.org/chunked/2.0.4/configuration-caches.html了解更多详情。

为系统预留一些 RAM:1GB -> 您还剩下 10 GB。

使用 wrapper.java.initmemory wrapper.java.maxmemory 将剩余 RAM 分配给 java 堆。将两者设置为相同值。

如果 hpc 用作 cache_type,请考虑根据关系和节点的缓存命中率调整其设置。使用JMX来监控它们,http://docs.neo4j.org/chunked/2.0.4/jmx-mxbeans.html#jmx-cache-nodecache .

关于garbage-collection - Neo4j cpu 卡在 GC 上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24862445/

相关文章:

c# - 调试版本中带有垃圾收集的奇怪触发的奇怪错误

javascript - 合并关系并不总是有效(延迟)

c# - 这种 GC.SuppressFinalize() 的使用感觉不对

java - 本地创建的对象被另一个全局对象引用时会发生什么

java - Neo4J 遍历内存不足

tomcat - IntelliJ Idea tomcat 热插拔失败 : schema change not implemented Operation not supported by VM

java - 为什么 JVM 在这种情况下不终止?

java - 可以在 Eclipse 命令行应用程序中隐藏 JVM 终止向导

java - 升级Android项目以使用java 8并超出GC开销限制

java - 从 Neo4j 2.1.7 升级到 2.2.0