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

Jobs slowed down by RPC read loop #1654

Open
rowlap opened this issue Feb 16, 2022 · 0 comments
Open

Jobs slowed down by RPC read loop #1654

rowlap opened this issue Feb 16, 2022 · 0 comments

Comments

@rowlap
Copy link

rowlap commented Feb 16, 2022

In rpc.transport.Transport.Recv the critical inner loop is

  • read up to 4096 bytes from the socket
  • scan for LUXI_EOM
  • break / return when any complete message is received

Problem 1

4096 bytes is rather small, and has been there since the beginning.

The number of loop iterations would be vastly reduced for a modest increase in read size. On my Linux box, net.core.wmem_default=212992 is the most data which could be sitting in the socket buffer waiting to be read.

Problem 2

When we scan self._buffer for LUXI_EOM, we're checking data which has already been checked.

new_msgs = (self._buffer + data).split(constants.LUXI_EOM)

We can assert that self._buffer does not contain LUXI_EOM, yet the whole string is re-scanned each time.

For reasons, my config.data file has grown to over 4MB, taking 1000 loops just to receive the result of each readConfig call, of which there are several from each INSTANCE_STARTUP job. It appears from profiling that most of the time is spent in Recv().

There is also a good amount of code duplication in FdTransport which might also benefit from any performance improvements.

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

No branches or pull requests

1 participant