Skip to content
This repository was archived by the owner on Mar 24, 2026. It is now read-only.
This repository was archived by the owner on Mar 24, 2026. It is now read-only.

Identify all frameworks using postgresql (batch/pipelining) directly/indirectly using external libraries #7381

Closed

Description

@sumeetchhetri

We need to have a definitive list of all frameworks using postgresql (pipelining/batching) directly or indirectly, there are multiple frameworks who are relying on external libraries (rust/java/.net/possibly-other-langs) which are internally relying on pipelining.

Who would we be relying on to provide such a list, do we know what it takes to find all the offenders to this new rule?

IMHO the first step should be to, clearly identify the frameworks not adhering to the new spec, probably once such a list is officially available then we would be in a position to get this change ready for Round 21.

Until there is such a list Round 21 should be postponed indefinitely.

Activity

  1. NateBrady23 commented on May 31, 2022

    @NateBrady23
    Member

    As I've mentioned in the other thread, we will be moving forward with Round 21. It may take an extra week for verification.

    Here is a good start, thanks to @billywhizz

    image

    Other offending frameworks will be removed over the next 2 to 3 weeks of verification.

    If you'd like to assist us in searching for frameworks that might be violating the updated clarification:

    This is a description of the process as mentioned in this thread

  2. billywhizz commented on May 31, 2022

    @billywhizz
    Contributor

    once i have my PR ready i will do some further testing on other frameworks this week - is there some way you want to divide them up? let me know and i can fit in with whatever your plan is.

  3. NateBrady23 commented on May 31, 2022

    @NateBrady23
    Member

    @billywhizz Thank you again for your help here. You can divide and conquer as you see fit. As I mentioned in the Round thread, I'm not worried about the bottom tier. Once we get to about ~50% of the performance of the fixed top frameworks, I'm willing to bet there's nobody using this. This is one of those cases where 20% effort will get us 99% of the way there. I'm interested to see what the top results are after the top frameworks are adjusted, and we'll continue down the list as far as we can go.

  4. billywhizz commented on May 31, 2022

    @billywhizz
    Contributor

    here's two more i tested yesterday to add to the list.
    Screenshot from 2022-05-31 18-01-02

  5. michaelhixson commented on May 31, 2022

    @michaelhixson
    Contributor

    @billywhizz I think my verification strategy isn't good at detecting batching in single query and fortunes.
    I send each HTTP request manually with curl, but I bet that batching only occurs in those test types when the app receives many requests in parallel. How are you going about it?

  6. billywhizz commented on May 31, 2022

    @billywhizz
    Contributor

    hi @michaelhixson

    i'm afraid my process is very manual! 😃

    i just run the framework benchmark for the specific framework i am looking at. e.g.

    ./tfb --mode benchmark -type db --test just
    

    when it is starting up, i watch the veth interfaces coming up using ifconfig and the second one is always the one between the web server and database docker instances. i then run a tcpdump like tool (tcpdump itself should be fine too) on that veth to dump the packets and inspect them manually, checking for the 'S' commands on every query on the wire. i had to make a few tweaks to TE toolset also to stop it pruning the docker images when the run is finished so i can rerun without a full rebuild.

    from what i can see, you rarely see the commands coalesced on the wire, unless whatever pg library the framework in question is using allows this network optimization. it's usually one packet out and one packet back, so it's a bit painful to ensure the SYNCS are in place. once i have checked first few i assume the rest are ok.

    i can have a look tomorrow and see if i could automate something if you don't have anything that's easy to use currently?

  7. billywhizz commented on May 31, 2022

    @billywhizz
    Contributor

    also, as you say, it should be pretty obvious looking at the packets when you see multiple commands in a single packet. then you need to scan it to ensure every bind and exec has a following sync. i'll see if i can come up with something you can run to do this automatically, but it might take a day or two.

  8. michaelhixson commented on May 31, 2022

    @michaelhixson
    Contributor

    Ah ok. You are sending many requests in parallel because you are running the full benchmark.

    I was sending a single multi-query request so that the query log and tcpdump output would be small.
    I think that'd catch most non-compliant implementations in practice, and we'd mark that framework variant non-compliant across all test types (remove the entry from benchmark_config.json or tag it as "broken"). More granular verification would be better, though, so perhaps your approach is better and we just need to read some big logs.

    If I wanted to stick with curl, I suppose I could try sending requests in parallel with xargs to detect batching in single-query test types.

    A more automated approach would be nice even if it's not integrated directly with the toolset. Earlier I tried using postgres stats tables and that didn't work out. A contribution would be welcome although it may be a lot of work. We can tough it out with the current manual verification process for this round at least.

  9. billywhizz commented on May 31, 2022

    @billywhizz
    Contributor

    you could just use wrk instead of curl?

    i'll have a look tomorrow and see if i can come up with anything that would make the process easier/automatable.

  10. billywhizz commented on Jun 1, 2022

    @billywhizz
    Contributor

    hi @michaelhixson. i have something here which should be able to act as a proxy between the web server and the database and keep track of all the messages on the wire. i should be able to package it up as a docker container that you could run to test various frameworks. i could submit as a PR for TE repo under toolset/ somewhere or as a separate repo if you don't want it in TE one.

    let me know if you think would be useful if you haven't already figured out a solution. i should be able to have it ready for tomorrow AM if you interested.

    currently the output looks something like this for /query?q=10, but i can do something to summarise results and count up the bind/exec/sync messages or verify that every bind/exec is followed by a sync.
    Screenshot from 2022-06-01 19-30-15

  11. michaelhixson commented on Jun 2, 2022

    @michaelhixson
    Contributor

    @billywhizz That's certainly more readable than the tcpdump output I was looking at.

    Could you push the code to a separate repository so we could look at it?

  12. billywhizz commented on Jun 2, 2022

    @billywhizz
    Contributor

    @billywhizz That's certainly more readable than the tcpdump output I was looking at.

    Could you push the code to a separate repository so we could look at it?

    @michaelhixson i have something basically working and integrated with the TE repo but, as ever, i have some unexpected issues to resolve. hopefully i can get them sorted this evening and will ping you as soon as i have something reliable you could use without much effort.

    i've pushed the latest to my fork so you can have a look, but i have things i need to fix. as i say, hopefully will have it working soon.

  13. billywhizz commented on Jun 3, 2022

    @billywhizz
    Contributor

    @michaelhixson am afraid i am failing miserably in my task here. dealing with lots of weird network behaviour from different frameworks. so, i think manual test is only way to go for now. i will keep plugging away on this anyway as i want to get it working. if i come up with something reliable over weekend i will let you know!

  14. michaelhixson commented on Jun 3, 2022

    @michaelhixson
    Contributor

    @billywhizz ok no problem! Thanks for looking into it.

  15. billywhizz commented on Jun 5, 2022

    @billywhizz
    Contributor

    @michaelhixson @nbrady-techempower
    i have finally got this proxy tool working to verify the postgres pipelining. it's checked into my fork here. i can do a PR if you like or you can just clone from my repo for now and give it a whirl.

    to run, just add "--proxy on" to the command line arguments of the test when doing the verification run.

    e.g. for a verification of a single framework with all tests

    ./tfb --mode verify --test just --proxy on
    

    or for a single test

    ./tfb --mode verify --test just --proxy on --type db
    

    you should get output at the end of the test like this
    Screenshot from 2022-06-05 06-25-40

    the results tell you the total number of Query, Bind, Exec and Sync commands for each database connection and the "Miss" field in results tells you number of Exec commands that were not directly followed by a Sync command. The status will display "ok" in green if no Sync commands were missed and if total number of Sync commands is greater than or equal to total number of Exec commands, otherwise you will see "fail" in red.

    The proxy code is a bit of a mess as i just hacked on it until i got it working. I'll have a look in coming days to see if i can clean it up some, but i have tested against top 20 or so frameworks without any errors. I'll do a run through them all here later on Sunday and will collate what I find and post it up here.

    Hopefully it's useful and saves you some time and, if you merge it, it might also be useful for framework maintainers so they can do this verification themselves before submitting PRs.

  16. 22 remaining items

  17. billywhizz commented on Jun 11, 2022

    @billywhizz
    Contributor
  18. billywhizz commented on Jun 15, 2022

    @billywhizz
    Contributor

    @nbrady-techempower @michaelhixson

    any update on the plan for next round? as far as i understood further changes and updates were not allowed while testing was continuing, but it seems multiple frameworks have recently had minor tweaks and changes merged.
    https://github.com/TechEmpower/FrameworkBenchmarks/pulls?q=is%3Apr+is%3Aclosed
    Screenshot from 2022-06-15 21-19-07

    hmm. it seems these are all automated dependabot updates to dependencies. should these not be turned off while testing/verification for next round is ongoing?

  19. billywhizz commented on Jun 16, 2022

    @billywhizz
    Contributor

    @nbrady-techempower @michaelhixson

    these automated dependabot updates also raise another issue. currently, as far as i understand, i am required to release a framework pinned to specific releases of any dependencies and submit a PR when i want to upgrade those dependencies, but these frameworks get automatically updated by dependabot. this doesn't seem right/fair no? i would like to be able to do same with just-js where the dependencies could be updated with submitting a PR - is this acceptable?

  20. NateBrady23 commented on Jun 16, 2022

    @NateBrady23
    Member

    @billywhizz Dependabot updates are not for simple version bumps; they're only for vulnerabilities. In fact, I merge almost all dependabot updates in even if the framework doesn't pass, because I don't want vulnerable representations in the repository that somebody might copy to start a project. Hopefully that helps clear that up.

  21. billywhizz commented on Jun 16, 2022

    @billywhizz
    Contributor

    thats' fine @nbrady-techempower. thanks for clearing up - sorry for bugging you!

  22. NateBrady23 commented on Jun 16, 2022

    @NateBrady23
    Member

    No worries! Thanks for your patience while we get this new round out with the new team!

  23. billywhizz commented on Jun 16, 2022

    @billywhizz
    Contributor

    if you need me to do any further testing here let me know. i have got my proxy tool into a reasonable state now but still so many edge cases in framework behaviour it doesn't handle easily so not sure is worth a PR right now. but i'm happy to test things one by one here if you need an extra pair of hands.

  24. NateBrady23 commented on Jun 27, 2022

    @NateBrady23
    Member

    @billywhizz I don't want to burden you, but if you have the chance to do another round of testing with your tool, that'd be great! I'd like to start the round 21 official run by Wednesday and just want to make sure we caught everything. Might not be able to get around to testing myself for a couple of days.

  25. billywhizz commented on Jun 30, 2022

    @billywhizz
    Contributor

    hi @nbrady-techempower. i don't have much time this week but might be able to do a run through over the weekend. from my testing so far, all the top 20 or so frameworks appear to be compliant. i.e. everything on this list is fine - i checked the update failures and they were all due to allowed behaviour we discussed previously.

  26. NateBrady23 commented on Jun 30, 2022

    @NateBrady23
    Member

    Thanks @billywhizz! I'm going to start the run today and we can always remove things from the results if they're not compliant.

  27. volyrique commented on Feb 14, 2023

    @volyrique
    Contributor

    @pavelmash FYI mORMot (mormot-postgres-raw) is breaking the rules in the database queries and updates tests - refer to the discussion here.

    P.S. Since it appears that mORMot is using libpq, I can be more specific - there must be a call to PQpipelineSync() after every single query in the pipeline.

  28. pavelmash commented on Feb 15, 2023

    @pavelmash
    Contributor

    Thanks @volyrique - actually I miss what a note about Sync is added into General test requirement #7 on Mar 8, 2022. mormot-postgres-raw pipelining implementation will be fixed ASAP

  29. pavelmash commented on Feb 16, 2023

    @pavelmash
    Contributor

    mormot test for PG pipelining now uses Bind->Exec->Sync as required by General Rule 7 - see #7926. Thanks again for pointing.

  30. NateBrady23 commented on Mar 24, 2026

    @NateBrady23
    Member

    Closing as part of bulk cleanup.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions