Skip to content

Commit

Permalink
add 4 benchmarks for Oxygen.jl
Browse files Browse the repository at this point in the history
  • Loading branch information
panagiotis georgakopoulos committed Aug 29, 2023
1 parent 3d1a355 commit 17ddf1b
Show file tree
Hide file tree
Showing 8 changed files with 81 additions and 7 deletions.
4 changes: 4 additions & 0 deletions frameworks/Julia/Http.jl/API.jl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ function getqueries(req)
end
end

function notfound(request)
return HTTP.Response(404, [], "")
end

function plaintext(req::HTTP.Request)
headers = [
"Content-Type" => "text/plain",
Expand Down
13 changes: 12 additions & 1 deletion frameworks/Julia/Http.jl/Manifest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

julia_version = "1.9.3"
manifest_format = "2.0"
project_hash = "350c12e51175a69408a5d41399f431a2b8090984"
project_hash = "f7c00badcd2c8d6084164890ce9ab6f61656222f"

[[deps.Adapt]]
deps = ["LinearAlgebra", "Requires"]
Expand Down Expand Up @@ -274,6 +274,11 @@ git-tree-sha1 = "a03c77519ab45eb9a34d3cfe2ca223d79c064323"
uuid = "e6f89c97-d47a-5376-807f-9c37f3926c36"
version = "1.0.1"

[[deps.MIMEs]]
git-tree-sha1 = "65f28ad4b594aebe22157d6fac869786a255b7eb"
uuid = "6c6e2e6c-3030-632d-7369-2d6c69616d65"
version = "0.1.4"

[[deps.Markdown]]
deps = ["Base64"]
uuid = "d6f4376e-aef5-505a-96c1-9c027394607a"
Expand Down Expand Up @@ -340,6 +345,12 @@ git-tree-sha1 = "2e73fe17cac3c62ad1aebe70d44c963c3cfdc3e3"
uuid = "bac558e1-5e72-5ebc-8fee-abe8a469f55d"
version = "1.6.2"

[[deps.Oxygen]]
deps = ["Dates", "HTTP", "JSON3", "MIMEs", "Sockets"]
git-tree-sha1 = "dca31e833aafb6277e5aff9fdcb5029be5045255"
uuid = "df9a0d86-3283-4920-82dc-4555fc0d1d8b"
version = "1.1.11"

[[deps.Parsers]]
deps = ["Dates", "PrecompileTools", "UUIDs"]
git-tree-sha1 = "716e24b21538abc91f6205fd1d8363f39b442851"
Expand Down
2 changes: 1 addition & 1 deletion frameworks/Julia/Http.jl/Pool.jl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cnxpool = Pools.Pool{LibPQ.Connection}(25)
cnxpool = Pools.Pool{LibPQ.Connection}(2)

function cnxisok(cnx::LibPQ.Connection)
return LibPQ.status(cnx) == LibPQ.libpq_c.CONNECTION_OK
Expand Down
1 change: 1 addition & 0 deletions frameworks/Julia/Http.jl/Project.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ HypertextLiteral = "ac1192a8-f4b3-4bfe-ba22-af5b92cd3ab2"
JSON3 = "0f8b85d8-7281-11e9-16c2-39a750bddbf1"
JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899"
LibPQ = "194296ae-ab2e-5f79-8cd4-7183a0a5a0d1"
Oxygen = "df9a0d86-3283-4920-82dc-4555fc0d1d8b"
StructTypes = "856f2bd8-1eba-4b0a-8007-ebc267875bd4"
21 changes: 21 additions & 0 deletions frameworks/Julia/Http.jl/benchmark_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,27 @@
"display_name": "HTTP.jl",
"notes": "Http.jl",
"versus": "None"
},
"oxygen": {
"json_url": "/json",
"plaintext_url": "/plaintext",
"db_url": "/db",
"fortune_url": "/fortunes",
"port": 8080,
"approach": "Realistic",
"classification": "Micro",
"database": "Postgres",
"framework": "Oxygen",
"language": "Julia",
"flavor": "Julia",
"orm": "Raw",
"platform": "libuv",
"webserver": "HTTP.jl",
"os": "Linux",
"database_os": "Linux",
"display_name": "HTTP.jl [Oxygen]",
"notes": "",
"versus": "Http.jl"
}
}]
}
20 changes: 20 additions & 0 deletions frameworks/Julia/Http.jl/http-jl-oxygen.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM julia:1.9.3

ENV DEBIAN_FRONTEND noninteractive

RUN apt-get update -yqq && apt-get install -y
RUN apt-get update -yqq && apt-get install -y wget

COPY ./Project.toml ./Manifest.toml ./

# This step takes a lot of time, let's aggressively cache it
RUN julia --project=. -e 'import Pkg; Pkg.instantiate();'

# Files
COPY ./ ./

RUN chmod +x run.sh

EXPOSE 8080

CMD julia --threads=auto --project=. oxygen.jl
5 changes: 0 additions & 5 deletions frameworks/Julia/Http.jl/julia_server.jl
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ using HypertextLiteral: @htl
include("Pool.jl")
include("API.jl")

function notfound(request)
@info "Not found"
return HTTP.Response(404, [], "")
end

router = HTTP.Router()

HTTP.register!(router, "GET", "/plaintext", plaintext)
Expand Down
22 changes: 22 additions & 0 deletions frameworks/Julia/Http.jl/oxygen.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using Oxygen
using Pkg
using Dates
using HTTP
using LibPQ
using JSON3
using StructTypes
using ConcurrentUtilities: ConcurrentUtilities, Pools
using HypertextLiteral: @htl

include("Pool.jl")
include("API.jl")


@get "/plaintext" plaintext
@get "/json" jsonSerialization
@get "/db" singleQuery
@get "/queries" multipleQueries
@get "/updates" updates
@get "/fortunes" fortunes

serveparallel(queuesize = 2 << 14, access_log = nothing, host = "0.0.0.0", port = 8080)

0 comments on commit 17ddf1b

Please sign in to comment.