From 97d7426ff4ab50e951112408a76cc31416db177a Mon Sep 17 00:00:00 2001 From: ruroru <111705692+ruroru@users.noreply.github.com> Date: Mon, 9 Jun 2025 00:29:52 +0000 Subject: [PATCH] Add ring-http-exchange --- .../Clojure/ring-http-exchange/README.md | 17 +++ .../ring-http-exchange/benchmark_config.json | 47 ++++++ frameworks/Clojure/ring-http-exchange/pom.xml | 140 ++++++++++++++++++ .../ring-http-exchange-robaho.dockerfile | 13 ++ .../ring-http-exchange.dockerfile | 13 ++ .../src/ring_http_exchange/benchmark.clj | 29 ++++ 6 files changed, 259 insertions(+) create mode 100755 frameworks/Clojure/ring-http-exchange/README.md create mode 100755 frameworks/Clojure/ring-http-exchange/benchmark_config.json create mode 100644 frameworks/Clojure/ring-http-exchange/pom.xml create mode 100644 frameworks/Clojure/ring-http-exchange/ring-http-exchange-robaho.dockerfile create mode 100644 frameworks/Clojure/ring-http-exchange/ring-http-exchange.dockerfile create mode 100644 frameworks/Clojure/ring-http-exchange/src/ring_http_exchange/benchmark.clj diff --git a/frameworks/Clojure/ring-http-exchange/README.md b/frameworks/Clojure/ring-http-exchange/README.md new file mode 100755 index 00000000000..66d19f7ef4e --- /dev/null +++ b/frameworks/Clojure/ring-http-exchange/README.md @@ -0,0 +1,17 @@ +# ring-http-exchange Benchmarking Test + +## Test Type Implementation Source Code +* [JSON](src/ring_http_exchange/benchmark.clj) +* [PLAINTEXT](src/ring_http_exchange/benchmark.clj) + +## Important Libraries +The tests were run with: +* [ring-http-exchange](https://github.com/ruroru/ring-http-exchange) +* [jsonista](https://github.com/metosin/jsonista) + +## Test URLs +### JSON +http://localhost:8080/json + +### PLAINTEXT +http://localhost:8080/plaintext diff --git a/frameworks/Clojure/ring-http-exchange/benchmark_config.json b/frameworks/Clojure/ring-http-exchange/benchmark_config.json new file mode 100755 index 00000000000..bca6c16a2cb --- /dev/null +++ b/frameworks/Clojure/ring-http-exchange/benchmark_config.json @@ -0,0 +1,47 @@ +{ + "framework": "ring-http-exchange", + "tests": [ + { + "default": { + "json_url": "/json", + "plaintext_url": "/plaintext", + "port": 8080, + "approach": "Realistic", + "classification": "Platform", + "database": "None", + "framework": "None", + "language": "Clojure", + "flavor": "None", + "orm": "None", + "platform": "None", + "webserver": "None", + "os": "Linux", + "database_os": "Linux", + "display_name": "ring-http-exchange", + "notes": "", + "versus": "httpserver" + } + }, + { + "robaho": { + "json_url": "/json", + "plaintext_url": "/plaintext", + "port": 8080, + "approach": "Realistic", + "classification": "Platform", + "database": "None", + "framework": "None", + "language": "Clojure", + "flavor": "None", + "orm": "None", + "platform": "None", + "webserver": "None", + "os": "Linux", + "database_os": "Linux", + "display_name": "ring-http-exchange-robaho", + "notes": "", + "versus": "ring-http-exchange" + } + } + ] +} diff --git a/frameworks/Clojure/ring-http-exchange/pom.xml b/frameworks/Clojure/ring-http-exchange/pom.xml new file mode 100644 index 00000000000..e51d9d5f4c5 --- /dev/null +++ b/frameworks/Clojure/ring-http-exchange/pom.xml @@ -0,0 +1,140 @@ + + + 4.0.0 + ring-http-server + ring-http-server + jar + 1.0.0 + ring-http-server + + + EPL-2.0 + https://www.eclipse.org/legal/epl-2.0/ + + + + java + java-test + + + resources + + + + + resources + + + target + target\classes + + + com.theoryinpractise + clojure-maven-plugin + 1.8.3 + true + + + compile-clojure + compile + + compile + + + + test-clojure + test + + test + + + + + + src/ + + + + + maven-assembly-plugin + + + + ring_http_exchange.benchmark + + + + jar-with-dependencies + + + + + make-assembly + package + + single + + + + + + + + + central + https://repo1.maven.org/maven2/ + + false + + + true + + + + clojars + https://repo.clojars.org/ + + true + + + true + + + + + + + + + org.clojure + clojure + 1.11.1 + + + org.clojars.jj + ring-http-exchange + 1.1.0 + + + metosin + jsonista + 0.3.13 + + + + + robaho + + false + + + + io.github.robaho + httpserver + 1.0.23 + + + + + diff --git a/frameworks/Clojure/ring-http-exchange/ring-http-exchange-robaho.dockerfile b/frameworks/Clojure/ring-http-exchange/ring-http-exchange-robaho.dockerfile new file mode 100644 index 00000000000..55be60f11f4 --- /dev/null +++ b/frameworks/Clojure/ring-http-exchange/ring-http-exchange-robaho.dockerfile @@ -0,0 +1,13 @@ +FROM maven:3-eclipse-temurin-24-alpine as maven +WORKDIR /ring-http-exchange +COPY pom.xml pom.xml +COPY src src +RUN mvn clean clojure:compile -P robaho package + +FROM openjdk:25-jdk-slim +WORKDIR /ring-http-exchange +COPY --from=maven /ring-http-exchange/target/ring-http-server-1.0.0-jar-with-dependencies.jar app.jar + +EXPOSE 8080 + +CMD ["java", "-server", "-XX:+UseParallelGC", "-jar", "app.jar"] diff --git a/frameworks/Clojure/ring-http-exchange/ring-http-exchange.dockerfile b/frameworks/Clojure/ring-http-exchange/ring-http-exchange.dockerfile new file mode 100644 index 00000000000..fe3b450b87a --- /dev/null +++ b/frameworks/Clojure/ring-http-exchange/ring-http-exchange.dockerfile @@ -0,0 +1,13 @@ +FROM maven:3-eclipse-temurin-24-alpine as maven +WORKDIR /ring-http-exchange +COPY pom.xml pom.xml +COPY src src +RUN mvn clean clojure:compile package + +FROM openjdk:25-jdk-slim +WORKDIR /ring-http-exchange +COPY --from=maven /ring-http-exchange/target/ring-http-server-1.0.0-jar-with-dependencies.jar app.jar + +EXPOSE 8080 + +CMD ["java", "-server", "-XX:+UseParallelGC", "-jar", "app.jar"] diff --git a/frameworks/Clojure/ring-http-exchange/src/ring_http_exchange/benchmark.clj b/frameworks/Clojure/ring-http-exchange/src/ring_http_exchange/benchmark.clj new file mode 100644 index 00000000000..1f7c448e279 --- /dev/null +++ b/frameworks/Clojure/ring-http-exchange/src/ring_http_exchange/benchmark.clj @@ -0,0 +1,29 @@ +(ns ring-http-exchange.benchmark + (:gen-class) + (:require [jsonista.core :as json] + [ring-http-exchange.core :as server]) + (:import + (java.util.concurrent Executors))) + +(def ^:private ^:const json-headers {"Server" "ring-http-exchange" + "Content-Type" "application/json"}) +(def ^:private ^:const plaintext-response + {:status 200 + :headers { + "Server" "ring-http-exchange" + "Content-Type" "text/plain"} + :body "Hello, World!"}) + +(defn -main + [& args] + (println "Starting server on port 8080") + (server/run-http-server + (fn [req] + (case (req :uri) + "/json" {:status 200 + :headers json-headers + :body (json/write-value-as-bytes {:message "Hello, World!"})} + plaintext-response)) + {:port 8080 + :host "0.0.0.0" + :executor (Executors/newVirtualThreadPerTaskExecutor)}))