From 65983dcf9fce47172c75e36570744d49ea0cc3f6 Mon Sep 17 00:00:00 2001 From: Scala Steward <scala_steward@virtuslab.com> Date: Mon, 31 Mar 2025 11:00:56 +0000 Subject: [PATCH 1/9] Update guava to 33.4.6-jre --- project/Commons.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Commons.scala b/project/Commons.scala index 98f080fde..fa3d614ce 100644 --- a/project/Commons.scala +++ b/project/Commons.scala @@ -24,7 +24,7 @@ object Commons extends ProjectGroup("commons") { // option in IntelliJ's SBT settings. val forIdeaImport: Boolean = System.getProperty("idea.managed", "false").toBoolean && System.getProperty("idea.runid") == null - val guavaVersion = "33.4.0-jre" + val guavaVersion = "33.4.6-jre" val jsr305Version = "3.0.2" val scalatestVersion = "3.2.19" val scalatestplusScalacheckVersion = "3.2.14.0" From 8e2325025a84ad38e4eafea875ba5ed23fd41e48 Mon Sep 17 00:00:00 2001 From: Dawid Dworak <dawid.dworak@gmail.com> Date: Wed, 2 Apr 2025 18:02:34 +0200 Subject: [PATCH 2/9] Create .scala-steward.conf Group Jetty Scala Steward PRs --- .scala-steward.conf | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .scala-steward.conf diff --git a/.scala-steward.conf b/.scala-steward.conf new file mode 100644 index 000000000..699e54a74 --- /dev/null +++ b/.scala-steward.conf @@ -0,0 +1,7 @@ +pullRequests.grouping = [ + { + name = "jetty", + title = "Update Jetty dependencies", + filter = [{ group = "org.eclipse.jetty" }, { group = "org.eclipse.jetty*" }] + } +] From c8ff9d27eedc8a4e71e30170a61351cf61ec0e9e Mon Sep 17 00:00:00 2001 From: Scala Steward <scala_steward@virtuslab.com> Date: Fri, 7 Mar 2025 15:11:49 +0000 Subject: [PATCH 3/9] Update sbt-github-actions to 0.25.0 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index a9f3f50f1..b499a1206 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -9,4 +9,4 @@ addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.2") addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4") -addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.24.0") +addSbtPlugin("com.github.sbt" % "sbt-github-actions" % "0.25.0") From 391aafb42ce1f42a2ceb58e94a0798464a7494e4 Mon Sep 17 00:00:00 2001 From: Scala Steward <scala_steward@virtuslab.com> Date: Thu, 13 Mar 2025 14:51:11 +0000 Subject: [PATCH 4/9] Update sbt-ci-release to 1.9.3 --- project/plugins.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/plugins.sbt b/project/plugins.sbt index b499a1206..1c8b83779 100644 --- a/project/plugins.sbt +++ b/project/plugins.sbt @@ -5,7 +5,7 @@ addSbtPlugin("org.scala-js" % "sbt-scalajs" % "1.18.2") addSbtPlugin("org.scala-js" % "sbt-jsdependencies" % "1.0.2") addSbtPlugin("org.jetbrains.scala" % "sbt-ide-settings" % "1.1.2") addSbtPlugin("pl.project13.scala" % "sbt-jmh" % "0.4.7") -addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.2") +addSbtPlugin("com.github.sbt" % "sbt-ci-release" % "1.9.3") addSbtPlugin("com.github.sbt" % "sbt-unidoc" % "0.5.0") addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "1.1.4") addSbtPlugin("com.timushev.sbt" % "sbt-updates" % "0.6.4") From 2994a0c7693e0f89f57112679a2207070086e29d Mon Sep 17 00:00:00 2001 From: Scala Steward <scala_steward@virtuslab.com> Date: Mon, 17 Mar 2025 14:31:47 +0000 Subject: [PATCH 5/9] Update sbt, scripted-plugin to 1.10.11 --- project/build.properties | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/build.properties b/project/build.properties index 1dd00a2ca..d9109d9ee 100644 --- a/project/build.properties +++ b/project/build.properties @@ -1,2 +1,2 @@ # suppress inspection "UnusedProperty" -sbt.version=1.10.7 +sbt.version=1.10.11 From 9392cb30c6521f6d58c6018439a31dc3e49dd9a1 Mon Sep 17 00:00:00 2001 From: Scala Steward <scala_steward@virtuslab.com> Date: Wed, 19 Mar 2025 15:18:59 +0000 Subject: [PATCH 6/9] Update jetty-client to 12.0.18 --- project/Commons.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Commons.scala b/project/Commons.scala index fa3d614ce..63357ca1b 100644 --- a/project/Commons.scala +++ b/project/Commons.scala @@ -29,7 +29,7 @@ object Commons extends ProjectGroup("commons") { val scalatestVersion = "3.2.19" val scalatestplusScalacheckVersion = "3.2.14.0" val scalacheckVersion = "1.18.1" - val jettyVersion = "12.0.16" + val jettyVersion = "12.0.18" val mongoVersion = "5.3.1" val springVersion = "5.3.39" val typesafeConfigVersion = "1.4.3" From 88860d670de3a426d5dd8e090f0c01770fecf68c Mon Sep 17 00:00:00 2001 From: Scala Steward <43047562+scala-steward@users.noreply.github.com> Date: Wed, 2 Apr 2025 18:08:32 +0200 Subject: [PATCH 7/9] Update mongodb-driver-core, ... to 5.4.0 (#688) Co-authored-by: Dawid Dworak <dawid.dworak@gmail.com> --- project/Commons.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Commons.scala b/project/Commons.scala index 63357ca1b..ccb119808 100644 --- a/project/Commons.scala +++ b/project/Commons.scala @@ -30,7 +30,7 @@ object Commons extends ProjectGroup("commons") { val scalatestplusScalacheckVersion = "3.2.14.0" val scalacheckVersion = "1.18.1" val jettyVersion = "12.0.18" - val mongoVersion = "5.3.1" + val mongoVersion = "5.4.0" val springVersion = "5.3.39" val typesafeConfigVersion = "1.4.3" val commonsIoVersion = "1.3.2" // test only From c94b43b7b6fa696e874f587d3b90bb9ad6a1fdea Mon Sep 17 00:00:00 2001 From: Dawid Dworak <dawid.dworak@gmail.com> Date: Thu, 3 Apr 2025 10:11:19 +0200 Subject: [PATCH 8/9] Remove legacy Redis benchmarks --- .../commons/redis/EncodingBenchmark.scala | 40 --- .../com/avsystem/commons/redis/Profiled.scala | 18 -- .../commons/redis/RedisClientBenchmark.scala | 294 ------------------ 3 files changed, 352 deletions(-) delete mode 100644 benchmark/jvm/src/main/scala/com/avsystem/commons/redis/EncodingBenchmark.scala delete mode 100644 benchmark/jvm/src/main/scala/com/avsystem/commons/redis/Profiled.scala delete mode 100644 benchmark/jvm/src/main/scala/com/avsystem/commons/redis/RedisClientBenchmark.scala diff --git a/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/EncodingBenchmark.scala b/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/EncodingBenchmark.scala deleted file mode 100644 index c8679d04f..000000000 --- a/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/EncodingBenchmark.scala +++ /dev/null @@ -1,40 +0,0 @@ -package com.avsystem.commons -package redis - -import org.apache.pekko.util.{ByteString, ByteStringBuilder} -import com.avsystem.commons.redis.protocol.{ArrayMsg, BulkStringMsg, IntegerMsg, NullBulkStringMsg, RedisMsg, SimpleStringMsg} -import org.openjdk.jmh.annotations._ - -@Warmup(iterations = 5) -@Measurement(iterations = 20) -@Fork(1) -@Threads(1) -@BenchmarkMode(Array(Mode.Throughput)) -@State(Scope.Benchmark) -class EncodingBenchmark { - private val bsb = new ByteStringBuilder - - final val msg = ArrayMsg(IndexedSeq( - IntegerMsg(12345342323L), - IntegerMsg(1231), -// BulkStringMsg(ByteString("jkalsjdkflajsdkfhlkasd")), -// SimpleStringMsg(ByteString("sjakdlfjaksdhfjakshd")), - NullBulkStringMsg - )) - - @Benchmark - def encodeBenchmark() = { - RedisMsg.encode(msg, bsb) - bsb.clear() - bsb - } -} - -object EncodingBenchmark { - def main(args: Array[String]): Unit = { - val b = new EncodingBenchmark - while (true) { - b.encodeBenchmark() - } - } -} \ No newline at end of file diff --git a/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/Profiled.scala b/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/Profiled.scala deleted file mode 100644 index 6b1bcfad2..000000000 --- a/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/Profiled.scala +++ /dev/null @@ -1,18 +0,0 @@ -package com.avsystem.commons -package redis - -import scala.concurrent.duration.Duration - -/** - * Author: ghik - * Created: 08/09/16. - */ -object Profiled { - val bench = new RedisClientBenchmark - - def main(args: Array[String]): Unit = { - while (true) { - bench.clusterClientOperationBenchmark() - } - } -} diff --git a/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/RedisClientBenchmark.scala b/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/RedisClientBenchmark.scala deleted file mode 100644 index bb8e8ba50..000000000 --- a/benchmark/jvm/src/main/scala/com/avsystem/commons/redis/RedisClientBenchmark.scala +++ /dev/null @@ -1,294 +0,0 @@ -package com.avsystem.commons -package redis - -import java.io.FileInputStream -import java.security.{KeyStore, SecureRandom} -import java.util.concurrent.atomic.AtomicInteger -import java.util.concurrent.{ConcurrentHashMap, CountDownLatch, TimeUnit} - -import org.apache.pekko.actor.ActorSystem -import org.apache.pekko.util.{ByteString, Timeout} -import com.avsystem.commons.concurrent.RunNowEC -import com.avsystem.commons.redis.RedisClientBenchmark._ -import com.avsystem.commons.redis.actor.RedisConnectionActor.DebugListener -import com.avsystem.commons.redis.commands.SlotRange -import com.avsystem.commons.redis.config._ -import com.typesafe.config._ -import javax.net.ssl.{KeyManagerFactory, SSLContext, TrustManagerFactory} -import org.openjdk.jmh.annotations._ - -import scala.concurrent.Await -import scala.concurrent.duration.Duration -import scala.io.Source - -object OutgoingTraffictStats extends DebugListener { - val writeCount = new AtomicInteger - val byteCount = new AtomicInteger - - def reset(): Unit = { - writeCount.set(0) - byteCount.set(0) - } - - def onSend(data: ByteString): Unit = { - writeCount.incrementAndGet() - byteCount.addAndGet(data.size) - } - - def onReceive(data: ByteString): Unit = () -} - -@Warmup(iterations = 20) -@Measurement(iterations = 40) -@Fork(1) -@Threads(4) -@BenchmarkMode(Array(Mode.Throughput)) -@State(Scope.Benchmark) -abstract class RedisBenchmark(useTls: Boolean) { - - import RedisApi.Batches.StringTyped._ - - val Config: String = - """ - | - """.stripMargin - - implicit val system: ActorSystem = ActorSystem("redis", - ConfigFactory.parseString(Config).withFallback(ConfigFactory.defaultReference()).resolve) - - lazy val sslContext: SSLContext = SSLContext.getInstance("TLSv1.2").setup { sslc => - val ks = KeyStore.getInstance("PKCS12") - ks.load(new FileInputStream("../commons-redis/tls/redis.p12"), Array.empty) - - val kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm) - kmf.init(ks, Array.empty) - - val tmf = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm) - tmf.init(ks) - - sslc.init(kmf.getKeyManagers, tmf.getTrustManagers, new SecureRandom) - } - - val connectionConfig: ConnectionConfig = ConnectionConfig( - sslEngineCreator = if(useTls) OptArg(() => sslContext.createSSLEngine()) else OptArg.Empty, - initCommands = clientSetname("benchmark") - ) - - val monConnectionConfig: ConnectionConfig = ConnectionConfig( - sslEngineCreator = if(useTls) OptArg(() => sslContext.createSSLEngine()) else OptArg.Empty, - initCommands = clientSetname("benchmarkMon") - ) - - val address: NodeAddress = - if(useTls) NodeAddress(port = 7379) else NodeAddress.Default - - val nodeConfig: NodeConfig = NodeConfig( - poolSize = 4, - connectionConfigs = _ => connectionConfig - ) - - val clusterConfig: ClusterConfig = ClusterConfig( - nodeConfigs = _ => nodeConfig, - monitoringConnectionConfigs = _ => monConnectionConfig - ) - - lazy val clusterClient: RedisClusterClient = - Await.result(new RedisClusterClient(List(NodeAddress(port = 33333)), clusterConfig).initialized, Duration.Inf) - - lazy val nodeClient: RedisNodeClient = - Await.result(new RedisNodeClient(address, nodeConfig).initialized, Duration.Inf) - - lazy val connectionClient: RedisConnectionClient = - Await.result(new RedisConnectionClient(address, connectionConfig).initialized, Duration.Inf) - - @TearDown - def teardownClient(): Unit = { - Await.result(system.terminate(), Duration.Inf) - } -} - -object RedisClientBenchmark { - - import RedisApi.Batches.StringTyped._ - - val SlotKeys: Array[String] = - Source.fromInputStream(getClass.getResourceAsStream("/slotkeys.txt")) - .getLines().toArray - - final val BatchSize = 50 - final val ConcurrentCommands = 20000 - final val ConcurrentBatches = ConcurrentCommands / BatchSize - final val ConcurrentOps = 2000 - - val KeyBase = "key" - val Value = "value" - - val Commands: Array[RedisBatch[Boolean]] = Iterator.range(0, ConcurrentCommands).map(i => set(s"$KeyBase$i", Value)).toArray - - val OpSeqTL: ThreadLocal[Int] = new ThreadLocal[Int] { - private val seq = new AtomicInteger(0) - override def initialValue(): Int = seq.getAndIncrement() - } -} - -@OperationsPerInvocation(ConcurrentCommands) -abstract class AbstractRedisClientBenchmark(useTls: Boolean) - extends RedisBenchmark(useTls) { - - import RedisApi.Batches.StringTyped._ - - implicit val timeout: Timeout = Timeout(5, TimeUnit.SECONDS) - - def seq: Int = RedisClientBenchmark.OpSeqTL.get - - def commandFuture(client: RedisKeyedExecutor, i: Int): Future[Boolean] = - client.executeBatch(set(s"$KeyBase$i", Value)) - - def batchFuture(client: RedisKeyedExecutor, i: Int): Future[IIndexedSeq[Boolean]] = { - val batch = (0 until BatchSize).map(j => set(s"{$KeyBase$i}$j", "v")).sequence - client.executeBatch(batch) - } - - def roundRobinBatchFuture(client: RedisClusterClient, i: Int): Future[IIndexedSeq[Boolean]] = { - val mapping = client.currentState.mapping - val (SlotRange(slot, _), nodeClient) = mapping(i % mapping.size) - val batch = (0 until BatchSize).map(j => set(s"$KeyBase{${SlotKeys(slot)}}$i$j", "v")).sequence - nodeClient.executeBatch(batch) - } - - def distributedBatchFuture(client: RedisKeyedExecutor, i: Int): Future[IIndexedSeq[Boolean]] = { - val batch = (0 to BatchSize).map(j => set(s"$KeyBase$i.$j", "v")).sequence - client.executeBatch(batch) - } - - def transactionFuture(client: RedisExecutor, i: Int): Future[IIndexedSeq[Boolean]] = { - val batch = (0 until BatchSize).map(j => set(s"{$KeyBase$i}$j", "v")).sequence - client.executeBatch(batch.transaction) - } - - def clusterOperationFuture(client: RedisClusterClient, seq: Int, i: Int): Future[Unit] = { - val key = s"$KeyBase$seq.$i" - val operation = for { - value <- watch(key) *> get(key) - _ <- set(key, value.getOrElse("v")).transaction - } yield () - client.currentState.clientForSlot(keySlot(key)).executeOp(operation) - } - - def operationFuture(client: RedisOpExecutor, seq: Int, i: Int): Future[Unit] = { - val key = s"$KeyBase$seq.$i" - val operation = for { - value <- watch(key) *> get(key) - _ <- set(key, value.getOrElse("v")).transaction - } yield () - client.executeOp(operation, ExecutionConfig(responseTimeout = Timeout(2, TimeUnit.SECONDS))) - } - - def mixedFuture(client: RedisKeyedExecutor with RedisOpExecutor, seq: Int, i: Int): Future[Any] = - i % 3 match { - case 0 => batchFuture(client, i) - case 1 => transactionFuture(client, i) - case 2 => operationFuture(client, seq, i) - } - - def clusterMixedFuture(client: RedisClusterClient, seq: Int, i: Int): Future[Any] = - i % 3 match { - case 0 => distributedBatchFuture(client, i) - case 1 => transactionFuture(client, i) - case 2 => clusterOperationFuture(client, seq, i) - } - - protected def redisClientBenchmark(futureCount: Int, singleFut: Int => Future[Any]): Unit = { - val start = System.nanoTime() - val ctl = new CountDownLatch(futureCount) - val failures = new ConcurrentHashMap[String, AtomicInteger] - (0 until futureCount).foreach { i => - singleFut(i).onComplete { - case Success(_) => - ctl.countDown() - case Failure(t) => - val cause = s"${t.getClass.getName}: ${t.getMessage}" - failures.computeIfAbsent(cause)(_ => new AtomicInteger).incrementAndGet() - ctl.countDown() - }(RunNowEC) - } - ctl.await(60, TimeUnit.SECONDS) - if (!failures.isEmpty) { - val millis = (System.nanoTime() - start) / 1000000 - val failuresRepr = failures.asScala.opt.filter(_.nonEmpty) - .map(_.iterator.map({ case (cause, count) => s"${count.get} x $cause" }).mkString(", failures:\n", "\n", "")).getOrElse("") - println(s"Took $millis$failuresRepr") - } - } - - @Benchmark - def clusterClientCommandBenchmark(): Unit = - redisClientBenchmark(ConcurrentCommands, commandFuture(clusterClient, _)) - - @Benchmark - def clusterClientBatchBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, batchFuture(clusterClient, _)) - - @Benchmark - def clusterClientRoundRobinBatchBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, roundRobinBatchFuture(clusterClient, _)) - - @Benchmark - def clusterClientDistributedBatchBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, distributedBatchFuture(clusterClient, _)) - - @Benchmark - def clusterClientTransactionBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, transactionFuture(clusterClient, _)) - - @Benchmark - @OperationsPerInvocation(ConcurrentOps) - def clusterClientOperationBenchmark(): Unit = - redisClientBenchmark(ConcurrentOps, clusterOperationFuture(clusterClient, seq, _)) - - def clusterClientMixedBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, clusterMixedFuture(clusterClient, seq, _)) - - @Benchmark - def nodeClientCommandBenchmark(): Unit = - redisClientBenchmark(ConcurrentCommands, commandFuture(nodeClient, _)) - - @Benchmark - def nodeClientBatchBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, batchFuture(nodeClient, _)) - - @Benchmark - def nodeClientTransactionBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, transactionFuture(nodeClient, _)) - - def nodeClientMixedBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, mixedFuture(nodeClient, seq, _)) - - @Benchmark - @OperationsPerInvocation(ConcurrentOps) - def nodeClientOperationBenchmark(): Unit = - redisClientBenchmark(ConcurrentOps, operationFuture(nodeClient, seq, _)) - - @Benchmark - def connectionClientCommandBenchmark(): Unit = - redisClientBenchmark(ConcurrentCommands, commandFuture(connectionClient, _)) - - @Benchmark - def connectionClientBatchBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, batchFuture(connectionClient, _)) - - @Benchmark - def connectionClientTransactionBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, transactionFuture(connectionClient, _)) - - @Benchmark - @OperationsPerInvocation(ConcurrentOps) - def connectionClientOperationBenchmark(): Unit = - redisClientBenchmark(ConcurrentOps, operationFuture(connectionClient, seq, _)) - - def connectionClientMixedBenchmark(): Unit = - redisClientBenchmark(ConcurrentBatches, mixedFuture(connectionClient, seq, _)) -} - -class RedisClientBenchmark extends AbstractRedisClientBenchmark(useTls = false) -class RedisTlsClientBenchmark extends AbstractRedisClientBenchmark(useTls = true) \ No newline at end of file From 7d6bbc92db56056997bd0282f6512242171d2fcb Mon Sep 17 00:00:00 2001 From: Dawid Dworak <dawid.dworak@gmail.com> Date: Thu, 3 Apr 2025 13:07:44 +0200 Subject: [PATCH 9/9] Move optional jsr305 to commons-mongo --- project/Commons.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Commons.scala b/project/Commons.scala index ccb119808..da451ab2e 100644 --- a/project/Commons.scala +++ b/project/Commons.scala @@ -266,7 +266,6 @@ object Commons extends ProjectGroup("commons") { jvmCommonSettings, sourceDirsSettings(_ / "jvm"), libraryDependencies ++= Seq( - "com.google.code.findbugs" % "jsr305" % jsr305Version % Optional, "com.google.guava" % "guava" % guavaVersion % Optional, "io.monix" %% "monix" % monixVersion % Optional, ), @@ -292,6 +291,7 @@ object Commons extends ProjectGroup("commons") { sourceDirsSettings(_ / "jvm"), libraryDependencies ++= Seq( "com.google.guava" % "guava" % guavaVersion, + "com.google.code.findbugs" % "jsr305" % jsr305Version % Optional, "io.monix" %% "monix" % monixVersion, "org.mongodb" % "mongodb-driver-core" % mongoVersion, "org.mongodb" % "mongodb-driver-sync" % mongoVersion % Optional,