Skip to content

Instantly share code, notes, and snippets.

@lbialy
Created March 28, 2024 21:30
Show Gist options
  • Save lbialy/c1f8eebe5ad5f715ef3b6f96ed119fc6 to your computer and use it in GitHub Desktop.
Save lbialy/c1f8eebe5ad5f715ef3b6f96ed119fc6 to your computer and use it in GitHub Desktop.
Have fun Anton
$ sbt new http4s/http4s.g8 --branch 1.0-scala3
// use all the defaults, just set sbt to 1.9.9
$ cd quickstart
$ sbt assembly
$ cat Dockerfile # create this file with these contents:
FROM ghcr.io/graalvm/jdk-community:22
RUN mkdir /opt/app
COPY target/scala-3.3.3/quickstart-assembly-0.0.1-SNAPSHOT.jar /opt/app/http4s.jar
CMD ["java", "-jar", "/opt/app/http4s.jar"]
$ docker build . -t http4s:graalvm
$ docker run -d -m 250m -p 8080:8080 http4s:graalvm
$ wrk -t5 -c25 -d15s http://127.0.0.1:8080/hello/fren
Running 15s test @ http://127.0.0.1:8080/hello/fren
5 threads and 25 connections
Thread Stats Avg Stdev Max +/- Stdev
Latency 4.37ms 5.23ms 85.59ms 96.15%
Req/Sec 1.36k 221.39 1.63k 86.67%
101463 requests in 15.05s, 15.19MB read
Requests/sec: 6741.57 <<<<<<<<<< HTTP4S GOES BRRRRRRRRR
Transfer/sec: 1.01MB
$ docker ps -a | grep http4s
3db82b1cf410 http4s:graalvm "java -jar /opt/app/…" 6 minutes ago Up 6 minutes 0.0.0.0:8080->8080/tcp great_greider
// DID NOT CRASH UNDER LOAD, -m 250m, thank me later
@lbialy
Copy link
Author

lbialy commented Mar 28, 2024

I love the myth that Scala can't go fast in low mem environments 😆

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment