How to fix problem with max connections exceed?How do I efficiently iterate over each entry in a Java Map?How do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How can I create an executable JAR with dependencies using Maven?How do I determine whether an array contains a particular value in Java?How do I convert a String to an int in Java?How do I fix android.os.NetworkOnMainThreadException?How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor versionHow to wait till Aerospike AsyncClient complete all transaction?
Does Nightpack Ambusher's second ability trigger if I cast spells during the end step?
What is the farthest a camera can see?
Help, I cannot decide when to start the story
Symbol: Put a smile symbol under a plus
Are employers legally allowed to pay employees in goods and services equal to or greater than the minimum wage?
Why are Tucker and Malcolm not dead?
In which case does the Security misconfiguration vulnerability apply to?
Heating Margarine in Pan = loss of calories?
What is the status of this patent?
How can I see if the data in a SQL Server table is page-compressed?
What would it take to get a message to another star?
Boss asked a co-worker to assault me
What is the difference between 王 and 皇?
Why command hierarchy, if the chain of command is standing next to each other?
Website error: "Walmart can’t use this browser"
The cat exchanges places with a drawing of the cat
How do you deal with the emotions of not being the one to find the cause of a bug?
Weird resistor with dots around it
Are there any other rule mechanics that could grant Thieves' Cant?
How is являться different from есть and быть
How can I communicate my issues with a potential date's pushy behavior?
How would you translate this? バタコチーズライス
How to "add" units to results of pgfmathsetmacro?
Simplification of numbers
How to fix problem with max connections exceed?
How do I efficiently iterate over each entry in a Java Map?How do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?How do I generate random integers within a specific range in Java?How can I create an executable JAR with dependencies using Maven?How do I determine whether an array contains a particular value in Java?How do I convert a String to an int in Java?How do I fix android.os.NetworkOnMainThreadException?How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor versionHow to wait till Aerospike AsyncClient complete all transaction?
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I executing Lua-function in async mode and I use NIOEventLoops. When I try getting the next event loop and execute Lua-function I have some exception:
com.aerospike.client.AerospikeException$Connection: Error -7 from BB967EF43270008 127.0.0.1 3000: Node BB967EF43270008 127.0.0.1 3000 event loop 5 max connections 100 would be exceeded.
at com.aerospike.client.cluster.Node.getAsyncConnection(Node.java:657) ~[aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.executeCommand(NioCommand.java:184) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.run(NioCommand.java:146) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.registerCommands(NioEventLoop.java:211) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.runCommands(NioEventLoop.java:173) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.run(NioEventLoop.java:156) [aerospike-client-4.2.2.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
That is my method for getting the next event loop:
private synchronized EventLoop getNextEventLoop()
EventLoop next;
do
next = eventLoops.next();
while (next.getProcessSize() >= maxConnectionsPerEventLoop);
return next;
That is how I executing my Lua-function:
as.execute(getNextEventLoop()
, new ExecuteListener()
@Override
public void onSuccess(Key key, Object obj)
...
@Override
public void onFailure(AerospikeException exception)
...
, writePolicy
, key
, "lua-pack"
, "funcName"
, Value.get(binName), Value.get(value)
);
How can I avoid this exception?
java aerospike
add a comment |
I executing Lua-function in async mode and I use NIOEventLoops. When I try getting the next event loop and execute Lua-function I have some exception:
com.aerospike.client.AerospikeException$Connection: Error -7 from BB967EF43270008 127.0.0.1 3000: Node BB967EF43270008 127.0.0.1 3000 event loop 5 max connections 100 would be exceeded.
at com.aerospike.client.cluster.Node.getAsyncConnection(Node.java:657) ~[aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.executeCommand(NioCommand.java:184) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.run(NioCommand.java:146) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.registerCommands(NioEventLoop.java:211) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.runCommands(NioEventLoop.java:173) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.run(NioEventLoop.java:156) [aerospike-client-4.2.2.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
That is my method for getting the next event loop:
private synchronized EventLoop getNextEventLoop()
EventLoop next;
do
next = eventLoops.next();
while (next.getProcessSize() >= maxConnectionsPerEventLoop);
return next;
That is how I executing my Lua-function:
as.execute(getNextEventLoop()
, new ExecuteListener()
@Override
public void onSuccess(Key key, Object obj)
...
@Override
public void onFailure(AerospikeException exception)
...
, writePolicy
, key
, "lua-pack"
, "funcName"
, Value.get(binName), Value.get(value)
);
How can I avoid this exception?
java aerospike
add a comment |
I executing Lua-function in async mode and I use NIOEventLoops. When I try getting the next event loop and execute Lua-function I have some exception:
com.aerospike.client.AerospikeException$Connection: Error -7 from BB967EF43270008 127.0.0.1 3000: Node BB967EF43270008 127.0.0.1 3000 event loop 5 max connections 100 would be exceeded.
at com.aerospike.client.cluster.Node.getAsyncConnection(Node.java:657) ~[aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.executeCommand(NioCommand.java:184) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.run(NioCommand.java:146) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.registerCommands(NioEventLoop.java:211) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.runCommands(NioEventLoop.java:173) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.run(NioEventLoop.java:156) [aerospike-client-4.2.2.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
That is my method for getting the next event loop:
private synchronized EventLoop getNextEventLoop()
EventLoop next;
do
next = eventLoops.next();
while (next.getProcessSize() >= maxConnectionsPerEventLoop);
return next;
That is how I executing my Lua-function:
as.execute(getNextEventLoop()
, new ExecuteListener()
@Override
public void onSuccess(Key key, Object obj)
...
@Override
public void onFailure(AerospikeException exception)
...
, writePolicy
, key
, "lua-pack"
, "funcName"
, Value.get(binName), Value.get(value)
);
How can I avoid this exception?
java aerospike
I executing Lua-function in async mode and I use NIOEventLoops. When I try getting the next event loop and execute Lua-function I have some exception:
com.aerospike.client.AerospikeException$Connection: Error -7 from BB967EF43270008 127.0.0.1 3000: Node BB967EF43270008 127.0.0.1 3000 event loop 5 max connections 100 would be exceeded.
at com.aerospike.client.cluster.Node.getAsyncConnection(Node.java:657) ~[aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.executeCommand(NioCommand.java:184) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioCommand.run(NioCommand.java:146) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.registerCommands(NioEventLoop.java:211) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.runCommands(NioEventLoop.java:173) [aerospike-client-4.2.2.jar:?]
at com.aerospike.client.async.NioEventLoop.run(NioEventLoop.java:156) [aerospike-client-4.2.2.jar:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_181]
That is my method for getting the next event loop:
private synchronized EventLoop getNextEventLoop()
EventLoop next;
do
next = eventLoops.next();
while (next.getProcessSize() >= maxConnectionsPerEventLoop);
return next;
That is how I executing my Lua-function:
as.execute(getNextEventLoop()
, new ExecuteListener()
@Override
public void onSuccess(Key key, Object obj)
...
@Override
public void onFailure(AerospikeException exception)
...
, writePolicy
, key
, "lua-pack"
, "funcName"
, Value.get(binName), Value.get(value)
);
How can I avoid this exception?
java aerospike
java aerospike
asked Mar 27 at 10:13
JohnJohn
10610 bronze badges
10610 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You are hitting the ClientPolicy.maxConnsPerNode
limit. For 500 maxConnsPerNode
and 5 event loops, each event loop can use max 100 (500/5) connections for each node. I assume your maxConnectionsPerEventLoop
value is >= 100. Also, it's not guaranteed that the slot will still be available when the next command is sent to the event loop after getProcessSize()
is called.
The solution is to limit maxCommandsInProcess
on each event loop. This is the thread-safe way to limit inflight commands (and thus connections).
EventPolicy eventPolicy = new EventPolicy();
eventPolicy.maxCommandsInProcess = 100; // max 100 commands per event loop.
eventPolicy.maxCommandsInQueue = 0; // unbounded queue
int eventLoopSize = 5;
EventLoops eventLoops = new NioEventLoops(eventPolicy, eventLoopSize);
ClientPolicy clientPolicy = new ClientPolicy();
clientPolicy.eventLoops = eventLoops;
clientPolicy.maxConnsPerNode = eventPolicy.maxCommandsInProcess * eventLoopSize;
The async command queue is used for commands when maxCommandsInProcess
limit is reached. If the rate of incoming commands consistently exceeds the rate at which commands are processed, then your application can potentially run out of memory. To avoid this case, you may need to limit your queue size.
eventPolicy.maxCommandsInQueue = 10000;
If this queue size is reached, the AerospikeException.AsyncQueueFull
exception is thrown. Your application should respond by delaying commands in a non-event loop thread until eventLoop.getQueueSize()
is sufficiently low.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55374695%2fhow-to-fix-problem-with-max-connections-exceed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You are hitting the ClientPolicy.maxConnsPerNode
limit. For 500 maxConnsPerNode
and 5 event loops, each event loop can use max 100 (500/5) connections for each node. I assume your maxConnectionsPerEventLoop
value is >= 100. Also, it's not guaranteed that the slot will still be available when the next command is sent to the event loop after getProcessSize()
is called.
The solution is to limit maxCommandsInProcess
on each event loop. This is the thread-safe way to limit inflight commands (and thus connections).
EventPolicy eventPolicy = new EventPolicy();
eventPolicy.maxCommandsInProcess = 100; // max 100 commands per event loop.
eventPolicy.maxCommandsInQueue = 0; // unbounded queue
int eventLoopSize = 5;
EventLoops eventLoops = new NioEventLoops(eventPolicy, eventLoopSize);
ClientPolicy clientPolicy = new ClientPolicy();
clientPolicy.eventLoops = eventLoops;
clientPolicy.maxConnsPerNode = eventPolicy.maxCommandsInProcess * eventLoopSize;
The async command queue is used for commands when maxCommandsInProcess
limit is reached. If the rate of incoming commands consistently exceeds the rate at which commands are processed, then your application can potentially run out of memory. To avoid this case, you may need to limit your queue size.
eventPolicy.maxCommandsInQueue = 10000;
If this queue size is reached, the AerospikeException.AsyncQueueFull
exception is thrown. Your application should respond by delaying commands in a non-event loop thread until eventLoop.getQueueSize()
is sufficiently low.
add a comment |
You are hitting the ClientPolicy.maxConnsPerNode
limit. For 500 maxConnsPerNode
and 5 event loops, each event loop can use max 100 (500/5) connections for each node. I assume your maxConnectionsPerEventLoop
value is >= 100. Also, it's not guaranteed that the slot will still be available when the next command is sent to the event loop after getProcessSize()
is called.
The solution is to limit maxCommandsInProcess
on each event loop. This is the thread-safe way to limit inflight commands (and thus connections).
EventPolicy eventPolicy = new EventPolicy();
eventPolicy.maxCommandsInProcess = 100; // max 100 commands per event loop.
eventPolicy.maxCommandsInQueue = 0; // unbounded queue
int eventLoopSize = 5;
EventLoops eventLoops = new NioEventLoops(eventPolicy, eventLoopSize);
ClientPolicy clientPolicy = new ClientPolicy();
clientPolicy.eventLoops = eventLoops;
clientPolicy.maxConnsPerNode = eventPolicy.maxCommandsInProcess * eventLoopSize;
The async command queue is used for commands when maxCommandsInProcess
limit is reached. If the rate of incoming commands consistently exceeds the rate at which commands are processed, then your application can potentially run out of memory. To avoid this case, you may need to limit your queue size.
eventPolicy.maxCommandsInQueue = 10000;
If this queue size is reached, the AerospikeException.AsyncQueueFull
exception is thrown. Your application should respond by delaying commands in a non-event loop thread until eventLoop.getQueueSize()
is sufficiently low.
add a comment |
You are hitting the ClientPolicy.maxConnsPerNode
limit. For 500 maxConnsPerNode
and 5 event loops, each event loop can use max 100 (500/5) connections for each node. I assume your maxConnectionsPerEventLoop
value is >= 100. Also, it's not guaranteed that the slot will still be available when the next command is sent to the event loop after getProcessSize()
is called.
The solution is to limit maxCommandsInProcess
on each event loop. This is the thread-safe way to limit inflight commands (and thus connections).
EventPolicy eventPolicy = new EventPolicy();
eventPolicy.maxCommandsInProcess = 100; // max 100 commands per event loop.
eventPolicy.maxCommandsInQueue = 0; // unbounded queue
int eventLoopSize = 5;
EventLoops eventLoops = new NioEventLoops(eventPolicy, eventLoopSize);
ClientPolicy clientPolicy = new ClientPolicy();
clientPolicy.eventLoops = eventLoops;
clientPolicy.maxConnsPerNode = eventPolicy.maxCommandsInProcess * eventLoopSize;
The async command queue is used for commands when maxCommandsInProcess
limit is reached. If the rate of incoming commands consistently exceeds the rate at which commands are processed, then your application can potentially run out of memory. To avoid this case, you may need to limit your queue size.
eventPolicy.maxCommandsInQueue = 10000;
If this queue size is reached, the AerospikeException.AsyncQueueFull
exception is thrown. Your application should respond by delaying commands in a non-event loop thread until eventLoop.getQueueSize()
is sufficiently low.
You are hitting the ClientPolicy.maxConnsPerNode
limit. For 500 maxConnsPerNode
and 5 event loops, each event loop can use max 100 (500/5) connections for each node. I assume your maxConnectionsPerEventLoop
value is >= 100. Also, it's not guaranteed that the slot will still be available when the next command is sent to the event loop after getProcessSize()
is called.
The solution is to limit maxCommandsInProcess
on each event loop. This is the thread-safe way to limit inflight commands (and thus connections).
EventPolicy eventPolicy = new EventPolicy();
eventPolicy.maxCommandsInProcess = 100; // max 100 commands per event loop.
eventPolicy.maxCommandsInQueue = 0; // unbounded queue
int eventLoopSize = 5;
EventLoops eventLoops = new NioEventLoops(eventPolicy, eventLoopSize);
ClientPolicy clientPolicy = new ClientPolicy();
clientPolicy.eventLoops = eventLoops;
clientPolicy.maxConnsPerNode = eventPolicy.maxCommandsInProcess * eventLoopSize;
The async command queue is used for commands when maxCommandsInProcess
limit is reached. If the rate of incoming commands consistently exceeds the rate at which commands are processed, then your application can potentially run out of memory. To avoid this case, you may need to limit your queue size.
eventPolicy.maxCommandsInQueue = 10000;
If this queue size is reached, the AerospikeException.AsyncQueueFull
exception is thrown. Your application should respond by delaying commands in a non-event loop thread until eventLoop.getQueueSize()
is sufficiently low.
answered Mar 27 at 21:08
BrianBrian
1113 bronze badges
1113 bronze badges
add a comment |
add a comment |
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55374695%2fhow-to-fix-problem-with-max-connections-exceed%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown