2017-12-27 9 views
0

Funkenjob bei mir läuft:Neo4j: Worker für Sitzung..abgestürzt. Java Heap-Speicher OutOfMemoryError

Es ist ein ziemlich einfaches Programm, das von Java und ‚parallelisiert‘ zu scala umgewandelt wurde (es wurde nicht parallel zu lief, sondern soll ein Experiment a) lerne spark und neo4j und b) schau, ob ich ein paar Geschwindigkeitssteigerungen erzielen kann, wenn ich nur auf einem Funkencluster laufe, mit mehr Knoten, die mehr Arbeit machen. Der Grund dafür ist, dass der große Flaschenhals ein räumlicher Aufruf innerhalb des Neo4j-Chiffrierskripts ist (ein Aufruf innerhalb von Distance). Der Testsatz von Daten ist ziemlich klein 52.000 Knoten und etwa 140 mb Größe einer Datenbank.

Auch wenn Neo4j startet es gibt mir eine Warnung von

Starting Neo4j. 
WARNING: Max 4096 open files allowed, minimum of 40000 recommended. See the Neo4j manual. 
/usr/share/neo4j/bin/neo4j: line 411: /var/run/neo4j/neo4j.pid: No such file or directory 

die seltsam ist, da ich glaube, dass offene Dateien und ich fragte den Systemadministrator, dass zu viel höher zu setzen? (ulimit -Hn scheint dies zu bestätigen? Sagt 90.000 obwohl eine ulimit -a zeigt Dateien bei 4096 (softlimit) Ich denke, das ist, was Neo4j sieht und winselt)

Auch wenn ich das lokal auf meinem Mac OS X lief Software würde ungefähr 14 Stunden oder so (vielleicht 9) laufen und ausführen, und dann würde ich in der Konsole sehen, dass die Datenbank einfach aufhören würde, mit dem Funken zu sprechen. Es war nicht down oder irgendetwas wie der Job würde auslaufen und ich könnte immer noch cipher-shell in die Datenbank. Aber es würde irgendwie die Verbindung zu den Funkenjobs verlieren, so dass sie versuchen würden und schließlich würde der Funke einfach aufgeben und aufhören.

C02RH2U9G8WM:scala-2.11 little.mac$ ulimit -Hn 
unlimited 

(auch seit zuletzt ich upped auch meine Grenzen mehr in der Neo4j conf, jetzt mit Speicher 4gb max für Speichergrößen)

Einige Code-Bits aus dem Job (die portierte Code scala Verwendung mit fügte Funken Dataframes hinzu. Ich weiß, dass es nicht richtig parallel ist, aber hatte gehofft, etwas zum Arbeiten zu bekommen, bevor man vorwärts drückt.). Ich habe ein hybrides Programm erstellt, das wie der Code in Java ist, den ich portiert habe, aber mit Datenframes von spark (verbunden mit neo4j).

Im Wesentlichen (Pseudocode):

while (going through all these lat and lons) 
{ 
    def DoCalculation() 
    { 

     val noBbox="call spatial.bbox('geom', {lat:" + minLat +",lon:"+minLon +"}, {lat:"+maxLat+",lon:" + maxLon +"}) yield node return node.altitude as altitude, node.gtype as gtype, node.toDateFormatLong as toDateFormatLong, node.latitude as latitude, node.longitude as longitude, node.fromDateFormatLong as fromDateFormatLong, node.fromDate as fromDate, node.toDate as toDate ORDER BY node.toDateFormatLong DESC";   
     try { 
        //not overly sure what the partitions and batch are really doing for me. 
        val initialDf2 = neo.cypher(noBbox).partitions(5).batch(10000).loadDataFrame 

        val theRow = initialDf2.collect() //was someStr 

        for(i <- 0 until theRow.length){ 
          //do more calculations 

         var radius2= 100 
         //this call is where the biggest bottle neck is,t he spatial withinDistance is where i thought 
         //I could put this code ons park and make the calls through data frames and do the same long work 
         //but by batching it out to many nodes would get more speed gains? 

         val pointQuery="call spatial.withinDistance('geom', {lat:" + lat + ",lon:"+ lon +"}, " + radius2 + ") yield node, distance WITH node, distance match (node:POINT) WHERE node.toDateFormatLong < " + toDateFormatLong + " return node.fromDateFormatLong as fromDateFormatLong, node.toDateFormatLong as toDateFormatLong";  
         try { 

          val pointResults = neo.cypher(pointQuery).loadDataFrame; //did i need to batch here? 
          var prRow = pointResults.collect();  
          //do stuff with prRow loadDataFrame   
         } catch { 
          case e: Exception => e.printStackTrace 
         } 
         //do way more stuff with the data just in some scala/java datastructures 
        } 
       } catch { 
        case e: Exception => println("EMPTY COLLECTION") 
      } 
    } 
} 

