Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipeline mode #75

Closed
anarthal opened this issue May 13, 2022 · 1 comment · Fixed by #275
Closed

Pipeline mode #75

anarthal opened this issue May 13, 2022 · 1 comment · Fixed by #275
Labels

Comments

@anarthal
Copy link
Collaborator

Implement client-side pipelining of requests.

When executing a text query or a prepared statement, the following packet exchange occurs:

     client                                server
             ----- query request ---> 
             <-------   query OK ----
             <-------   metadata ----
             <-------   rows --------
             <-------   EOF --------- 

Currently, connection::query or prepared_statement::execute write the query request, read the OK and the metadata. Then the client needs to read all the rows until the EOF before executing another query request.

It is possible to write several of these query requests at once, in batch. Doing this, we can save round-trips. Subsequent queries won't wait until a response has been written. Note that there is no special support for this neither in the protocol nor in the server. The server will process the queries sequentially, as if they had been written one by one. If one of the queries fail, subsequent queries will be executed, regardless of the result of previous queries.

This would be the message exchange:

     client                                server
             --- query request 1 ---> 
             --- query request 2 ---> 
             <-----   query 1 OK ----
             <-----   metadata 1 ----
             <-----   rows 1 --------
             <-----   EOF 1 --------- 
             <-----   query 2 OK ----
             <-----   metadata 2 ----
             <-----   rows 2 --------
             <-----   EOF 2 --------- 

The client would still need to read the resultset yielded by query 1 completely before starting with query 2 resultset.

Implementing this pipeline mode requires an additional, lower level interface. A possible implementation for requests is a serializer object with methods such as add_query and add_statement_execution that implements request serialization, then a connection::write(serializer) method. To read responses, we can implement methods such as connection::read_resultset_metadata(resultset&) and connection::read_row(resultset&, row&).

@anarthal
Copy link
Collaborator Author

MariaDB has a bulk execution interface that may be relevant here: https://mariadb.com/kb/en/com_stmt_bulk_execute/

anarthal added a commit that referenced this issue May 8, 2024
Updated the serialization functions to take framing into account when
serializing. This is a requirement to implement #75.

close #255
anarthal added a commit that referenced this issue May 10, 2024
Fixed a potential ODR violation with `asio::coroutine` under MSVC, manifesting as sporadic test failures under release configurations.
`any_stream` has been replaced by the internal `EngineStream` concept
and the `engine` interface.
`algo_runner` has been replaced by `top_level_algo`, improving algorithm
type-erasing

This change is required by #195 and beneficial for #75
close #259
anarthal added a commit that referenced this issue Jun 8, 2024
Removed sansio_algorithm base class

close #75
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant