Skip to content

Serialized and blocking connection #566

Open
@awerlang

Description

@awerlang

As I was verifying how a connection failure is experienced, I found the following about connections:

  • Client waits for 4-5s for each host to connect;
  • On failure, it tries the next ones, serially;
  • It blocks event loop (no await)
  • connTimeoutMs doesn't seem to work

Can this experience be improved?

Sample program and output:

import Aerospike from "aerospike";

const start = Date.now();
const client = Aerospike.client({
    "connTimeoutMs": 500,
    "hosts": "aerospike,aerospike2",
});
client.connect()
    .finally(() => {
        client.close();
    });
console.log(`Connection took ${Date.now() - start}ms`);
node@1f3bf2734242:/app$ node connect.mjs 
Jul 13 2023 17:22:54 GMT: WARN (9170) [as_pipe.c:208] [read_file] - Failed to open /proc/sys/net/core/wmem_max for reading
Jul 13 2023 17:22:54 GMT: WARN (9170) [as_pipe.c:267] [get_buffer_size] - Failed to read /proc/sys/net/core/wmem_max; should be at least 5242880. Please verify.
Jul 13 2023 17:22:54 GMT: WARN (9170) [as_pipe.c:208] [read_file] - Failed to open /proc/sys/net/core/rmem_max for reading
Jul 13 2023 17:22:54 GMT: WARN (9170) [as_pipe.c:267] [get_buffer_size] - Failed to read /proc/sys/net/core/rmem_max; should be at least 15728640. Please verify.
Jul 13 2023 17:22:58 GMT: WARN (9170) [as_cluster.c:281] [as_cluster_seed_node] - Failed to lookup aerospike1 3000. AEROSPIKE_ERR_INVALID_HOST Invalid hostname aerospike: Name or service not known
Jul 13 2023 17:23:02 GMT: WARN (9170) [as_cluster.c:281] [as_cluster_seed_node] - Failed to lookup aerospike2 3000. AEROSPIKE_ERR_INVALID_HOST Invalid hostname aerospike2: Name or service not known
Jul 13 2023 17:23:02 GMT: ERROR(9170) [command.cc:84] [ErrorCallback] - Client error in Connect command: Failed to connect [-1]
Connection took 7943 ms

node:18 container
aerospike client v5.6.0
runtime AWS Lambda

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