einen Funken einreichen Auftrag läuft, die den Funken Stecker useses zu Neo4j ich diese Fehler in /var/log/neo4j/neo4j.log

java.lang.OutOfMemoryError: Java heap space 
2017-12-27 03:17:13.969+0000 ERROR Worker for session '13662816-0a86-4c95-8b7f-cea9d92440c8' crashed. Java heap space 
java.lang.OutOfMemoryError: Java heap space 
     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.addConditionWaiter(AbstractQueuedSynchronizer.java:1855) 
     at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:2068) 
     at java.util.concurrent.ArrayBlockingQueue.poll(ArrayBlockingQueue.java:418) 
     at org.neo4j.bolt.v1.runtime.concurrent.RunnableBoltWorker.run(RunnableBoltWorker.java:88) 
     at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) 
     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
     at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 
     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) 
     at java.lang.Thread.run(Thread.java:748) 
     at org.neo4j.helpers.NamedThreadFactory$2.run(NamedThreadFactory.java:109) 
2017-12-27 03:17:23.244+0000 ERROR Worker for session '75983e7c-097a-4770-bcab-d63f78300dc5' crashed. Java heap space 
java.lang.OutOfMemoryError: Java heap space 

erhalten zu verbinden weiß ich, dass die Neo4j .conf-Datei Ich kann die heapsizes ändern (zur Zeit auskommentiert, aber auf 512m eingestellt). Die Frage, die ich stelle, ist, was in der Datei conf steht:

# 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. 

Also bedeutet das nicht, dass ich die Heapsize hier im conf verlassen sollte, wenn sie berechnet werden, um sicher mehr zu sein, als was ich einstellen kann? (Diese Maschinen haben 8cores und 8gb RAM). Oder würde das gezielte Einstellen wirklich helfen? vielleicht 2000 (wenn es in Megabyte ist), um zwei Gigs zu bekommen? Ich frage, weil ich finde, dass die Fehlerprotokolldatei diesen Speicherfehler gibt, aber es ist wirklich aus einem anderen Grund.

BEARBEITEN Sie meine jvm-Werte aus dem Debug.log

VOR:

