Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: fix addicting net thread on sending responses to one state #712

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

shaitan
Copy link
Member

@shaitan shaitan commented Jul 20, 2016

If there are a lot of small responses which should be sent to some state with good connection, e.g. iterator generates such responses, net thread can get into cycle of sending these responses and will not send responses to other states until cycle is done. If responses is rather small, the cycle will be done only when all responses are sent.

I've added break to this cycle if a response is fully sent, so net thread will switch to another state for sending response to it.

If there are a lot of small responses which should be sent to some state with good connection, e.g. iterator generates such responses, net thread can get into cycle of sending these responses and will not send responses to other states until cycle is done. If responses is rather small, the cycle will be done only when all responses are sent.

I've added break to this cycle if a response is fully sent, so net thread will switch to another state for sending response to it.
@bioothod
Copy link
Member

Should this problem be handled by having more network threads?

This patch forces elliptics to go to kernel, to reschedule process and so on - just to send a single packet. And if there are multiple packets in the queue, this will require multiple epoll schedule roundtrip.

@shaitan
Copy link
Member Author

shaitan commented Jul 20, 2016

Should this problem be handled by having more network threads?

only if each state including accepter will have separate thread otherwise iteration spams one net thread, so it stops serving other states.

@shaitan
Copy link
Member Author

shaitan commented Jul 20, 2016

We could add some limit on number of responses sent in a row to one state, so instead of breaking after each response it will break only if quite a lot of responses are sent to some state. But I think we should proceed from reality and measure how it affects to iteration because other commands doesn't produce such number of small responses.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants