Hi! So first of all I’m an OCaml beginner with no previous experience in asynchronous programming. I’m struggling a bit with wrapping my head around the correct way to use Lwt. Both of these things have led to code quality going out the window. Any feedback would be very welcome.
There is currently not a single web framework written in OCaml showing up on the Tech Empower benchmark suite so I set out to add one. I ended up going with Webmachine because I liked the name, very scientific I know. I followed the recommendations and implemented the easiest test cases. You can find my implementation here. Unfortunately the “high” concurrency test fails on 2 out 3 test cases.
I have added some rudimentary printf logging as well as postgresql logging. This is what I’m seeing:
Unexpected result from <postgresql://benchmarkdbuser:_@tfb-database:5432/hello_world?connect_timeout=15>: Received 0 tuples, expected one. Query: "SELECT id, randomNumber FROM World WHERE id = $1".174
I believe the
174 at the end is the
id being queried for which I know exists in the table. Postgresql logs no errors.
Any suggestions on how I would move forward with my debugging?
If someone would like to try this out you may execute the following:
git clone https://github.com/rbjorklin/FrameworkBenchmarks.git cd FrameworkBenchmarks ./tfb --mode debug --test webmachine
And then in a new window call:
curl -H "Content-Type: application/json" http://localhost:8080/queries/500
which consistently fails on the 4 request for me.
The versions I’m using are all documented in the dune-project file.