2017-12-26 16:24:06.768+0000 INFO [o.n.k.i.DiagnosticsManager] NETWORK 
2017-12-26 16:24:06.768+0000 INFO [o.n.k.i.DiagnosticsManager] System memory information: 
2017-12-26 16:24:06.771+0000 INFO [o.n.k.i.DiagnosticsManager] Total Physical memory: 7.79 GB 
2017-12-26 16:24:06.772+0000 INFO [o.n.k.i.DiagnosticsManager] Free Physical memory: 5.49 GB 
2017-12-26 16:24:06.772+0000 INFO [o.n.k.i.DiagnosticsManager] Committed virtual memory: 5.62 GB 
2017-12-26 16:24:06.773+0000 INFO [o.n.k.i.DiagnosticsManager] Total swap space: 16.50 GB 
2017-12-26 16:24:06.773+0000 INFO [o.n.k.i.DiagnosticsManager] Free swap space: 16.49 GB 
2017-12-26 16:24:06.773+0000 INFO [o.n.k.i.DiagnosticsManager] JVM memory information: 
2017-12-26 16:24:06.773+0000 INFO [o.n.k.i.DiagnosticsManager] Free memory: 85.66 MB 
2017-12-26 16:24:06.773+0000 INFO [o.n.k.i.DiagnosticsManager] Total memory: 126.00 MB 
2017-12-26 16:24:06.774+0000 INFO [o.n.k.i.DiagnosticsManager] Max memory: 1.95 GB 
2017-12-26 16:24:06.776+0000 INFO [o.n.k.i.DiagnosticsManager] Garbage Collector: G1 Young Generation: [G1 Eden Space, G1 Survivor Space] 
2017-12-26 16:24:06.776+0000 INFO [o.n.k.i.DiagnosticsManager] Garbage Collector: G1 Old Generation: [G1 Eden Space, G1 Survivor Space, G1 Old Gen] 
2017-12-26 16:24:06.777+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: Code Cache (Non-heap memory): committed=4.94 MB, used=4.93 MB, max=240.00 MB, threshold=0.00 B 
2017-12-26 16:24:06.777+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: Metaspace (Non-heap memory): committed=14.38 MB, used=13.41 MB, max=-1.00 B, threshold=0.00 B 
2017-12-26 16:24:06.777+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: Compressed Class Space (Non-heap memory): committed=1.88 MB, used=1.64 MB, max=1.00 GB, threshold=0.00 B 
2017-12-26 16:24:06.778+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: G1 Eden Space (Heap memory): committed=39.00 MB, used=35.00 MB, max=-1.00 B, threshold=? 
2017-12-26 16:24:06.778+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: G1 Survivor Space (Heap memory): committed=3.00 MB, used=3.00 MB, max=-1.00 B, threshold=? 
2017-12-26 16:24:06.778+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: G1 Old Gen (Heap memory): committed=84.00 MB, used=1.34 MB, max=1.95 GB, threshold=0.00 B 
2017-12-26 16:24:06.778+0000 INFO [o.n.k.i.DiagnosticsManager] Operating system information: 
2017-12-26 16:24:06.779+0000 INFO [o.n.k.i.DiagnosticsManager] Operating System: Linux; version: 3.10.0-693.5.2.el7.x86_64; arch: amd64; cpus: 8 
2017-12-26 16:24:06.779+0000 INFO [o.n.k.i.DiagnosticsManager] Max number of file descriptors: 90000 
2017-12-26 16:24:06.780+0000 INFO [o.n.k.i.DiagnosticsManager] Number of open file descriptors: 103 
2017-12-26 16:24:06.782+0000 INFO [o.n.k.i.DiagnosticsManager] Process id: [email protected] 
2017-12-26 16:24:06.782+0000 INFO [o.n.k.i.DiagnosticsManager] Byte order: LITTLE_ENDIAN 
2017-12-26 16:24:06.793+0000 INFO [o.n.k.i.DiagnosticsManager] Local timezone: Etc/GMT 
2017-12-26 16:24:06.793+0000 INFO [o.n.k.i.DiagnosticsManager] JVM information: 
2017-12-26 16:24:06.794+0000 INFO [o.n.k.i.DiagnosticsManager] VM Name: OpenJDK 64-Bit Server VM 
2017-12-26 16:24:06.794+0000 INFO [o.n.k.i.DiagnosticsManager] VM Vendor: Oracle Corporation 
2017-12-26 16:24:06.794+0000 INFO [o.n.k.i.DiagnosticsManager] VM Version: 25.151-b12 
2017-12-26 16:24:06.794+0000 INFO [o.n.k.i.DiagnosticsManager] JIT compiler: HotSpot 64-Bit Tiered Compilers 
2017-12-26 16:24:06.795+0000 INFO [o.n.k.i.DiagnosticsManager] VM Arguments: [-XX:+UseG1GC, -XX:-OmitStackTraceInFastThrow, -XX:+AlwaysPreTouch, -XX:+UnlockExperimentalVMOptions, -XX:+TrustFinalNonStaticFields, -XX:+DisableExplicitGC, -Djdk.tls.ephemeralDHKeySize=2048, -Dunsupported.dbms.udc.source=rpm, -Dfile.encoding=UTF-8] 
2017-12-26 16:24:06.795+0000 INFO [o.n.k.i.DiagnosticsManager] Java classpath: 

