This repository contains an HTTP server set up in Julia. The goal is not to be a perfect and universal template, but rather an example of how to set up a proper HTTP server and features often appearing together such as OpenTelemetry.
It features:
- A simple streamhandler setup
- A simple router setup
- Examples of handler implementations
- OpenTelemetry: metrics (setup and export config)
- OpenTelemetry: traces on all incoming requests through middleware (setup and export config)
- An Auto-GC implementation in
streamhandler_autogc
(not enabled by default) for bad cases of memory leaks on 1.9
run.sh
is configured to use--threads=2,1
by default- An example of a Dockerfile (use
make image
to build using the provided target) extras/run_container.sh
is provided as an example of runtime in a container with memory limits appliedextras/run_bench.sh
is provided as an example of performance testing usingab
extras/run_otel.sh
is provided as an example of a trace exporting setup withjaeger
- Tracing setup requires an OpenTelemetry collector running and
OTEL_EXPORTER_OTLP_TRACES_ENDPOINT
env pointed at its http receiver.
- Tracing setup requires an OpenTelemetry collector running and
Commands may require julia
, ab
, docker
(usable as non-root) and make
.
- From interactive Julia:
julia --threads=2,1 --project=.
, thenusing HTTPQuickstart; HTTPQuickstart.main()
- From shell using Julia:
julia --threads=2,1 --project=. run.jl
- From shell using a script
bash run.sh
- From shell in docker
bash extras/run_container.sh