Skip to content

Recommendation about concurrent calls to AsyncMysqlConnection queryf doesn't apply #908

Open
@lexidor

Description

@lexidor

Please complete the information below:

Where is the problem?

We strongly recommend using multiple calls to `queryf()` instead
as it escapes parameters; multiple queries can be
executed simultaneously by combining `queryf()` with `HH\Asio\v()`.

What is the problem?

You can't multiplex queries, so Asio\v() will almost always throw an InvalidArgumentException about the connection being busy.

Question

What is the recommended pattern here? More mysql connections only work if you don't rely on a transaction. If you do, you must execute all queries on one connection. Multiple sequential queries using an AsyncQueue incurs many round-trips between your webserver and SQL server. Multiple sequential queries using an AsyncQueue is currently the way I do things. However, calling a query method (effectively) sequentially does mean that you pay for "the roundtrip time times the query count" to your database in walltime.


Please don't change anything below this point.


  • Build ID: HHVM=HHVM-4.68.0:HSL=v4.41.0:2020-08-17T20:16:46+0000:7af74eee111304c3c25319df9d95501d92a64697
  • Page requested: /hack/reference/class/AsyncMysqlConnection/multiQuery/
  • Page requested at: Thu, 27 Aug 2020 23:31:48 +0000
  • Controller: APIMethodPageController

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions