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

Any better solutions for http request #2224

Closed
2 tasks
haiyang1985 opened this issue Aug 9, 2018 · 4 comments
Closed
2 tasks

Any better solutions for http request #2224

haiyang1985 opened this issue Aug 9, 2018 · 4 comments

Comments

@haiyang1985
Copy link
Member

haiyang1985 commented Aug 9, 2018

  • I have searched the issues of this repository and believe that this is not a duplicate.
  • I have checked the FAQ of this repository and believe that this is not a duplicate.

Environment

  • Dubbo version: xxx
  • Operating System version: xxx
  • Java version: xxx

Http Request Solutions

We are going to export dubbo service for front-end request(eg: h5 outside). We are doubt about the advantage and disadvantage of below two solutions, anyone have good ideas for that?

Generally, there are two ways to support that.
Solution1: Add proxy(through GenericService) for the http request (http -> proxy -> dubbo)
Solution2: Support dubbo & http protocol in service side (eg: dubbox/jsonrpc).

For Solution1:

Advantage:

  1. It's easy for the user, no need to maintain both http & dubbo protocols.
  2. No need to maintain two types of configurations (one for dubbo, another for http). Following two conditions may confuse the user. Firstly, xxx config support for dubbo and http, but they are in different key. Secondly, yyy config is supported in dubbo, not for http. User maybe confused on so much of the configs.

Disadvantage:

  1. The latency is high for the proxy mode.
    For dubbo protocol: 1k request/100k response/3000QPS, average response is 1-2ms, and able to support 7000-8000QPS in 8Core server.
    For the proxy mode: 1K request/100K response/600QPS, the average response is 14ms, only with 600QPS.
  2. The proxy CPU is very high.
    For dubbo protocol: With 7000-8000QPS, the service CPU is about 80-90%, with 600QPS, the service CPU below 5-10% maybe.
    For proxy mode: With 600QPS, service CPU is low, but the proxy's CPU is almost full (80-90%). That means, it need 4-5times of the server to host the request.

For Solution2:

Advantage:

  1. The latency is very low, as it's directly connect to the service.

Disadvantage:

  1. User have to maintain both dubbo & http protocol, as described in solution 1 .

We are confused to find a better solution. Am i in a wrong way, or anyone have good suggestions or solutions for http request?

Thanks for any suggestions.

@kimmking
Copy link
Member

Rest via HTTP is not a high perfermance protocol in RPC domain.

  1. If you wanna add some biz logic above dubbo-service, proxy layer is a good choice.
  2. If you throw returnValue of service method directly, then rest protocol +filter is a nice way.
  3. For perfermance, think about mutil-level cache strategy, multiple providers loadbalance, etc.

@haiyang1985
Copy link
Member Author

Thanks!
Is there any existing products for rest protocol + filter solution?

@kimmking
Copy link
Member

dubbox with its samples

@haiyang1985
Copy link
Member Author

Not sure whether I've got your points of rest protocol+filter way. I've generally looked at the dubbox these days, please help me to confirm on whether dubbox is the rest protocol+filter way? And this is the samples as you said https://blog.csdn.net/nmyphp/article/details/79174225?

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

No branches or pull requests

2 participants