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)
- Is it ok to call grpc.UnaryInvoker multiple times inside an interceptor? HOT 8
- Flaky Test: AllMetricsOneFunction HOT 1
- Why does connection to `localhost` fail on local ? HOT 15
- transition from TRANSIENT_FAILURE to IDLE HOT 1
- Is waitForReady required for retry policies? HOT 7
- Add godoc linter HOT 8
- How can I configure a usable gRPC-Go Retry Policy? HOT 9
- failed to install [email protected] HOT 13
- design tradeoffs about not including ctx in method argument for generated stream handler HOT 3
- google.protobuf.Empty as response serializes to not empty response depending on request headers HOT 2
- How to make server-stream run in a non-blocking state and handle other requests HOT 10
- Improve Logger Performance When Disabled HOT 5
- Flaky Test: RingHash_ReattemptWhenGoingFromTransientFailureToIdle
- xdsclient: reduce the number of ADS requests
- grpctest: minor improvements to the test logger implementation
- xdsclient: support environment variable protection for fallback
- Incorporate `mem` package into custom HTTP/2 Framer
- Examples using the `experimental` stats package HOT 3
- about grpc.NewClient,It will not check the validity of the target ? HOT 1
- Minor typos HOT 7
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.