翻译以下片段,点击在线翻译
翻译以下片段,点击在线翻译
|
== Command pipelining |
|
|
|
In some use cases, command pipelining can improve database access performance. |
|
|
|
You can configure the client to use pipelining |
|
|
|
[source,java] |
|
---- |
|
MySQLPool pool = MySQLPool.pool(vertx, connectOptions.setPipeliningLimit(16), poolOptions); |
|
---- |
|
|
|
The default pipelining limit is `1` which disables pipelining. |
|
|
|
== Pool versus pooled client |
|
|
|
The `link:../../apidocs/io/vertx/mysqlclient/MySQLPool.html[MySQLPool]` allows you to create a pool or a pooled client |
|
|
|
[source,java] |
|
---- |
|
connectOptions.setPipeliningLimit(64); |
|
SqlClient client = MySQLPool.client(vertx, connectOptions, poolOptions); |
|
|
|
// Pipelined |
|
Future<RowSet<Row>> res1 = client.query(sql).execute(); |
|
|
|
// Connection pool |
|
MySQLPool pool = MySQLPool.pool(vertx, connectOptions, poolOptions); |
|
|
|
// Not pipelined |
|
Future<RowSet<Row>> res2 = pool.query(sql).execute(); |
|
---- |
|
|
|
- 连接池操作并非流水线操作(pipelined),只有从连接池中获取的连接是流水线操作 |
|
- 池化的客户端操作是流水线操作,您无法从池化的客户端获取连接 |
翻译以下片段,点击在线翻译
|
In order to gain best performance on the wire, we execute the batch in pipelining mode which means the execution request is sent before the response of previous request returns, if your server or proxy does not support this feature or you might not be interested in it, you can use the single execution API and compose them by yourself instead. |