Skip to content

Commit

Permalink
Updated deps. DB connections and worker pool are same size now
Browse files Browse the repository at this point in the history
  • Loading branch information
hohonuuli committed Mar 25, 2024
1 parent a53d693 commit 87bdeae
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ val testcontainersVersion = "0.41.0"
Global / onChangedBuildSource := ReloadOnSourceChanges

ThisBuild / licenses := Seq("Apache-2.0" -> url("http://www.apache.org/licenses/LICENSE-2.0"))
ThisBuild / scalaVersion := "3.3.1"
ThisBuild / scalaVersion := "3.3.3"
// ThisBuild / version := "0.0.1"
ThisBuild / organization := "org.mbari"
ThisBuild / organizationName := "Monterey Bay Aquarium Research Institute"
Expand Down
10 changes: 5 additions & 5 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,30 +22,30 @@ object Dependencies {
lazy val jansi = "org.fusesource.jansi" % "jansi" % "2.4.0"
lazy val javaJwt = "com.auth0" % "java-jwt" % "4.4.0"

val logbackVersion = "1.5.0"
val logbackVersion = "1.5.3"
lazy val logbackClassic = "ch.qos.logback" % "logback-classic" % logbackVersion
lazy val logbackCore = "ch.qos.logback" % "logback-core" % logbackVersion

lazy val mssqlJdbc = "com.microsoft.sqlserver" % "mssql-jdbc" % "12.6.1.jre11"
lazy val munit = "org.scalameta" %% "munit" % "1.0.0-M11"
lazy val oracleJdbc = "com.oracle.ojdbc" % "ojdbc8" % "19.3.0.0"
lazy val postgresql = "org.postgresql" % "postgresql" % "42.7.2"
lazy val postgresql = "org.postgresql" % "postgresql" % "42.7.3"
lazy val scalatest = "org.scalatest" %% "scalatest" % "3.2.18"

val slf4jVersion = "2.0.12"
lazy val slf4jApi = "org.slf4j" % "slf4j-api" % slf4jVersion
lazy val slf4jLog4j = "org.slf4j" % "log4j-over-slf4j" % slf4jVersion
lazy val slf4jSystem = "org.slf4j" % "slf4j-jdk-platform-logging" % slf4jVersion

private val tapirVersion = "1.9.10"
lazy val tapirSttpCirce = "com.softwaremill.sttp.client3" %% "circe" % "3.9.3"
private val tapirVersion = "1.10.0"
lazy val tapirSttpCirce = "com.softwaremill.sttp.client3" %% "circe" % "3.9.5"
lazy val tapirCirce = "com.softwaremill.sttp.tapir" %% "tapir-json-circe" % tapirVersion
lazy val tapirPrometheus = "com.softwaremill.sttp.tapir" %% "tapir-prometheus-metrics" % tapirVersion
lazy val tapirServerStub = "com.softwaremill.sttp.tapir" %% "tapir-sttp-stub-server" % tapirVersion
lazy val tapirSwagger = "com.softwaremill.sttp.tapir" %% "tapir-swagger-ui-bundle" % tapirVersion
lazy val tapirVertex = "com.softwaremill.sttp.tapir" %% "tapir-vertx-server" % tapirVersion

val testcontainersVersion = "1.19.6"
val testcontainersVersion = "1.19.7"
lazy val testcontainersCore = "org.testcontainers" % "testcontainers" % testcontainersVersion
lazy val testcontainersSqlserver = "org.testcontainers" % "mssqlserver" % testcontainersVersion
lazy val testcontainersOracle = "org.testcontainers" % "oracle-xe" % testcontainersVersion
Expand Down
4 changes: 2 additions & 2 deletions vampire-squid/src/main/resources/META-INF/persistence.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
<class>org.mbari.vampiresquid.repository.jpa.entity.VideoReferenceEntity</class>
<properties>
<property name="hibernate.batch_versioned_data" value="true" />
<property name="hibernate.hikari.maximumPoolSize" value="6" />
<property name="hibernate.hikari.minimumIdle" value="2" />
<!-- <property name="hibernate.hikari.maximumPoolSize" value="6" />
<property name="hibernate.hikari.minimumIdle" value="2" /> -->
<!-- <property name="hibernate.jdbc.batch_size" value="100" />
<property name="hibernate.order_updates" value="true" /> -->
<property name="jakarta.persistence.provider" value="org.hibernate.jpa.HibernatePersistenceProvider" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ object AppConfig:

val Description: String = "Video Asset Manager"

val NumberOfVertxWorkers: Int = 20

private lazy val Config = ConfigFactory.load()

lazy val JwtParameters: JwtParams =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import sttp.tapir.server.interceptor.log.ServerLog
import org.mbari.vampiresquid.etc.jdk.Logging
import org.mbari.vampiresquid.etc.jdk.Logging.{*, given}
import sttp.tapir.server.interceptor.log.DefaultServerLog
import io.vertx.core.VertxOptions

@main
def run(): Unit =
Expand All @@ -54,7 +55,8 @@ def run(): Unit =

val port = sys.env.get("HTTP_PORT").flatMap(_.toIntOption).getOrElse(8080)

val vertx = Vertx.vertx()
val vertx = Vertx.vertx(new VertxOptions().setWorkerPoolSize(AppConfig.NumberOfVertxWorkers))
// val vertx = Vertx.vertx()
val server = vertx.createHttpServer()
val router = Router.router(vertx)

Expand Down Expand Up @@ -100,7 +102,7 @@ def run(): Unit =

router
.getRoutes()
.forEach(r => log.atDebug.log(f"Adding route: ${r.methods()}%8s ${r.getPath}%s"))
.forEach(r => log.atInfo.log(f"Adding route: ${r.methods()}%8s ${r.getPath}%s"))

// val program = for
// binding <- server.requestHandler(router).listen(port).asScala
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import com.typesafe.config.ConfigFactory
import java.lang.System.Logger.Level
import scala.jdk.CollectionConverters.*
import org.mbari.vampiresquid.etc.jdk.Logging.{given, *}
import org.mbari.vampiresquid.AppConfig

/**
* https://stackoverflow.com/questions/4106078/dynamic-jpa-connection
Expand All @@ -43,7 +44,7 @@ object EntityManagerFactories:
"hibernate.connection.provider_class" -> "org.hibernate.hikaricp.internal.HikariCPConnectionProvider",
"hibernate.hbm2ddl.auto" -> "validate",
"hibernate.hikari.idleTimeout" -> "30000",
"hibernate.hikari.maximumPoolSize" -> "16",
"hibernate.hikari.maximumPoolSize" -> s"${AppConfig.NumberOfVertxWorkers}",
"hibernate.hikari.minimumIdle" -> "2"
)

Expand Down

0 comments on commit 87bdeae

Please sign in to comment.