NACH:

2017-12-27 16:17:30.740+0000 INFO [o.n.k.i.DiagnosticsManager] System memory information: 
2017-12-27 16:17:30.749+0000 INFO [o.n.k.i.DiagnosticsManager] Total Physical memory: 7.79 GB 
2017-12-27 16:17:30.750+0000 INFO [o.n.k.i.DiagnosticsManager] Free Physical memory: 4.23 GB 
2017-12-27 16:17:30.750+0000 INFO [o.n.k.i.DiagnosticsManager] Committed virtual memory: 5.62 GB 
2017-12-27 16:17:30.751+0000 INFO [o.n.k.i.DiagnosticsManager] Total swap space: 16.50 GB 
2017-12-27 16:17:30.751+0000 INFO [o.n.k.i.DiagnosticsManager] Free swap space: 16.19 GB 
2017-12-27 16:17:30.751+0000 INFO [o.n.k.i.DiagnosticsManager] JVM memory information: 
2017-12-27 16:17:30.751+0000 INFO [o.n.k.i.DiagnosticsManager] Free memory: 1.89 GB 
2017-12-27 16:17:30.751+0000 INFO [o.n.k.i.DiagnosticsManager] Total memory: 1.95 GB 
2017-12-27 16:17:30.752+0000 INFO [o.n.k.i.DiagnosticsManager] Max memory: 1.95 GB 
2017-12-27 16:17:30.777+0000 INFO [o.n.k.i.DiagnosticsManager] Garbage Collector: G1 Young Generation: [G1 Eden Space, G1 Survivor Space] 
2017-12-27 16:17:30.777+0000 INFO [o.n.k.i.DiagnosticsManager] Garbage Collector: G1 Old Generation: [G1 Eden Space, G1 Survivor Space, G1 Old Gen] 
2017-12-27 16:17:30.778+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: Code Cache (Non-heap memory): committed=4.94 MB, used=4.89 MB, max=240.00 MB, threshold=0.00 B 
2017-12-27 16:17:30.778+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: Metaspace (Non-heap memory): committed=14.38 MB, used=13.42 MB, max=-1.00 B, threshold=0.00 B 
2017-12-27 16:17:30.778+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: Compressed Class Space (Non-heap memory): committed=1.88 MB, used=1.64 MB, max=1.00 GB, threshold=0.00 B 
2017-12-27 16:17:30.779+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: G1 Eden Space (Heap memory): committed=105.00 MB, used=59.00 MB, max=-1.00 B, threshold=? 
2017-12-27 16:17:30.779+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: G1 Survivor Space (Heap memory): committed=0.00 B, used=0.00 B, max=-1.00 B, threshold=? 
2017-12-27 16:17:30.779+0000 INFO [o.n.k.i.DiagnosticsManager] Memory Pool: G1 Old Gen (Heap memory): committed=1.85 GB, used=0.00 B, max=1.95 GB, threshold=0.00 B 
2017-12-27 16:17:30.779+0000 INFO [o.n.k.i.DiagnosticsManager] Operating system information: 
2017-12-27 16:17:30.780+0000 INFO [o.n.k.i.DiagnosticsManager] Operating System: Linux; version: 3.10.0-693.5.2.el7.x86_64; arch: amd64; cpus: 8 
2017-12-27 16:17:30.780+0000 INFO [o.n.k.i.DiagnosticsManager] Max number of file descriptors: 90000 
2017-12-27 16:17:30.781+0000 INFO [o.n.k.i.DiagnosticsManager] Number of open file descriptors: 103 
2017-12-27 16:17:30.785+0000 INFO [o.n.k.i.DiagnosticsManager] Process id: [email protected] 
2017-12-27 16:17:30.785+0000 INFO [o.n.k.i.DiagnosticsManager] Byte order: LITTLE_ENDIAN 
2017-12-27 16:17:30.814+0000 INFO [o.n.k.i.DiagnosticsManager] Local timezone: Etc/GMT 
2017-12-27 16:17:30.815+0000 INFO [o.n.k.i.DiagnosticsManager] JVM information: 
2017-12-27 16:17:30.815+0000 INFO [o.n.k.i.DiagnosticsManager] VM Name: OpenJDK 64-Bit Server VM 
2017-12-27 16:17:30.815+0000 INFO [o.n.k.i.DiagnosticsManager] VM Vendor: Oracle Corporation 
2017-12-27 16:17:30.815+0000 INFO [o.n.k.i.DiagnosticsManager] VM Version: 25.151-b12 
2017-12-27 16:17:30.815+0000 INFO [o.n.k.i.DiagnosticsManager] JIT compiler: HotSpot 64-Bit Tiered Compilers 
2017-12-27 16:17:30.816+0000 INFO [o.n.k.i.DiagnosticsManager] VM Arguments: [-Xms2000m, -Xmx2000m, -XX:+UseG1GC, -XX:-OmitStackTraceInFastThrow, -XX:+AlwaysPreTouch, -XX:+UnlockExperimentalVMOptions, -XX:+TrustFinalNonStaticFields, -XX:+DisableExplicitGC, -Djdk.tls.ephemeralDHKeySize=2048, -Dunsupported.dbms.udc.source=rpm, -Dfile.encoding=UTF-8] 
2017-12-27 16:17:30.816+0000 INFO [o.n.k.i.DiagnosticsManager] Java classpath: 

