Browse Source

Scala/unfiltered removal (#2452)

Nate 8 years ago
parent
commit
1f77221416

+ 0 - 1
.travis.yml

@@ -185,7 +185,6 @@ env:
     - "TESTDIR=Scala/scruffy"
     - "TESTDIR=Scala/scruffy"
     - "TESTDIR=Scala/spray"
     - "TESTDIR=Scala/spray"
     - "TESTDIR=Scala/s-server"
     - "TESTDIR=Scala/s-server"
-    - "TESTDIR=Scala/unfiltered"
     - "TESTDIR=Scala/http4s"
     - "TESTDIR=Scala/http4s"
     - "TESTDIR=Scala/finch"
     - "TESTDIR=Scala/finch"
     - "TESTDIR=Ur/urweb"
     - "TESTDIR=Ur/urweb"

+ 0 - 26
frameworks/Scala/unfiltered/README.md

@@ -1,26 +0,0 @@
-#Unfiltered Benchmarking Test
-
-This is the Unfiltered portion of a [benchmarking test suite](../) comparing a variety of web development platforms.
-
-### JSON Encoding Test
-
-* [JSON test source](src/main/scala/Plans.scala)
-
-### Data-Store/Database Mapping Test
-
-* [Database test controller and model](src/main/scala/Plans.scala)
-
-## Infrastructure Software Versions
-The tests were run with:
-
-* [Java OpenJDK 1.7.0_09](http://openjdk.java.net/)
-* [Unfiltered 0.6.8](http://unfiltered.databinder.net/Unfiltered.html)
-
-## Test URLs
-### JSON Encoding Test
-
-http://localhost/json
-
-### Data-Store/Database Mapping Test
-
-http://localhost/db?queries=5

+ 0 - 25
frameworks/Scala/unfiltered/benchmark_config.json

@@ -1,25 +0,0 @@
-{
-  "framework": "unfiltered",
-  "tests": [{
-    "default": {
-      "setup_file": "setup_unfiltered",
-      "json_url": "/json",
-      "db_url": "/db",
-      "query_url": "/db?queries=",
-      "port": 9000,
-      "approach": "Realistic",
-      "classification": "Micro",
-      "database": "MySQL",
-      "framework": "unfiltered",
-      "language": "Scala",
-      "orm": "Micro",
-      "platform": "Netty",
-      "webserver": "None",
-      "os": "Linux",
-      "database_os": "Linux",
-      "display_name": "unfiltered",
-      "notes": "",
-      "versus": "netty"
-    }
-  }]
-}

+ 0 - 28
frameworks/Scala/unfiltered/project/Build.scala

@@ -1,28 +0,0 @@
-import sbt._
-import Keys._
-import sbtassembly.AssemblyPlugin._
-//import AssemblyKeys._
-
-object Bench extends Build {
-  lazy val project = Project(
-    "bench", 
-    file("."),
-    settings = Defaults.defaultSettings ++ assemblySettings ++ Seq(
-      scalaVersion := "2.11.7",
-      version := "1.0.0",
-      name := "bench",
-      libraryDependencies ++= Seq(
-        "net.databinder" %% "unfiltered-netty-server" % "0.8.4",
-        "net.databinder.dispatch" %% "dispatch-core" % "0.11.2",
-        "net.databinder" %% "unfiltered-json4s" % "0.8.4",
-        "net.databinder" %% "unfiltered-specs2" % "0.8.4" % "test",
-        "org.clapper" %% "avsl" % "1.0.2",
-        "org.json4s" %% "json4s-jackson" % "3.3.0",
-        "com.typesafe.slick" %% "slick" % "3.1.1",
-        "mysql" % "mysql-connector-java" % "5.1.38",
-        "com.jolbox" % "bonecp" % "0.7.1.RELEASE",
-        "com.typesafe" % "config" % "1.0.0"
-      )
-    )
-  )
-}

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

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

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

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

+ 0 - 11
frameworks/Scala/unfiltered/setup_unfiltered.sh

@@ -1,11 +0,0 @@
-#!/bin/bash
-
-fw_depends jmysql ava scala sbt
-
-sed -i 's|jdbc:mysql://.*:3306|jdbc:mysql://'"${DBHOST}"':3306|g' src/main/resources/application.conf
-sed -i 's|maxThreads = .*|maxThreads = '"${MAX_THREADS}"'|g' src/main/resources/application.conf
-
-sbt assembly -batch
-
-cd target/scala-2.10
-java -jar bench-assembly-1.0.0.jar &

+ 0 - 4
frameworks/Scala/unfiltered/source_code

@@ -1,4 +0,0 @@
-./unfiltered/src/main/scala/
-./unfiltered/src/main/scala/Server.scala
-./unfiltered/src/main/scala/Plans.scala
-./unfiltered/src/main/scala/DatabaseAccess.scala

+ 0 - 8
frameworks/Scala/unfiltered/src/main/resources/application.conf

@@ -1,8 +0,0 @@
-db.default.driver=""com.mysql.jdbc.Driver""
-db.default.url = "jdbc:mysql://localhost:3306/hello_world?jdbcCompliantTruncation=false&elideSetAutoCommits=true&useLocalSessionState=true&cachePrepStmts=true&cacheCallableStmts=true&alwaysSendSetIsolation=false&prepStmtCacheSize=4096&cacheServerConfiguration=true&prepStmtCacheSqlLimit=2048&zeroDateTimeBehavior=convertToNull&traceProtocol=false&useUnbufferedInput=false&useReadAheadInput=false&maintainTimeStats=false&useServerPrepStmts&cacheRSMetadata=true"
-db.default.user = "benchmarkdbuser"
-db.default.password = "benchmarkdbpass"
-db.default.minConnections = 4
-db.default.maxConnections = 125
-
-unfiltered.maxThreads = 16

+ 0 - 46
frameworks/Scala/unfiltered/src/main/scala/DatabaseAccess.scala

@@ -1,46 +0,0 @@
-package bench
-
-import scala.collection.immutable.Map
-import scala.util.Try
-import scala.slick.driver.SQLServerDriver.simple._
-import java.util.Map.Entry
-import com.typesafe.config._
-import com.jolbox.bonecp.{ BoneCP, BoneCPConfig, BoneCPDataSource }
-
-object DatabaseAccess {
-	var configs: Map[String, BoneCPConfig] = Map[String, BoneCPConfig]()
-	var dataSources: Map[String, BoneCPDataSource] = Map[String, BoneCPDataSource]()
-	var databases: Map[String, Database] = dataSources.map { case(key, value) => (key, Database.forDataSource(value)) }
-  var maxThreads: Int = 16 // shoehorning this in
-
-  /** Loads the configuration given.  Usually loaded from application.conf in class path.
-   *
-   * @param config the configuration to use
-   */
-  def loadConfiguration(config: Config) {
-    val keys = Seq(config.getObject("db").toConfig.entrySet.toArray: _*)
-    val entries = keys.map("db." + _.asInstanceOf[Entry[String, Object]].getKey)
-    val driverStrings = entries.filter(_.contains(".driver")).distinct
-    val urls = entries.filter(_.contains(".url"))
-
-    /* Load class drivers */
-    for (driverString <- driverStrings) Class.forName(config.getString(driverString))
-
-    /* Load config */
-    DatabaseAccess.configs = (for (url <- urls) yield {
-      /* Keys should be in the format db.key.url */
-      val key = url.split('.').init.mkString(".") // db.key.url becomes db.key
-      val boneCPConfig = new BoneCPConfig()
-      boneCPConfig.setJdbcUrl(config.getString(url))
-      boneCPConfig.setMinConnectionsPerPartition(config.getInt(key + ".minConnections"))
-      boneCPConfig.setMaxConnectionsPerPartition(config.getInt(key + ".maxConnections"))
-      boneCPConfig.setUsername(config.getString(key + ".user"))
-      boneCPConfig.setPassword(config.getString(key + ".password"))
-      boneCPConfig.setPartitionCount(2)
-      (key, boneCPConfig)
-    }).toMap
-    DatabaseAccess.dataSources = DatabaseAccess.configs.map { case(key, value) => (key, new BoneCPDataSource(value)) }
-    databases = dataSources.map { case(key, value) => (key, Database.forDataSource(value)) }
-    maxThreads = Try { config.getString("unfiltered.maxThreads").toInt }.getOrElse(16) * 2
-  }
-}

+ 0 - 50
frameworks/Scala/unfiltered/src/main/scala/Plans.scala

@@ -1,50 +0,0 @@
-package bench
-
-import unfiltered.request._
-import unfiltered.response._
-import unfiltered.netty._
-import org.json4s._
-import org.json4s.jackson.JsonMethods._
-import org.json4s.jackson.Serialization
-import org.json4s.jackson.Serialization.{read, write}
-import org.json4s.JsonDSL.WithBigDecimal._
-import scala.util.Random
-import scala.slick.driver.MySQLDriver.simple._
-import scala.slick.jdbc.{ GetResult, StaticQuery => Q }
-import java.util.concurrent.ThreadLocalRandom
-
-case class World(id: Long, randomNumber: Long)
-
-/** unfiltered plan */
-object Plans extends cycle.Plan
-  with cycle.DeferralExecutor with cycle.DeferredIntent with ServerErrorResponse {
-
-  private val TEST_DATABASE_ROWS = 9999
-  implicit val getWorld = GetResult(r => World(r.<<, r.<<))
-  implicit val formats = Serialization.formats(NoTypeHints)
-  val db = DatabaseAccess.databases("db.default")
-
-  def intent = {
-    case GET(Path("/json")) => JsonContent ~> ResponseString(compact(render("message" -> "Hello, World!")))
-    case GET(Path("/db") & Params(params)) =>
-      val random = ThreadLocalRandom.current()
-      val queries = params.get("queries").flatMap(_.headOption).getOrElse("1").toInt
-      JsonContent ~> ResponseString(
-        write(
-          db.withSession { implicit session: Session =>
-            (0 until queries).map { _ =>
-              (Q[Int, World] + "select id, randomNumber from World where id = ?")(random.nextInt(TEST_DATABASE_ROWS) + 1).first
-            }
-          }
-        )
-      )
-  }
-  def underlying = CustomExecutor.underlying
-}
-
-object CustomExecutor {
-  import org.jboss.netty.handler.execution._
-  lazy val underlying = new MemoryAwareThreadPoolExecutor(
-    DatabaseAccess.maxThreads, 536870912, 536870912
-  )
-}

+ 0 - 20
frameworks/Scala/unfiltered/src/main/scala/Server.scala

@@ -1,20 +0,0 @@
-package bench
-
-import com.typesafe.config.{ ConfigFactory, Config }
-
-object Server {
-  val logger = org.clapper.avsl.Logger(Server.getClass)
-
-  def main(args: Array[String]) {
-    val config = ConfigFactory.load()
-    DatabaseAccess.loadConfiguration(config)
-
-    unfiltered.netty.Http(9000)
-      .handler(Plans)
-      .run { s =>
-        logger.info("starting unfiltered app at localhost on port %s".format(s.port))
-      }
-
-    dispatch.Http.shutdown()
-  }
-}