瀏覽代碼

Remove unmaintained fintrospect framework (#9106)

Fintrospect is currently failing and hasn't been updated in 4 years:
https://github.com/daviddenton/fintrospect
Petrik de Heus 1 年之前
父節點
當前提交
31a977d345

+ 0 - 3
frameworks/Scala/fintrospect/.gitignore

@@ -1,3 +0,0 @@
-sbt
-target/
-

+ 0 - 22
frameworks/Scala/fintrospect/README.md

@@ -1,22 +0,0 @@
-#fintrospect Benchmarking Test
-
-## Infrastructure Software Versions
-The tests were run with:
-
-* [Java Oracle 1.8.0_25](http://www.oracle.com/technetwork/java/javase)
-* [fintrospect 14.15.0](https://github.com/daviddenton/fintrospect)
-
-## Test URLs
-
-- JSON Encoding: http://localhost:9000/json
-- Plaintext: http://localhost:9000/plaintext
-- Fortunes: http://localhost:9000/fortunes
-- Single Query: http://localhost:9000/db
-- Multi Query: http://localhost:9000/queries?queries=1
-- Update Query: http://localhost:9000/updates?queries=1
-
-## How to run
-sbt 'oneJar'
-
-`java -jar target/scala-2.12/*fintrospect*one-jar.jar`
-

+ 0 - 29
frameworks/Scala/fintrospect/benchmark_config.json

@@ -1,29 +0,0 @@
-{
-  "framework": "fintrospect",
-  "tests": [
-    {
-      "default": {
-        "orm": "Raw",
-        "database_os": "Linux",
-        "db_url": "/db",
-        "fortune_url": "/fortunes",
-        "json_url": "/json",
-        "query_url": "/queries?queries=",
-        "plaintext_url": "/plaintext",
-        "update_url": "/updates?queries=",
-        "port": 9000,
-        "approach": "Realistic",
-        "classification": "Micro",
-        "database": "MySQL",
-        "framework": "fintrospect",
-        "language": "Scala",
-        "platform": "Netty",
-        "webserver": "None",
-        "os": "Linux",
-        "display_name": "fintrospect",
-        "notes": "",
-        "versus": "finagle"
-      }
-    }
-  ]
-}

+ 0 - 25
frameworks/Scala/fintrospect/build.sbt

@@ -1,25 +0,0 @@
-name := """techempower-benchmarks-fintrospect"""
-
-version := "1.0"
-
-scalaVersion := "2.13.3"
-
-scalacOptions += "-deprecation"
-
-scalacOptions += "-feature"
-
-resolvers += "JCenter" at "https://jcenter.bintray.com"
-
-resolvers += Resolver.sonatypeRepo("snapshots")
-
-libraryDependencies ++= Seq(
-  "io.fintrospect" %% "fintrospect-core" % "17.0.0",
-  "io.fintrospect" %% "fintrospect-jackson" % "17.0.0",
-  "io.fintrospect" %% "fintrospect-mustache" % "17.0.0",
-  "com.twitter" %% "finagle-mysql" % "20.8.0"
-)
-
-assemblyMergeStrategy in assembly := {
- case PathList("META-INF", xs @ _*) => MergeStrategy.discard
- case x => MergeStrategy.first
-}

+ 0 - 19
frameworks/Scala/fintrospect/config.toml

@@ -1,19 +0,0 @@
-[framework]
-name = "fintrospect"
-
-[main]
-urls.plaintext = "/plaintext"
-urls.json = "/json"
-urls.db = "/db"
-urls.query = "/queries?queries="
-urls.update = "/updates?queries="
-urls.fortune = "/fortunes"
-approach = "Realistic"
-classification = "Micro"
-database = "MySQL"
-database_os = "Linux"
-os = "Linux"
-orm = "Raw"
-platform = "Netty"
-webserver = "None"
-versus = "finagle"

+ 0 - 10
frameworks/Scala/fintrospect/fintrospect.dockerfile

@@ -1,10 +0,0 @@
-FROM hseeberger/scala-sbt:8u222_1.3.5_2.13.1
-WORKDIR /fintrospect
-COPY project project
-COPY src src
-COPY build.sbt build.sbt
-RUN sbt assembly -batch
-
-EXPOSE 9000
-
-CMD ["java", "-Dcom.twitter.finagle.toggle.flag.overrides=com.twitter.http.UseNetty4=1.0", "-server", "-XX:+UseNUMA", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+AlwaysPreTouch", "-jar", "target/scala-2.13/techempower-benchmarks-fintrospect-assembly-1.0.jar"]

+ 0 - 1
frameworks/Scala/fintrospect/project/build.properties

@@ -1 +0,0 @@
-sbt.version=1.3.13

+ 0 - 1
frameworks/Scala/fintrospect/project/plugins.sbt

@@ -1 +0,0 @@
-addSbtPlugin("com.eed3si9n" % "sbt-assembly" % "0.14.6")

+ 0 - 1
frameworks/Scala/fintrospect/src/main/resources/FortunesList.mustache

@@ -1 +0,0 @@
-<!DOCTYPE html><html><head><title>Fortunes</title></head><body><table><tr><th>id</th><th>message</th></tr>{{#items}}<tr><td>{{id}}</td><td>{{message}}</td></tr>{{/items}}</table></body></html>

+ 0 - 22
frameworks/Scala/fintrospect/src/main/scala/Database.scala

@@ -1,22 +0,0 @@
-import com.twitter.finagle.Mysql
-import com.twitter.finagle.client.DefaultPool.Param
-import com.twitter.finagle.mysql.Client
-import com.twitter.finagle.stats.NullStatsReceiver
-import com.twitter.finagle.tracing.NullTracer
-import com.twitter.util.Duration.fromSeconds
-import com.twitter.util.NullMonitor
-import io.fintrospect.configuration.Host
-
-object Database {
-  def apply(): Client = {
-    Mysql.client
-      .withCredentials("benchmarkdbuser", "benchmarkdbpass")
-      .withDatabase("hello_world")
-      .configured(Param(low = 256, high = 256, idleTime = fromSeconds(5 * 60), bufferSize = 0, maxWaiters = Int.MaxValue))
-      .withStatsReceiver(NullStatsReceiver)
-      .withMonitor(NullMonitor)
-      .withTracer(NullTracer)
-      .withMaxConcurrentPrepareStatements(256)
-      .newRichClient("tfb-database:3306")
-  }
-}

+ 0 - 77
frameworks/Scala/fintrospect/src/main/scala/DatabaseRoutes.scala

@@ -1,77 +0,0 @@
-import com.fasterxml.jackson.databind.JsonNode
-import com.twitter.finagle.Service
-import com.twitter.finagle.http.Method.Get
-import com.twitter.finagle.http.{Request, Response}
-import com.twitter.finagle.mysql.Parameter.wrap
-import com.twitter.finagle.mysql.{Client, IntValue, Result, ResultSet}
-import com.twitter.util.Future.collect
-import io.fintrospect.formats.Jackson.JsonFormat.{array, number, obj}
-import io.fintrospect.formats.Jackson.ResponseBuilder._
-import io.fintrospect.parameters.{ParameterSpec, Query, StringValidations}
-import io.fintrospect.{RouteSpec, ServerRoutes}
-
-import scala.language.reflectiveCalls
-import scala.util.{Random, Try}
-
-object DatabaseRoutes {
-
-  private val toJson: PartialFunction[Result, Option[JsonNode]] = {
-    case rs: ResultSet => rs.rows.headOption
-      .map(row => {
-        val IntValue(id) = row("id").get
-        val IntValue(random) = row("randomNumber").get
-        obj("id" -> number(id), "randomNumber" -> number(random))
-      })
-    case _ => None
-  }
-
-  private def generateRandomNumber = Random.nextInt(9999) + 1
-
-  def apply(database: Client) = {
-    val getStatement = database.prepare("SELECT id, randomNumber FROM world WHERE id = ?")
-    val updateStatement = database.prepare("UPDATE world SET randomNumber = ? WHERE id = ?")
-
-    val queryRoute = RouteSpec().at(Get) / "db" bindTo Service.mk {
-      _: Request => getStatement(generateRandomNumber)
-        .map(toJson)
-        .map(_.map(Ok(_)).getOrElse(NotFound("")).build())
-    }
-
-    val numberOfQueries = Query.optional(ParameterSpec.string(StringValidations.EmptyIsValid).map {
-      i => Try(i.toInt).getOrElse(1).max(1).min(500)
-    }, "queries")
-
-    val multipleRoute = RouteSpec()
-      .taking(numberOfQueries)
-      .at(Get) / "queries" bindTo Service.mk {
-      r: Request => {
-        collect(1.to((numberOfQueries <-- r).getOrElse(1))
-          .map(i => getStatement(generateRandomNumber).map(toJson)))
-          .map(f => f.flatMap(_.toSeq))
-          .flatMap(c => Ok(array(c)))
-      }
-    }
-
-    val updateRoute = RouteSpec()
-      .taking(numberOfQueries)
-      .at(Get) / "updates" bindTo Service.mk {
-      r: Request => {
-        collect(1.to((numberOfQueries <-- r).getOrElse(1))
-          .map(i => {
-            val id = generateRandomNumber
-            updateStatement(generateRandomNumber, id)
-              .flatMap(_ => getStatement(id))
-              .map(toJson)
-          }))
-          .map(f => f.flatMap(_.toSeq))
-          .flatMap(c => Ok(array(c)))
-      }
-    }
-
-    new ServerRoutes[Request, Response] {
-      add(queryRoute)
-      add(multipleRoute)
-      add(updateRoute)
-    }
-  }
-}

+ 0 - 36
frameworks/Scala/fintrospect/src/main/scala/FintrospectBenchmarkServer.scala

@@ -1,36 +0,0 @@
-import java.util.TimeZone.getTimeZone
-
-import com.twitter.finagle.http.path.Root
-import com.twitter.finagle.http.{Request, Response}
-import com.twitter.finagle.{Filter, Http}
-import com.twitter.util.Await
-import io.fintrospect.RouteModule
-import io.fintrospect.filters.ResponseFilters
-import org.apache.commons.lang3.time.FastDateFormat.getInstance
-
-object FintrospectBenchmarkServer extends App {
-
-  val dateFormat = getInstance("EEE, d MMM yyyy HH:mm:ss 'GMT'", getTimeZone("GMT"))
-
-  val addServerAndDate = Filter.mk[Request, Response, Request, Response] { (req, svc) =>
-    svc(req).map(resp => {
-      resp.headerMap("Server") = "Example"
-      resp.headerMap("Date") = dateFormat.format(System.currentTimeMillis())
-      resp
-    })
-  }
-
-  val database = Database()
-
-  val module = RouteModule(Root)
-    .withRoute(JsonRoute())
-    .withRoute(PlainTextRoute())
-    .withRoute(FortunesRoute(database))
-    .withRoutes(DatabaseRoutes(database))
-
-  Await.ready(
-    Http.server
-      .withCompressionLevel(0)
-      .serve(":9000", ResponseFilters.CatchAll().andThen(addServerAndDate).andThen(module.toService))
-  )
-}

+ 0 - 41
frameworks/Scala/fintrospect/src/main/scala/FortunesRoute.scala

@@ -1,41 +0,0 @@
-import com.twitter.finagle.Service
-import com.twitter.finagle.http.Method.Get
-import com.twitter.finagle.http.Request
-import com.twitter.finagle.mysql._
-import io.fintrospect.RouteSpec
-import io.fintrospect.formats.Html
-import io.fintrospect.templating.MustacheTemplates.CachingClasspath
-import io.fintrospect.templating.{RenderView, View}
-
-case class Fortune(id: Int, message: String)
-
-case class FortunesList(items: Seq[Fortune]) extends View
-
-object FortunesRoute {
-
-  private val toFortunes: PartialFunction[Result, Seq[Fortune]] = {
-    case rs: ResultSet => rs.rows
-      .map(row => {
-        val IntValue(id) = row("id").get
-        val StringValue(message) = row("message").get
-        Fortune(id, message)
-      })
-    case _ => Seq.empty
-  }
-
-  def apply(database: Client) = {
-
-    val statement = database.prepare("SELECT * FROM fortune")
-
-    val service = new RenderView(Html.ResponseBuilder, CachingClasspath()).andThen(
-      Service.mk {
-        _: Request =>
-          statement().map(toFortunes).map(f => {
-            val sortedFortunes = (Fortune(0, "Additional fortune added at request time.") +: f).sortBy(_.message)
-            FortunesList(sortedFortunes)
-          })
-      })
-
-    RouteSpec().at(Get) / "fortunes" bindTo service
-  }
-}

+ 0 - 13
frameworks/Scala/fintrospect/src/main/scala/JsonRoute.scala

@@ -1,13 +0,0 @@
-import com.twitter.finagle.Service
-import com.twitter.finagle.http.Method.Get
-import com.twitter.finagle.http.Request
-import io.fintrospect.RouteSpec
-import io.fintrospect.formats.Jackson.JsonFormat.{encodeToBuf, obj, string}
-import io.fintrospect.formats.Jackson.ResponseBuilder._
-
-object JsonRoute {
-
-  private val service = Service.mk { _: Request => Ok(encodeToBuf(obj("message" -> string("Hello, World!")))) }
-
-  def apply() = RouteSpec().at(Get) / "json" bindTo service
-}

+ 0 - 15
frameworks/Scala/fintrospect/src/main/scala/PlainTextRoute.scala

@@ -1,15 +0,0 @@
-import com.twitter.finagle.Service
-import com.twitter.finagle.http.Method.Get
-import com.twitter.finagle.http.Request
-import com.twitter.io.Buf
-import io.fintrospect.RouteSpec
-import io.fintrospect.formats.PlainText.ResponseBuilder._
-
-object PlainTextRoute {
-
-  private val preallocatedMsgForPlainText = Buf.Utf8("Hello, World!")
-
-  private val service = Service.mk { _: Request => Ok(preallocatedMsgForPlainText) }
-
-  def apply() = RouteSpec().at(Get) / "plaintext" bindTo service
-}