Where everyone implements a web server with some specific requirements and constraints. 8 CPUs, a fixed postgres database with a specific config. A benchmark script, and some rules etc…
Unfortunately I’m not a member of this guy’s community so I was a bit late to take part in the challenge but I did see the typical languages up at the top of the leader board. Some rust, some zig, etc etc. I decided I would take some time and make a late entry and see how far I could push Ada. Could I get to the top of the leader board? I tried some experiments with AWS and while it is a good piece of software it wasn’t exactly written with performance in mind. It uses blocking sockets and it doesn’t have pools of reactors that handle responses in bulk.
Yes I used Claude Opus 5.5 in the preparation of the submission, but it is not vibe coded. The engineering decisions were made by me. I chose the features and the path forward. I suspect if it ever gets accepted and bench marked it should place near the top. The top of the leader board is 230k users before breaking. On my machine I got just above 500k but that’s on 8 AMD Ryzen 9 9950X3D cores and not whatever weaker VCPU the bench marking machine has.
I spent some time extracting the core of the submission and building a web programming stack that would work with how people build web applications these days. The result is here:
What do you think of the repo? Should I take it any further? Should I publish it? Should we take the improvements and apply them to AWS?
The stack so far has:
http focused crypto crate provided by OpenSSL
postgres client crate provided by libpq
sqlite client crate provided by libsqlite3
valkey crate in native Ada
async TCP socket support for Linux, BSDs (Mac, etc..), and Windows.
Ada HTTP/1.1 and HTTP/2 server with gzip and TLS (via OpenSSL).
Ada HTTP/1.1 client with TLS
Support for health check and metric endpoints
logging with request tracing
Ada Open_Telemetry support crate
Ada S3 support crate
Ada Mustache logic-less template crate.
We have spark silver proof of absence of runtime errors throughout the stack.
There is fuzzing testing using libfuzz across all communicating interfaces.
It seems that you are using SPARK for most (some?) of the project. In spark you can create you own memory pools, but you cannot use Ada’s standard pools as they are controlled objects. Remember to use constant access wherever possible. Also, in SPARK you can use the Jorvik profile, but it is quite limited to be honest with you. Also Ada supports Queues, but AFAIK, they are not made with performance in mind. I believe Simple Components from Dmitry implements simple yet performant ones.
I am just letting you know in case you would like to feed the AI these datapoints and try to improve the solution. Also, it always helps them when you give them tools like perf under Linux so that they can measure and optimize autonomously.
I am trying spark out and I find it really helps the bot generate higher quality output.
I used the Jorvik profile for the submission to prove no data races but I don’t think I can use it for the Sparrow main repo because I didn’t want to enforce that the number of tasks in the pool is known at compile time. The sparrow main repo isn’t trying to be the maximum performance version of a web server, but I certainly have performance a bit in mind and want it to be fast. A simple greeter response server with sparrow can handle 700k concurrent users on my machine, where as AWS breaks down around 50k (mainly due to the Async socket io)
I will be sure to ask it to analyze the current code with your suggestions in mind and see what it comes up with!
Yes, this is one of the main limitations. You also have to pin the tasks so that there is no dynamic dispatching sadly. But I believe you can create a fixed amount of pools and dynamically awake them. So the application starts with, lets say, 100 tasks, but they are all sleeping and waiting for inputs. I do not know if that would help.
Also, you may want to use a newer GNATprove as it has some nice features such as improved memory handling and exception handling, which could make your code cleaner and more robust. Finally, if you are dealing with linux and IO, maybe you could take a look at things like io_uring, which could help you.
Also, you may want to use a newer GNATprove as it has some nice features such as improved memory handling and exception handling
I’m on whatever the latest is available via Alire. The submission proofs took about 10 minutes cold though.
Finally, if you are dealing with linux and IO, maybe you could take a look at things like io_uring, which could help you.
I considered io_uring. In the top 5 of the leader board 3 of 5 used epoll and 2 of 5 used io_uring. I picked epoll and went with it. I’m pretty sure both are going to be comparable in speed.
Also, it always helps them when you give them tools like perf under Linux so that they can measure and optimize autonomously
I did some perf profiling both manually and with the bot. We definitely got to the point where we were postgres limited as the 2 cores allocated for it were fully loaded.
It seems that you are using SPARK for most (some?) of the project
The submission to the contest, as well as the main project has silver level proofs. They should be absent of any crashes.