Tien, It depends on your integrating. Generally the caching logic is existed in the integrating support codes. So maybe you should point out the method you use DUBBO in. XML or Annotation or else. Then we can figure out the best practice is.
best regards, Jason > On Oct 23, 2019, at 17:46, Tien Dat PHAN <[email protected]> wrote: > > Hi Jason, > > Does this mean even I re-invoke the ReferenceConfig.get() the second time, > the reference may not need to be generated, as it is already cached somewhere > in Dubbo client holder? > > Best > Dat > > On 2019/10/23 09:43:10, Jason Joo <[email protected]> wrote: >> Hi, tien >> >> Oh that's a plain example to illustrate it simply and clearly but in actual >> practice we use xml / annotation or other form of integrating. >> >> If you use annotations in spring with `@EnableDubbo` for example you can >> refer the implementation of `ReferenceAnnotationBeanPostProcessor ` to see >> how they would be cached. >> >> And in this kind of use case a reference should not be necessary to be GC >> once created because it will be reused repeatedly. Can it solve your problem? >> >> best regards, >> >> Jason >> >>> On Oct 23, 2019, at 17:26, Tien Dat PHAN <[email protected]> wrote: >>> >>> Hi Jason, >>> >>> According to this: >>> http://dubbo.apache.org/en-us/docs/user/demos/reference-config-cache.html >>> >>> If we use ReferenceConfig.get(), the usage of it remains at our concern. >>> Does invoking it, every time we use the API, is sub-optimal? >>> And how the reference is GCed? >>> >>> Best >>> Tien Dat >>> >>> On 2019/10/23 09:03:06, Jason Joo <[email protected]> wrote: >>>> Hi, tien >>>> >>>> I just curious on why you use `ReferenceConfigCache` to get the reference? >>>> Why not using `@Reference` everywhere instead? >>>> >>>> best regards, >>>> >>>> Jason >>>> >>>>> On Oct 23, 2019, at 16:55, Tien Dat PHAN <[email protected]> wrote: >>>>> >>>>> Dear >>>>> >>>>> Related to the topic of this thread, I have a question: >>>>> When starting the consumer, we create a reference holder that is >>>>> initialized to hold the API reference. We use the ReferenceConfigCache to >>>>> keep the reference cache. >>>>> We only invoke the ReferenceConfigCache.get(ReferenceConfig<OurAPI>) at >>>>> the very beginning of the holder. >>>>> This seems to result in bad outcome if the >>>>> ReferenceConfigCache.get(ReferenceConfig<OurAPI>) is invoked when the >>>>> service provider is not ready (not yet exported). >>>>> >>>>> Our questions are: >>>>> 1. If this is a bad practice, should we invoke the >>>>> ReferenceConfigCache.get(ReferenceConfig<OurAPI>) every time we want to >>>>> use it? >>>>> 2. If the answer to the 1. question is YES. Then our concern is: Does >>>>> creating new API reference everytime we use it lead to sub-performance? >>>>> And how the system can GC the connection created everytime we invoke >>>>> ReferenceConfigCache.get(ReferenceConfig<OurAPI>)? Or we, at the consumer >>>>> side, have to handle the connection closeness? >>>>> >>>>> Best regards >>>>> Tien Dat >>>>> >>>>> On 2019/10/14 09:21:14, 郑泽超 <[email protected]> wrote: >>>>>> >>>>>> Hello, >>>>>> You can set check=false in your reference config >>>>>> >>>>>>> 在 2019年10月14日,下午4:32,一陣風& <[email protected]> 写道: >>>>>>> >>>>>>> Start the client first and then start the server to report an error: >>>>>>> >>>>>>> >>>>>>> >>>>>>> Failed to invoke the method getBalance in the service >>>>>>> com.github.autfish.dubbo.service.BalanceService. No provider available >>>>>>> for the service com.github.autfish.dubbo.service.BalanceService from >>>>>>> registry localhost:9090 on the consumer 192.168.8.249 using the dubbo >>>>>>> version 2.7.1. Please check if the providers have been started and >>>>>>> registered. >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> How should I configure in yml file >>>>>> >>>>>> >>>> >>>> >> >>