Nur ein FYI, und ich scheine immer noch Java Heap-Fehler zu erhalten. Diese Maschinen (nicht für die Produktion nur dev) haben nur 8gb

+0

Wie viele Daten gibt jede Abfrage zurück? –

+0

bei der Verwendung von Batching müssen Sie 'WITH ... SKIP {_skip} LIMIT {_limit}' –

+0

verwenden Parameter verwenden, keine String-Verkettung –

Antwort

1

Wir empfehlen normalerweise, diese selbst einzustellen. Sie können Ihre debug.log-Datei während des Starts auf die Protokolle prüfen, die die von ihr ausgewählten Werte als Standardwerte angeben können. Sie suchen einen Ausschnitt wie folgt aus:

JVM memory information: 
Free memory: 204.79 MB 
Total memory: 256.00 MB 
Max memory: 4.00 GB 

Ich glaube, der Gesamtspeicher ist die anfängliche Heapgröße und Max-Speicher ist die maximale Speichergröße.

Wenn Sie dies selbst einstellen, empfehlen wir normalerweise, den Anfangswert und den Maximalwert auf denselben Wert zu setzen. Hier ist ein Knowledge Base-Artikel zu estimating initial memory configuration, der hilfreich sein kann.

Wenn die Standardwerte ausreichend sind, dann ist es möglicherweise besser nach anderen Bereichen zu suchen, um sie zu optimieren, oder um zu sehen, ob das Problem auf der Apache-Spark-Seite bekannt ist.

+0

Danke Ich werde das Debug-Protokoll überprüfen. Ich war auf 2000m eingestellt und rean in funken zu sehen. Wenn es immer noch nicht klappt, werde ich davon ausgehen, dass es etwas damit zu tun hat, wie der Funke mit Dingen umgeht und diesen Baum anbellt. Danke nochmal, der zu suchende Auszug ist super hilfreich! – Codejoy

+0

hat meinen Beitrag aktualisiert. Nur um eine Vorstellung davon zu geben, mit was ich arbeite. Es klagte immer noch über einen Heap-Fehler:/Ich habe keine Ahnung, wie man welche Ressourcen im wirklich verwenden oder nicht .. Die Datenbank ist nur 130 MB, denke ich. – Codejoy

+0

In der Datenbank befinden sich 55.000 Knoten. Scheint nicht viel. – Codejoy

Verwandte Themen