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

Memory churn in marshalling infrastructure #1364

Open
jrudolph opened this issue May 31, 2021 · 2 comments
Open

Memory churn in marshalling infrastructure #1364

jrudolph opened this issue May 31, 2021 · 2 comments
Labels

Comments

@jrudolph
Copy link
Contributor

jrudolph commented May 31, 2021

Marshallings reliance on moving data between InputStream / OutputStream leads to a lot of memory churn while supplying the intermediate buffers.

I haven't looked deeply into it yet but it seems that this is caused by having to go to some io.grpc abstractions. Do we have any idea how we could avoid that?

--- 2912446648 bytes (12.77%), 5819 samples
  [ 0] byte[]
  [ 1] akka.grpc.internal.BaseMarshaller.parse
  [ 2] akka.grpc.internal.Marshaller.parse
  [ 3] akka.grpc.internal.Marshaller.parse
  [ 4] io.grpc.MethodDescriptor.parseResponse
  [ 5] io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInternal
  [ 6] io.grpc.internal.ClientCallImpl$ClientStreamListenerImpl$1MessagesAvailable.runInContext
  [ 7] io.grpc.internal.ContextRunnable.run
  [ 8] io.grpc.internal.SerializingExecutor.run
  [ 9] akka.dispatch.TaskInvocation.run
  [10] akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec
  [11] java.util.concurrent.ForkJoinTask.doExec
  [12] java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec
  [13] java.util.concurrent.ForkJoinPool.scan
  [14] java.util.concurrent.ForkJoinPool.runWorker
  [15] java.util.concurrent.ForkJoinWorkerThread.run
@raboof raboof added the client label May 31, 2021
@lomigmegard
Copy link
Contributor

lomigmegard commented Jun 5, 2021

You mean the byte array allocated in BaseMarshaller to read from the InputStream (only API provided by io.grpc.MethodDescriptor) ? Might be linked to this PR: https://github.com/akka/akka-grpc/pull/1318/files#diff-1a02adbd4ed9c032022756fe7dbbac1e967816613c7f1adef4f3e2330136fa11L22

Actually I didn't see but there is an alternative solution in #1378 (still relying on internal buffering of the stream)

@jrudolph
Copy link
Contributor Author

jrudolph commented Jun 7, 2021

Thanks, @lomigmegard, those are relevant indeed.

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

No branches or pull requests

3 participants