Comments (17)
Thanks for asking. I plan to start it sometime next week. But I could be
preempted by other things. :)
On Wed, Mar 18, 2015 at 8:06 AM, Walter Schulze [email protected]
wrote:
May I ask what the plan is over here?
Line 142 in 9c4157f
// TODO(zhaoq): optimize to reduce memory alloc and copying.—
Reply to this email directly or view it on GitHub
#124.
from grpc-go.
What do you plan to do?
With github.com/gogo/protobuf I generate a Size, Marshal and Marshalto method.
The Marshal method calls Size and then allocates a byte slice of that size.
Then it pass that to MarshalTo which fills in the byte slice.
This way there is only one alloc per message.
Given a big enough pre allocated buffer it would be easy to reuse the buffer with Marshalto.
And Marshalto could even be changed to a MarshalZeroTo which does the same job as Marshalto, but with less copying.
My experience is that golang/protobuf does not really want to generate code, but wants to do almost everything with reflect and unsafe pointer. This is definitely slower, but I understand that it is less code to maintain.
So what I want to know is what you plan to do here and if you golang/protobuf is still not generating code (things might have changed), how can I still get the maximum speed out by leveraging gogoprotobuf's generated code?
If you just call Marshal then atleast I just do one alloc.
But there is so much speed to gain here, since writing the buffer does a copy anyway thus it is really easy to reuse a big buffer.
For example
https://github.com/gogo/protobuf/blob/master/io/varint.go
I could make this even faster by not having any copying instructions in MarshalTo
grpc looks great and I would really love to use it, but speed is very important.
I would like to be prepared for any changes I can make to gogoprotobuf to still gain the maximum amount of speed.
I really don't want to make another fork.
So maybe there is someway we could work together?
I have grpc code generation merged into gogoprotobuf on the proto3 branch if you are at all interested.
from grpc-go.
The good news is that I am making a change so that it will be very easy to
support various codecs for grpc-go because essentially grpc is independent
of IDL and codec. Once it is done, it will be very easy to use your own
codec (gogoprotobuf) to try out grpc.
The plan for protobuf is to minimize memory alloc/dealloc and copying in
grpc. For example, proto.Buffer (
https://github.com/golang/protobuf/blob/1e73516e50e04b41a6760c856eee86b00a384526/proto/lib.go#L250)
would be among the first things I will try on.
On Thu, Mar 19, 2015 at 12:53 AM, Walter Schulze [email protected]
wrote:
What do you plan to do?
With github.com/gogo/protobuf I generate a Size, Marshal and Marshalto
method.
The Marshal method calls Size and then allocates a byte slice of that size.
Then it pass that to MarshalTo which fills in the byte slice.
This way there is only one alloc per message.Given a big enough pre allocated buffer it would be easy to reuse the
buffer with Marshalto.
And Marshalto could even be changed to a MarshalZeroTo which does the same
job as Marshalto, but with less copying.My experience is that golang/protobuf does not really want to generate
code, but wants to do almost everything with reflect and unsafe pointer.
This is definitely slower, but I understand that it is less code to
maintain.So what I want to know is what you plan to do here and if you
golang/protobuf is still not generating code (things might have changed),
how can I still get the maximum speed out by leveraging gogoprotobuf's
generated code?If you just call Marshal then atleast I just do one alloc.
But there is so much speed to gain here, since writing the buffer does a
copy anyway thus it is really easy to reuse a big buffer.
For example
https://github.com/gogo/protobuf/blob/master/io/varint.go
I could make this even faster by not having any copying instructions in
MarshalTogrpc looks great and I would really love to use it, but speed is very
important.
I would like to be prepared for any changes I can make to gogoprotobuf to
still gain the maximum amount of speed.
I really don't want to make another fork.
So maybe there is someway we could work together?I have grpc code generation merged into gogoprotobuf on the proto3 branch
if you are at all interested.—
Reply to this email directly or view it on GitHub
#124 (comment).
from grpc-go.
That is great news about being IDL and codec independent.
I could also use that in totally different project I am working on :)
Could you tell me when you are ready so I can test your change?
Thank you very much.
from grpc-go.
On Thu, Mar 19, 2015 at 1:31 AM, Walter Schulze [email protected]
wrote:
That is great news about being IDL and codec independent.
I could also use that in totally different project I am working on :)
Could you tell me when you are ready so I can test your change?It should be within next week.
Thank you very much.
—
Reply to this email directly or view it on GitHub
#124 (comment).
from grpc-go.
awesome :)
On 19 March 2015 at 19:54, Qi Zhao [email protected] wrote:
On Thu, Mar 19, 2015 at 1:31 AM, Walter Schulze [email protected]
wrote:That is great news about being IDL and codec independent.
I could also use that in totally different project I am working on :)
Could you tell me when you are ready so I can test your change?It should be within next week.
Thank you very much.
—
Reply to this email directly or view it on GitHub
#124 (comment).—
Reply to this email directly or view it on GitHub
#124 (comment).
from grpc-go.
Hi Walter,
I just checked in #146 to allow custom codec working with grpc-go. For now, we allow a custom codec by doing the following:
i) implement your custom codec satisfying https://github.com/grpc/grpc-go/blob/master/rpc_util.go#L53;
ii) on client side, conn, err := grpc.Dial(serverAddr, grpc.WithCodec(yourCodec))
iii) on server side, server := grpc.NewServer(grpc.CustomCodec(yourCodec))
Feel free to ping us if there is any problem.
from grpc-go.
This looks great :) I can't wait to start playing this.
Thank you very much.
from grpc-go.
I am not clear how you will proceed. Just be aware of that the grpc server
does unmarshaling inside the generated code (e.g.,
https://github.com/grpc/grpc-go/blob/master/test/grpc_testing/test.pb.go#L544)
for unary rpc. You probably need to treat it properly depending on your
approach.
On Thu, Apr 2, 2015 at 1:21 AM, Walter Schulze [email protected]
wrote:
This looks great :) I can't wait to start playing this.
Thank you very much.—
Reply to this email directly or view it on GitHub
#124 (comment).
from grpc-go.
That is fine my fork generates code with the correct import :)
But thank you for the heads up.
On 2 April 2015 at 21:36, Qi Zhao [email protected] wrote:
I am not clear how you will proceed. Just be aware of that the grpc server
does unmarshaling inside the generated code (e.g.,https://github.com/grpc/grpc-go/blob/master/test/grpc_testing/test.pb.go#L544
)
for unary rpc. You probably need to treat it properly depending on your
approach.On Thu, Apr 2, 2015 at 1:21 AM, Walter Schulze [email protected]
wrote:This looks great :) I can't wait to start playing this.
Thank you very much.—
Reply to this email directly or view it on GitHub
#124 (comment).—
Reply to this email directly or view it on GitHub
#124 (comment).
from grpc-go.
For when you get back from holiday
I have finally created a repo for the grpc benchmarks and some simple tests.
https://github.com/gogo/grpctests
I don't think I am doing it exactly right I get quite a few log messages,
for example:
"failed to write status: connection error: desc = "transport: use of closed
network connection""
"http2Client.notifyError got notified that the client transport was broken
EOF"
These are the important files, could you please take a look:
https://github.com/gogo/grpctests/blob/master/bench/bench_test.go
https://github.com/gogo/grpctests/blob/master/simple/grpc_test.go
Thank you again and enjoy your holiday
On 7 April 2015 at 11:57, Walter Schulze [email protected] wrote:
That is fine my fork generates code with the correct import :)
But thank you for the heads up.On 2 April 2015 at 21:36, Qi Zhao [email protected] wrote:
I am not clear how you will proceed. Just be aware of that the grpc server
does unmarshaling inside the generated code (e.g.,https://github.com/grpc/grpc-go/blob/master/test/grpc_testing/test.pb.go#L544
)
for unary rpc. You probably need to treat it properly depending on your
approach.On Thu, Apr 2, 2015 at 1:21 AM, Walter Schulze [email protected]
wrote:This looks great :) I can't wait to start playing this.
Thank you very much.—
Reply to this email directly or view it on GitHub
#124 (comment).—
Reply to this email directly or view it on GitHub
#124 (comment).
from grpc-go.
Do you still have problems running the test and benchmark here? Do you want me to try out?
from grpc-go.
I ran go get -u google.golang.org/grpc again
and then ran my tests and benchmarks again.
I still see the same problems.
I would really appreciate it if you could take a look.
from grpc-go.
I was wondering if you have had any time to check those benchmarks out?
from grpc-go.
On Sat, May 9, 2015 at 12:25 AM, Walter Schulze [email protected]
wrote:
I was wondering if you have had any time to check those benchmarks out?
nah, planned to do this week but got sick ...
—
Reply to this email directly or view it on GitHub
#124 (comment).
from grpc-go.
join the club :)
from grpc-go.
get well soon
from grpc-go.
Related Issues (20)
- Flaky test: 6/100K: Test/LRSClient HOT 2
- Docs: Document how to migrate from `Dial, DialContext, WithBlock, WithReturnConnectionError, FailOnNonTempDialError` to `NewClient` HOT 3
- Stop supporting 3 releases of Go HOT 4
- <invalid gRPC request method "PRI">, when happend grpc and http use sample port HOT 2
- It seems that there is a memory leak issue in the HandleStreams function. HOT 13
- When the client receives the "too many pings" error log, how to get the server's target or remoteIP information? HOT 4
- Improve the xDS bootstrap package HOT 2
- xds/bootstrap: `client_features` should be set completely by the client implementation HOT 1
- License File seems to be missing the name of copyright owner HOT 2
- Why is the service config passed as a JSON-String just to get converterted to a struct anyway? HOT 7
- Cardinality violations should use error code “unimplemented” HOT 4
- GitHub Action: branch protection checks are skipped, and also not blocking merges HOT 3
- grpc.NewClient with namedpipe on Windows throws resolverError HOT 2
- User agent becomes grpc-go/1.64. on server side of grpc gateway HOT 3
- xds: move functionality from `xds/internal` to `internal/xds`
- stubserver: add support to optionally pass in a `grpc.Server` or `xds.GRPCServer` HOT 2
- Github Action: Codecov action is broken and is failing silently HOT 1
- Upgrade to using math/rand/v2 to get perf enhancements HOT 2
- xds: tests shouldn't rely on the presence of an entry in the `authorities` field of the bootstrap configuration with an empty key
- Experimental API related to metadata HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grpc-go.