Neo4j cpu卡在GC上

时间:2014-07-21 10:03:56

标签: 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"
  }
]

2 个答案:

答案 0 :(得分:2)

假设机器中有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

答案 1 :(得分:2)

我们也遇到过这类问题。除了类似于@ stefan-armbruster提到的将Neo4j更新为2.1.2的配置更改之外,我们还将Neo4j配置为使用G1垃圾收集而不是CMS。

自从进行垃圾收集更改以来,我们看到的峰值比以前少得多。

如果您想试一试,可以通过在conf/neo4j-wrapper.conf文件中添加以下内容来启用G1 GC。

wrapper.java.additional=-XX:+UseG1GC

希望结合使用这个和@ stefan-armbruster建议的更改,您将解决问题。