# Aerospike\_key\_get\_async() returned -7 - Max node/event loop async connections would be exceeded: 5

**URL:** <https://discuss.aerospike.com/t/aerospike-key-get-async-returned-7-max-node-event-loop-async-connections-would-be-exceeded-5/7750>\
**Category:** C Client Library\
**Tags:** query\
**Created:** [August 13, 2020, 1:36pm UTC](https://discuss.aerospike.com/t/aerospike-key-get-async-returned-7-max-node-event-loop-async-connections-would-be-exceeded-5/7750 "2020-08-13T13:36:02Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikrantl](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vikrantl](https://discuss.aerospike.com/u/vikrantl)\
**Post date:** [August 13, 2020, 1:36pm UTC](https://discuss.aerospike.com/t/aerospike-key-get-async-returned-7-max-node-event-loop-async-connections-would-be-exceeded-5/7750/1 "2020-08-13T13:36:02Z")

</div>

This is aerospike server on centos7 and version 4.6.0.10 the aerospike client is at 4.6.17 C lang. In the C program if I set the event loop count to 5. 10. 20 its working good. But with event loop count = 40, I get the mentioned error.

Which tunable should be checked here?

I get the last number different for different configurations, does it represent the max value which is set or the value by which the client is falling short? aerospike\_key\_get\_async() returned -7 - Max node/event loop BB9945D147AC40C async connections would be exceeded: 2

aerospike\_key\_get\_async() returned -7 - Max node/event loop BB9945D147AC40C async connections would be exceeded: 5

I am trying to execute the get\_async function from N number of threads started from the main

thank you -Vikrant

---

<div class="post-metadata">

**Author:** ![vikrantl](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vikrantl](https://discuss.aerospike.com/u/vikrantl)\
**Post date:** [August 13, 2020, 2:35pm UTC](https://discuss.aerospike.com/t/aerospike-key-get-async-returned-7-max-node-event-loop-async-connections-would-be-exceeded-5/7750/2 "2020-08-13T14:35:26Z")

</div>

as\_config.async\_max\_conns\_per\_node increasing from 300 to 500 or 1600 allows me to create more event loops

Q1. Do we have a formula to decide on the as\_config.async\_max\_conns\_per\_node as a function of number of event loops? Q2. What is the drawback of keeping a higher value for as\_config.async\_max\_conns\_per\_node? Q3. Is there any profiling tool on the client side which can tell us – used and unused connections – used and unused event loops

---

<div class="post-metadata">

**Author:** ![vikrantl](https://avatars.discourse-cdn.com/v4/letter/v/7ab992/32.png) [@vikrantl](https://discuss.aerospike.com/u/vikrantl)\
**Post date:** [August 13, 2020, 4:06pm UTC](https://discuss.aerospike.com/t/aerospike-key-get-async-returned-7-max-node-event-loop-async-connections-would-be-exceeded-5/7750/3 "2020-08-13T16:06:31Z")

</div>

More than the following formula I see that the error occur rate is proportional to the number of threads calling aerospike\_key\_get\_async concurrently

Good if we get a formula like

## async\_max\_conns\_per\_node = Constant \* number\_of\_event\_loops \* number\_of\_threads\_calling\_aerospike\_key\_get\_async\_concurrently

uint32\_t as\_config::async\_max\_conns\_per\_node

Maximum number of asynchronous (non-pipeline) connections allowed for each node. This limit will be enforced at the node/event loop level. If the value is 100 and 2 event loops are created, then each node/event loop asynchronous (non-pipeline) connection pool will have a limit of 50. Async transactions will be rejected if the limit would be exceeded. This variable is ignored if asynchronous event loops are not created.

Default: 300

---

<div class="post-metadata">

**Author:** ![Brian](https://sea1.discourse-cdn.com/flex019/user_avatar/discuss.aerospike.com/brian/32/2211_2.png) [@Brian](https://discuss.aerospike.com/u/Brian)\
**Post date:** [August 13, 2020, 8:52pm UTC](https://discuss.aerospike.com/t/aerospike-key-get-async-returned-7-max-node-event-loop-async-connections-would-be-exceeded-5/7750/4 "2020-08-13T20:52:58Z")

</div>

Async commands must be throttled. Provide your own throttle or use max\_commands\_in\_process.

Example:

```auto
as_policy_event p;
as_policy_event_init(&p);
p.max_commands_in_process = 40;
p.max_commands_in_queue = 10000;

as_error err;

if (as_create_event_loops(&err, &p, 1, NULL) == AEROSPIKE_OK) {
	return true;
}
return false;

```
