Skip to content
This repository has been archived by the owner on Apr 16, 2020. It is now read-only.

Avoid cloning for parameter in RPC call. #184

Open
agend opened this issue Jun 6, 2019 · 7 comments
Open

Avoid cloning for parameter in RPC call. #184

agend opened this issue Jun 6, 2019 · 7 comments

Comments

@agend
Copy link

agend commented Jun 6, 2019

I'm developing distributed storage system. There is a place in code where I send multiple requests to nodes in cluster to store replicas. Now I have to clone data buffer to do this in parallel. It would be great to find approach to avoid cloning as data buffer could be significant in size.
https://github.com/qoollo/bob/blob/master/src/core/bob_client.rs#L75
buffer is immutable and something like Arc would be enough.

@olix0r
Copy link
Contributor

olix0r commented Jun 6, 2019

@agend is BobData a protobuf bytes type? Perhaps we could use the bytes crate to represent this type to facilitate shared access to the underlying memory?

@agend
Copy link
Author

agend commented Jun 6, 2019

@olix0r
Yes. https://github.com/qoollo/bob/blob/master/proto/bob.proto#L33

bytes crate looks nice for this purpose. But to chage this do we need to change https://github.com/danburkert/prost ?

@olix0r
Copy link
Contributor

olix0r commented Jun 6, 2019

@agend I think that's correct; but I imagine prost users would generally benefit from this, so we may want to propose a breaking change.

@carllerche
Copy link
Member

@danburkert wdyt? At least we could have some way to configure prost-build to use Bytes for byte fields?

@LucioFranco
Copy link
Member

FYI there is a draft PR up in prost now for bytes and bytesstring usage which may be helpful.

@danburkert
Copy link
Contributor

Yep, this has always been on the roadmap for prost, tracked in danburkert/prost#31. @nrc put up a draft PR just recently with an implementation at danburkert/prost#190, so it may be landing sooner rather than later!

@kanekv
Copy link

kanekv commented Nov 25, 2019

@danburkert just checking in, is there some work going on or it's stalled? Thanks!

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

No branches or pull requests

6 participants