You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "wangruyu1 (GitHub)" <gi...@apache.org> on 2019/01/04 09:24:46 UTC

[GitHub] [incubator-dubbo] wangruyu1 opened issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

虽然dubbo不建议大数据,但是我是测试的localhost.
用10个并发,每个并发循环访问20次(其实相当于200个并发),服务器直接返回3M字符串,不做任何处理,处理时间都需要220ms左右。
相关配置:
producer:
dubbo.service.connections = 100
dubbo.service.protocol=dubbo
consumer:
dubbo.reference.connections = 100
我的疑问:既然我走的localhost,带宽不用考虑吧,长连接设置的也是100个,每次请求使用一个长连接这处理应该会超级快啊?但是最终结果耗时还是在数据传输,200多ms.

这个问题哪位大神能解答下,很急(大数据传输无法避免,上线项目需要用到)。谢谢


[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] wangruyu1 commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "wangruyu1 (GitHub)" <gi...@apache.org>.
> Dubbo protocol use "single long tcp connection", so it is not fit to transfer file or data of large size.

我也看了文档,建议短连接。
但是我现在有个疑问。假如说我对consumer1设置共享的长连接是100,用100个并发请求consumer1的service1,这样100个并发应该是会复用长连接,所以100个并发实际使用到的长连接并没有100个(这个是长连接复用规则导致的吧?源码我不清楚。。。)。所以我想问能不能配置100个并发在请求时循环使用新的长连接?~~~~(>_<)~~~~,还能只能修改源码呢???谢谢

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] wangruyu1 commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "wangruyu1 (GitHub)" <gi...@apache.org>.
> > > @wangruyu1 `<dubbo:reference connections="100">`在远程引用的时候就会创建完成,然后请求会轮询这100个连接,代码在DubboInvoker.doInvoke
> > > > 所以我想问能不能配置100个并发在请求时循环使用新的长连接
> > > 
> > > 
> > > 不是很懂你这句话,你的意思是继续创建新连接吗
> > 
> > 
> > 我的意思是100个并发同时第一次请求时,是不是都是用的这100个长连接(因为出现长连接复用会小于100个)?当101次请求来时才会出现长连接复用。因为我从现在测试判断出100个并发并没有都被用到了,应该是出现了长连接复用。
> > 我现在想实现每个请求都是优先使用100个长连接中没被用到,如果100个都被用到了,那就循环的复用。相当于,for(i=0;i<100;i++) con=cons[i %100]这样获取长连接。
> > 这能不能配置还是只能改源码?
> 
> 目前消费端源码就是这样实现的;
> DubboInvoker
> 
> ```java
>  @Override
>     protected Result doInvoke(final Invocation invocation) throws Throwable {
>         RpcInvocation inv = (RpcInvocation) invocation;
>         final String methodName = RpcUtils.getMethodName(invocation);
>         inv.setAttachment(Constants.PATH_KEY, getUrl().getPath());
>         inv.setAttachment(Constants.VERSION_KEY, version);
> 
>         ExchangeClient currentClient;
>         if (clients.length == 1) {
>             currentClient = clients[0];
>         } else {
>             currentClient = clients[index.getAndIncrement() % clients.length];
>         }
>        ...
> ```
> 
> `currentClient = clients[index.getAndIncrement() % clients.length];`已经实现了你所说的复用。

恩,谢谢,估计是我配置有问题。

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] gudegg commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "gudegg (GitHub)" <gi...@apache.org>.
@wangruyu1 `<dubbo:reference connections="100">`在远程引用的时候就会创建完成,然后请求会轮询这100个连接,代码在DubboInvoker.doInvoke
> 所以我想问能不能配置100个并发在请求时循环使用新的长连接 

不是很懂你这句话,你的意思是继续创建新连接吗

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
Dubbo protocol use "single long tcp connection", so it is not fit to transfer file or data of large size.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
Dubbo suggests that transfering data of large size should use protocols that do not contains dubbo.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] tswstarplanet commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "tswstarplanet (GitHub)" <gi...@apache.org>.
Dubbo suggests that you can transfer file or data of large size with protocol like hessian or http. You can try it.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org


[GitHub] [incubator-dubbo] wangruyu1 commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "wangruyu1 (GitHub)" <gi...@apache.org>.
谢谢大神们帮我解释下。。。

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] gudegg commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "gudegg (GitHub)" <gi...@apache.org>.
> > @wangruyu1 `<dubbo:reference connections="100">`在远程引用的时候就会创建完成,然后请求会轮询这100个连接,代码在DubboInvoker.doInvoke
> > > 所以我想问能不能配置100个并发在请求时循环使用新的长连接
> > 
> > 
> > 不是很懂你这句话,你的意思是继续创建新连接吗
> 
> 我的意思是100个并发同时第一次请求时,是不是都是用的这100个长连接(因为出现长连接复用会小于100个)?当101次请求来时才会出现长连接复用。因为我从现在测试判断出100个并发并没有都被用到了,应该是出现了长连接复用。
> 我现在想实现每个请求都是优先使用100个长连接中没被用到,如果100个都被用到了,那就循环的复用。相当于,for(i=0;i<100;i++) con=cons[i %100]这样获取长连接。
> 这能不能配置还是只能改源码?

目前消费端源码就是这样实现的;
DubboInvoker
```java
 @Override
    protected Result doInvoke(final Invocation invocation) throws Throwable {
        RpcInvocation inv = (RpcInvocation) invocation;
        final String methodName = RpcUtils.getMethodName(invocation);
        inv.setAttachment(Constants.PATH_KEY, getUrl().getPath());
        inv.setAttachment(Constants.VERSION_KEY, version);

        ExchangeClient currentClient;
        if (clients.length == 1) {
            currentClient = clients[0];
        } else {
            currentClient = clients[index.getAndIncrement() % clients.length];
        }
       ...
```
`currentClient = clients[index.getAndIncrement() % clients.length];`已经实现了你所说的复用。

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] wangruyu1 commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "wangruyu1 (GitHub)" <gi...@apache.org>.
> @wangruyu1 `<dubbo:reference connections="100">`在远程引用的时候就会创建完成,然后请求会轮询这100个连接,代码在DubboInvoker.doInvoke
> 
> > 所以我想问能不能配置100个并发在请求时循环使用新的长连接
> 
> 不是很懂你这句话,你的意思是继续创建新连接吗

我的意思是100个并发同时第一次请求时,是不是都是用的这100个长连接(因为出现长连接复用会小于100个)?当101次请求来时才会出现长连接复用。因为我从现在测试判断出100个并发并没有都被用到了,应该是出现了长连接复用。
我现在想实现每个请求都是优先使用100个长连接中没被用到,如果100个都被用到了,那就循环的复用。相当于,for(i=0;i<100;i++) con=cons[i %100]这样获取长连接。
这能不能配置还是只能改源码?

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org

[GitHub] [incubator-dubbo] Kiddinglife commented on issue #3145: dubbo本地传输3M大小的数据为什么这么慢?

Posted by "Kiddinglife (GitHub)" <gi...@apache.org>.
Hi @wangchangbing  @gudegg,
Did you guys find out the reason why it is slow to transfer 3m data in local network with long connection?
220ms latency really surprised me...
regards.

[ Full content available at: https://github.com/apache/incubator-dubbo/issues/3145 ]
This message was relayed via gitbox.apache.org for notifications@dubbo.apache.org