15174834 opened a new issue #1968: 服务调用的超时问题 Some issues with service timeout
URL: https://github.com/apache/incubator-dubbo/issues/1968
 
 
   dubbo version: 2.5.6
   
   ### issues code 1
   ```java
   @Component
   public class ConsumerA {
   
       @Reference(version = "1.0.0",retries = 0, timeout = 180000)
       public ProviderB providerB ;
   
       public void a(){
           try{
               providerB.b(); 
           }catch(Exception e){
               // do something
           }
       }
   
   }
   
   @Service(version = "1.0.0")
   public class ProviderB {
   
       public void b(){ 
           try{
               Thread.sleep(10000); //休眠10秒为了模拟程序执行缓慢
           }catch(Exception e){
           }
       }
   
   }
   ```
   
   使用场景,当B服务提供者需要紧急重启的情况下:
   
此时,B宕机,如何让**a()**立即捕获到异常信息,而不用等待3分钟才返回,如果大量并发请求在请求中,将可能造成A服务大量请求堆积。这个是否有更友好的办法去处理,或者,我的配置并不完善。
   Usage Scenarios When the B Service Provider Needs an Emergency Restart:
   At this point, B crashes, how to make **a()** immediately capture exception 
information without waiting for 3 minutes to return. If a large number of 
concurrent requests are in the request, it may cause a large number of A 
service requests to be accumulated. Is there a more friendly way to deal with 
this, or my configuration is not perfect.
   
   
   
   
   ### issues code 2
   ```java
   @Component
   public class ConsumerA {
   
       @Reference(version = "1.0.0",retries = 0, timeout = 3000)
       public ProviderB providerB ;
   
       public void a(){
           updateSomeRows(); //更新某行数据
           try{
               providerB.b(); 
           }catch(Exception e){
               throw new XXException();
           }
       }
   
   }
   
   @Service(version = "1.0.0")
   public class ProviderB {
   
       public void b(){ 
          insertRow();  //插入某行数据
           try{
               Thread.sleep(10000); //休眠10秒为了模拟程序执行缓慢
           }catch(Exception e){
           }
       }
   
   }
   ```
   
   使用场景,当B服务提供者遇到数据库性能瓶颈(updateSomeRows()执行缓慢):
   
此时,A捕获超时异常,**a()**的事务因异常回滚,但是B的数据已插入,这是不符合预期的。请问怎么简单优雅地处理这样的问题(不考虑使用分布式事务的情况下)。
   Usage scenario, when B service provider encounters a database performance 
bottleneck (execution of updateSomeRows() is slow):
   At this point, A capture timeout exception, **a () ** transaction rollback 
due to anomalies, but B's data has been inserted, which is not in line with 
expectations. How to handle such problems simply and gracefully (not 
considering the use of distributed transactions).
   
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to