-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
Severe performance regression when using ServeHTTP #586
Comments
@bradfitz any progress on this? |
No, I've been busy with Go 1.7 stuff for the May 1st freeze. Hopefully I can spend a bit of time on this soon, but then I'm out for a month starting in a couple weeks. |
@bradfitz is there some way in which we could help? :) |
Sure. Look at the http2 code and find ways to improve it, while not hurting readability or maintainability. |
Any pointers as to how to start? Is there any particular test you pprof to find bottlenecks? :) |
Honestly I forget. That code was mostly written for correctness and not performance. There's probably a lot of low-hanging fruit in there but there might not even be enough benchmarks yet to start using pprof & friends. You'd probably have to write at least a few new ones. |
@iamqizhao this is a serious issue - can we include it for GA? |
@tamird Sorry. We are approaching GA very closely and so far this is treated as an experimental effort and we do not expect the real usage for this feature at the current stage. This is in Brad's plate and I am going to talk to him after GA to see how to make progress on this. |
This is still a major inconvenience for us. I've updated the performance numbers at https://github.com/cockroachdb/rpc-bench; the relevant ones are:
So ServeHTTP's throughput is 50%-70% lower than Serve's, and its latency is 60%-350% higher. |
@tamird, the grpc-go team is undergoing a changing of the guard at the moment so this isn't much of a priority. And I don't officially work on grpc-go. It's not surprising that ServeHTTP is slower considering it's shoehorned into the existing ServerTransport interface somewhat awkwardly. I started working on a new design for all of grpc-go in https://github.com/bradfitz/grpc-go but it's not ready yet for wider discussion or testing. It was mostly a proof of concept. But it's something I intend to get back to. @philips et al at CoreOS are also interested. |
Is there any update on this? |
@menghanl would you be able to take a look? |
@dfawley this is the bug I mentioned in person at CoreOS Fest. Would be fantastic if we could reach serving parity on the |
I agree, but unfortunately we won't have any time to spend on this for at least another quarter. It will be a pretty sizable effort. It's possible we may get some contributions for this before then, but I wouldn't want to set any expectations at this point. |
Now that one quarter has passed, any chance to make any progress on this? |
@mwitkow, @tamird, @glerchundi, I have been poking at this periodically and learning more about it since June. The goal of throwing away the grpc http2 server and using Re: @bradfitz's comment:
I agree this is an awkward fit: the handler-based transport is mimicking a full transport for each RPC. As we continue to dig in and clean up some of the code and interfaces between the grpc layer and the transport layer (e.g.s #1745, #1854), it could happen that the handler-based transport becomes a more natural fit, and performance may be improved as a result if that is a factor in its performance differences. |
Is this performance still an issue given the use of I'm weighing on whether we should wrap gRPC's server with |
@tamird is this still an issue for you guys? |
I don't work on CockroachDB anymore, but it should be trivial for you to replicate my results using rpc-bench. I can post new results on Monday if you'd like. Has any work been done in this area? I haven't seen any mention. |
This was carried over from some ancient grpc-gateway example code[1]; and we're not exposing the GRPC API that way right now. Using (*grpc.Server).ServeHTTP has some issues: 1. it's known to be slow, very slow[2] 2. it's seems to be not working with go-grpc >= 1.19 [3] Furthermore, we're exposing the proper GRPC server (the native go-grpc one) on a different port. If decide to (finally!) expose our GRPC API, that's the thing we should expose. So, since we don't need this multiplexing business, we shouldn't keep the code around. This is the cleanup. [1]: https://github.com/philips/grpc-gateway-example/ [2]: grpc/grpc-go#586 [3]: soheilhy/cmux#64 (comment) Signed-off-by: Stephan Renatus <srenatus@chef.io>
This was carried over from some ancient grpc-gateway example code[1]; and we're not exposing the GRPC API that way right now. Using (*grpc.Server).ServeHTTP has some issues: 1. it's known to be slow, very slow[2] 2. it's seems to be not working with go-grpc >= 1.19 [3] Furthermore, we're exposing the proper GRPC server (the native go-grpc one) on a different port. If decide to (finally!) expose our GRPC API, that's the thing we should expose. So, since we don't need this multiplexing business, we shouldn't keep the code around. This is the cleanup. [1]: https://github.com/philips/grpc-gateway-example/ [2]: grpc/grpc-go#586 [3]: soheilhy/cmux#64 (comment) Signed-off-by: Stephan Renatus <srenatus@chef.io>
* automate-gateway: cleanup GRPC/HTTP multiplexing cruft This was carried over from some ancient grpc-gateway example code[1]; and we're not exposing the GRPC API that way right now. Using (*grpc.Server).ServeHTTP has some issues: 1. it's known to be slow, very slow[2] 2. it's seems to be not working with go-grpc >= 1.19 [3] Furthermore, we're exposing the proper GRPC server (the native go-grpc one) on a different port. If decide to (finally!) expose our GRPC API, that's the thing we should expose. So, since we don't need this multiplexing business, we shouldn't keep the code around. This is the cleanup. [1]: https://github.com/philips/grpc-gateway-example/ [2]: grpc/grpc-go#586 [3]: soheilhy/cmux#64 (comment) * [integration] automate-gateway: fix tests to use GRPC port So apparently these HAD used the multiplexing code I've deleted. Well, they don't have to. Changed the hardcoded port to automate-gateway's default grpc port. Signed-off-by: Stephan Renatus <srenatus@chef.io>
This issue is labeled as requiring an update from the reporter, and no update has been received after 7 days. If no update is provided in the next 7 days, this issue will be automatically closed. |
I hacked around and got the rpc-tests working and using the standard lib http2 (instead of the x/net/http2. Current results for GRPC Server vs GRPC ServeHTTP:
The ProtoRPC benchmarks aren't running, but I'm not that fussed about those. |
This implies the results are still in the sme ballpark as the previous runs (grpc 1.27.1, go 1.13). For me the overhead is worth being able to run on regular mux , single port, without cmux (which gets confusing fast). But clearly it can be improved. |
@tcolgate I could never get the benchmarks to run. Admittedly, I didn't spend a ton of time on it. If you create a repo with working benchmarks, I wouldn't mind taking a crack at it as well or helping. |
Uploaded here: https://github.com/tcolgate/rpc-bench |
Closing due to lack of activity and priority. |
Extracting from discussion in #549. See https://github.com/cockroachdb/rpc-bench; relevant parts as of this writing:
The text was updated successfully, but these errors were encountered: