diff --git a/README.md b/README.md index bde82416..ce9dcf3a 100644 --- a/README.md +++ b/README.md @@ -119,7 +119,7 @@ The following is the complete list of benchmarks, separated into groups. - `neo4j-analytics` - Executes Neo4j graph queries against a movie database. \ - Default repetitions: 20; GPL3 license, GPL3 distribution; Supported JVM: 11 - 20 + Default repetitions: 20; GPL3 license, GPL3 distribution; Supported JVM: 17 and later #### functional diff --git a/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/Neo4jAnalytics.scala b/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/Neo4jAnalytics.scala index a54e9053..57dfac22 100644 --- a/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/Neo4jAnalytics.scala +++ b/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/Neo4jAnalytics.scala @@ -2,7 +2,7 @@ package org.renaissance.neo4j import org.neo4j.configuration.GraphDatabaseSettings import org.neo4j.dbms.api.{DatabaseManagementService, DatabaseManagementServiceBuilder} -import org.neo4j.logging.Level +import org.neo4j.io.ByteUnit import org.renaissance.Benchmark._ import org.renaissance.BenchmarkResult.Validators import org.renaissance.neo4j.analytics.AnalyticsBenchmark @@ -19,8 +19,7 @@ import scala.io.{Codec, Source} @Group("neo4j") @Summary("Executes Neo4j graph queries against a movie database.") @Licenses(Array(License.GPL3)) -@RequiresJvm("11") -@SupportsJvm("20") +@RequiresJvm("17") @Repetitions(20) @Parameter(name = "long_query_threads", defaultValue = "2") @Parameter(name = "long_query_repeats", defaultValue = "1") @@ -122,8 +121,7 @@ final class Neo4jAnalytics extends Benchmark { dbms.set( new DatabaseManagementServiceBuilder(graphDbDir) - .setConfig(GraphDatabaseSettings.pagecache_memory, "500M") - .setConfig(GraphDatabaseSettings.store_internal_log_level, Level.WARN) + .setConfig(GraphDatabaseSettings.pagecache_memory, Long.box(ByteUnit.mebiBytes(512))) .build() ) diff --git a/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/analytics/AnalyticsBenchmark.scala b/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/analytics/AnalyticsBenchmark.scala index 57987a88..42d66de9 100644 --- a/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/analytics/AnalyticsBenchmark.scala +++ b/benchmarks/neo4j/src/main/scala/org/renaissance/neo4j/analytics/AnalyticsBenchmark.scala @@ -4,7 +4,7 @@ import org.neo4j.graphdb.{GraphDatabaseService, Label, RelationshipType, Result} import org.renaissance.neo4j.analytics.AnalyticsBenchmark._ import java.util.concurrent.TimeUnit -import scala.collection.JavaConverters._ +import scala.jdk.CollectionConverters._ import scala.collection.{Seq, _} /* @@ -12,7 +12,7 @@ import scala.collection.{Seq, _} */ object AnalyticsBenchmark { - type VertexId = Int + private type VertexId = Int trait Vertex { def id: VertexId @@ -63,8 +63,8 @@ class AnalyticsBenchmark( private def populateVertices( db: GraphDatabaseService, vertices: Iterable[Vertex] - ): Map[VertexId, Long] = { - val mapping = mutable.Map[VertexId, Long]() + ): Map[VertexId, String] = { + val mapping = mutable.Map[VertexId, String]() val tx = db.beginTx() @@ -88,7 +88,7 @@ class AnalyticsBenchmark( sys.error(s"Unknown $vertex.") } - mapping(vertex.id) = node.getId + mapping(vertex.id) = node.getElementId } catch { case e: Exception => throw new RuntimeException(s"Error in: $vertex", e) @@ -105,7 +105,7 @@ class AnalyticsBenchmark( private def populateEdges( db: GraphDatabaseService, edges: Iterable[Edge], - vertexNodeIds: Map[VertexId, Long] + vertexNodeIds: Map[VertexId, String] ): Long = { var edgeCount = 0 val tx = db.beginTx() @@ -113,13 +113,13 @@ class AnalyticsBenchmark( try { for (edge <- edges) try { val sourceNodeId = vertexNodeIds(edge.source) - val sourceNode = tx.getNodeById(sourceNodeId) + val sourceNode = tx.getNodeByElementId(sourceNodeId) if (sourceNode == null) { sys.error("Null source node for: " + sourceNodeId) } val destinationNodeId = vertexNodeIds(edge.destination) - val destinationNode = tx.getNodeById(destinationNodeId) + val destinationNode = tx.getNodeByElementId(destinationNodeId) if (destinationNode == null) { sys.error("Null destination node for: " + destinationNodeId) } @@ -275,7 +275,7 @@ class AnalyticsBenchmark( // Find how many directors directed at least 3 movies. ( """match (d: Director) - |with d, size((d)-[: FILMS]->()) as c + |with d, count { (d)-[: FILMS]->() } as c |where c > $c |return count(d)""".stripMargin, Map("c" -> Long.box(3)), @@ -296,7 +296,7 @@ class AnalyticsBenchmark( // Find the genre with the most movies. ( """match (g: Genre) - |with g, size(()-[: GENRE]->(g)) as filmCount + |with g, count { ()-[: GENRE]->(g) } as filmCount |order by filmCount desc |limit 1 |return g.name, filmCount""".stripMargin, diff --git a/build.sbt b/build.sbt index d35a2925..37466b00 100644 --- a/build.sbt +++ b/build.sbt @@ -328,12 +328,13 @@ lazy val jdkStreamsBenchmarks = (project in file("benchmarks/jdk-streams")) lazy val neo4jBenchmarks = (project in file("benchmarks/neo4j")) .settings( name := "neo4j", - commonSettingsScala212, + commonSettingsScala213, libraryDependencies ++= Seq( - // neo4j 4.4 does not support Scala 2.13 yet. - // neo4j 5.0 supports Scala 2.13 and requires JDK17 - "org.neo4j" % "neo4j" % "4.4.26", - "com.typesafe.play" %% "play-json" % "2.10.1" + // neo4j 4.4 supports Scala 2.12 and requires JDK11. + // neo4j 5.x supports Scala 2.13 and requires JDK17. + "org.neo4j" % "neo4j" % "5.12.0", + // play-json 2.10.x requires SBT running on JDK11 to compile. + "com.typesafe.play" %% "play-json" % "2.9.4" ), dependencyOverrides ++= Seq( // Force newer JNA to support more platforms/architectures.