Dear Camlers,
Announcing Simple_httpd 1.1
I’m pleased to announce the release of Simple_httpd 1.1, a lightweight but feature-rich HTTP/HTTPS server library for OCaml 5, designed with a strong emphasis on performance, simplicity, and production use.
It started as a fork of tiny_httpd to experiment with OCaml 5 domains and effects, Simple_httpd has now matured into a robust server used to host real websites.
Documentation : index (simple_httpd.index) (served by simple_httpd, and containing nice benchmarks)
Github : GitHub - craff/simple_httpd: A library to write web server and site · GitHub.
Highlights
-
Very fast: built around Linux epoll, eventfd, OCaml 5 domains and effects, with careful attention to latency and throughput. Benchmarks show excellent performance, competitive with or exceeding traditional web servers for many workloads.
-
Production ready: the server has been running real websites reliably for months, validating both its performance and stability in everyday use.
-
Compiled server-side templates:
.chamlfiles provide an OCaml equivalent of PHP, except that templates are compiled rather than interpreted, combining flexibility with native performance. It is much faster than php. -
Flexible routing: requests can be dispatched not only by path and HTTP method, but also by host name, address and port, making virtual hosting straightforward.
-
Static and embedded resources: serve files directly from the filesystem, or package them into the executable using
vfs_pack. Compression is supported in both cases and small file may even be cached in memory in the second case. -
Built-in monitoring: integrated status pages expose CPU usage, memory consumption, active connections, file descriptors and logs, making deployment and debugging much easier. We also provide server sent event and websocket, with a full featured terminal as an application.
-
Modern HTTP 1.1 features: HTTPS, cookies, authentication, logging with levels, and optional database integration through Caqti are available out of the box. More are planned : anti attack!
Simple_httpd remains true to its original philosophy: provide a web server that is easy to use, easy to extend, yet fast enough for demanding production applications.
Feedback, bug reports and contributions are very welcome!