Browse Source

Add youi server (#4407)

Andriy Plokhotnyuk 6 years ago
parent
commit
d53785f83c

+ 20 - 0
frameworks/Scala/youi/README.md

@@ -0,0 +1,20 @@
+# youi Benchmarking Test
+
+### Test Type Implementation Source Code
+
+* [JSON](src/main/scala/example/Main.scala)
+* [PLAINTEXT](src/main/scala/example/Main.scala)
+
+## Important Libraries
+The tests were run with:
+* [youi-undertow](https://github.com/outr/youi/tree/master/serverUndertow)
+* [jsoniter-scala](https://github.com/plokhotnyuk/jsoniter-scala)
+
+## Test URLs
+### JSON
+
+http://localhost:8080/json
+
+### PLAINTEXT
+
+http://localhost:8080/plaintext

+ 26 - 0
frameworks/Scala/youi/benchmark_config.json

@@ -0,0 +1,26 @@
+{
+  "framework": "youi",
+  "tests": [
+    {
+      "default": {
+        "json_url": "/json",
+        "plaintext_url": "/plaintext",
+        "port": 8080,
+        "approach": "Realistic",
+        "classification": "Micro",
+        "database": "None",
+        "framework": "youi",
+        "language": "Scala",
+        "flavor": "None",
+        "orm": "None",
+        "platform": "Undertow",
+        "webserver": "None",
+        "os": "Linux",
+        "database_os": "Linux",
+        "display_name": "youi",
+        "notes": "",
+        "versus": "Undertow"
+      }
+    }
+  ]
+}

+ 11 - 0
frameworks/Scala/youi/build.sbt

@@ -0,0 +1,11 @@
+name := """youi-server"""
+
+version := "1.0"
+
+scalaVersion := "2.12.8"
+
+libraryDependencies ++= Seq(
+  "io.youi" %% "youi-server-undertow" % "0.10.3",
+  "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-core" % "0.39.0",
+  "com.github.plokhotnyuk.jsoniter-scala" %% "jsoniter-scala-macros" % "0.39.0" % Provided
+)

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

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

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

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

+ 26 - 0
frameworks/Scala/youi/src/main/scala/example/Main.scala

@@ -0,0 +1,26 @@
+package example
+
+import com.github.plokhotnyuk.jsoniter_scala.core._
+import com.github.plokhotnyuk.jsoniter_scala.macros._
+import io.youi.http.content._
+import io.youi.net._
+import io.youi.server._
+import io.youi.server.dsl._
+
+case class Message(message: String)
+
+object Message {
+  implicit val codec: JsonValueCodec[Message] = JsonCodecMaker.make[Message](CodecMakerConfig())
+}
+
+object Main extends App {
+  new UndertowServerImplementation(new Server {
+    handler(
+      filters(
+        path"/plaintext" / StringContent("Hello, World!", ContentType.`text/plain`),
+        path"/json" / BytesContent(writeToArray(Message("Hello, World!")), ContentType.`application/json`)
+      )
+    )
+    config.clearListeners().addHttpListener("0.0.0.0")
+  }).start()
+}

+ 7 - 0
frameworks/Scala/youi/youi.dockerfile

@@ -0,0 +1,7 @@
+FROM hseeberger/scala-sbt:8u151-2.12.5-1.1.2
+WORKDIR /youi
+COPY project project
+COPY src src
+COPY build.sbt build.sbt
+RUN sbt assembly -batch
+CMD ["java", "-server", "-Xms1g", "-Xmx1g", "-XX:NewSize=512m", "-XX:MaxNewSize=512m", "-XX:+UseParallelGC", "-XX:+AggressiveOpts", "-XX:+UseNUMA", "-XX:-UseBiasedLocking", "-XX:+AlwaysPreTouch", "-jar", "target/scala-2.12/youi-server-assembly-1.0.jar"]