Repository navigation
feat(zio-http): add plaintext and json benchmarks for zio-http - #6447
Conversation
| content = HttpContent.Complete(jsonstr)) | ||
| } | ||
|
|
||
| override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] = Server.start(8080, app).exitCode |
There was a problem hiding this comment.
Suggestion: disable zio tracing :) that can result in potential gains.
Also, thread count should probably match the one in other frameworks (https supposedly has 32:
)There was a problem hiding this comment.
By default AFAIK it's going to be 2x availableCPU(). Need to check if the test machine already has virtualization because in that case it should be equal to availableCPU()
| case class Message(message: String) | ||
| implicit val codec: JsonValueCodec[Message] = JsonCodecMaker.make | ||
|
|
||
| val jsonstr = new String(writeToArray(Message(message))) |
There was a problem hiding this comment.
Maybe it's just me, but I'd say manually encoding the value to a byte array defeats the purpose of testing the framework's performance, since this code is part of the test and not the framework.
| object WebApp extends App { | ||
|
|
||
| val message: String = "Hello, World!" | ||
| def createDate: String = DateTimeFormatter.RFC_1123_DATE_TIME.format(ZonedDateTime.now) |
There was a problem hiding this comment.
To stay in the idiomatic realm of using ZIO-related libraries this should be suspended in ZIO (IO.effectTotal on ZonedDateTime.now, or zio.clock.currentDateTime etc.)
There was a problem hiding this comment.
We will move certain "basic" headers to the core. For eg: Date and Server. Almost all libraries do it this way for performance reasons. Also, the code above will look a lot more concise.
| @@ -0,0 +1,36 @@ | |||
| FROM alpine as builder | |||
There was a problem hiding this comment.
You could use a fixed alpine version here to avoid that future updates can break the build
|
|
||
| override def run(args: List[String]): URIO[zio.ZEnv, ExitCode] = Server.start(8080, app).exitCode | ||
|
|
||
| } No newline at end of file |
There was a problem hiding this comment.
@amitksingh1490 can you just run it thru scalafmt also.
…mpower#6447) * feat(zio-http): add plaintext and json benchmarks for zio-http * build(zio-http): update benchmark source code * fix(zio-http): Json encoding should be done on each response * fix(zio-http): remove unnecessary jvm options * build(zio-http): cleanup dockerfile * build(zio-http): cleanup dockerfile * style(zio-http): scalafmt * fix(zio-http): update zhttp version and change example
No description provided.