Initial experience of Dubbo application level service discovery

roshilikang 2021-09-15 04:25:03
initial experience dubbo application level

This article has been included welcome star.

dubbo Introduction to application level service discovery

understand dubbo My friends know ,dubbo Of provider Register with the registry at startup ,consumer Consume from the registry .

at present dubbo The data registered in the registry is at the interface level , Application level service discovery is to register instances in the registry (ip+port), The only difference between the two is the granularity of registration .

As for why there is application level service discovery , There are several reasons

  • Align with industry mainstream microservice models , such as SpringCloud、Kubernetes Native Service etc.
  • Reduce registration data , Lifting performance

Why write this article

stay dubbo2.7.5 Application level service discovery is released in version

Official release note There is only one sentence mentioned in the article , The message is just two :

Support a new service discovery granularity : Application level service discovery Still in BETA edition And there is no official document on how to use it .

I searched the Internet for some articles , Just some Directional 、 Principle Introduction to , Such as 《Dubbo An important step in cloud Nativity - Application level service discovery analysis 》、《Apache-Dubbo- Service introspection architecture design 》( The official account is not , Searchable online , By brother ma ).

principle 、 Direction is important , But I want to try dubbo But I don't know how to configure it , So we'll build it from the fragments and source code on the Internet dubbo Application level service discovery demo

Experience application level service discovery

Environment building

Here's my common building dubbo Source debugging environment , Simple and effective .

Simply let dubbo Just one to run zookeeper As a registry .

Use docker To build zk Environmental Science :

docker pull zookeeper
docker run -p 2181:2181  -d zookeeper:latest

dubbo Source debugging environment , Just from github Download source code

git clone

Use the source code demo that will do ,dubbo There are many ways to run , annotation 、api、xml Methods such as , Choose what you are familiar with , There is no essential difference

Two kinds of service discovery

Interface level service discovery

dubbo The default is interface level service registration , Just find one provider Of demo Start it up , Let's have a look zk Data registered on

/dubbo In the catalog configmetadata yes 2.7 And then introduced “ Three centers ”, This is beyond the scope of this article , Temporary neglect

/dubbo/org.apache.dubbo.demo.DemoService It's a registered service , There is a temporary node hanging below


urldecode once


You can see that some metadata is registered , such as ip、port、interface、methods etc.

Application level service discovery

Configuration of application level service discovery , There is very little information available on the Internet , I've also looked through the materials here , Plus try it yourself , The resulting configuration , In addition to the configuration zk Address , You also need to turn on application level service discovery :


It's written in code like this

RegistryConfig registryConfig = new RegistryConfig("zookeeper://");
Map<String, String> params = new HashMap<>();

provider And consumer We all need to write like this , And consumer Still need to be in reference On the configuration services, Point to provider Of applicationName, It means you need to consume the app

ReferenceConfig<DemoService> reference = new ReferenceConfig<>();

RegistryConfig registryConfig = new RegistryConfig("zookeeper://");
Map<String, String> params = new HashMap<>();

zk The data registered on becomes /services Next

We found that the metadata registered in the service dimension is missing , So at this time consumer I'll start with provider Establishing a connection , And then get the metadata .


This article is introduced by examples dubbo The new version provides the ability of application level dimension service registration and discovery , It's just aligned with other existing microservice discovery models , We need to think deeply about how to use it in practice .

WeChat official account " Master bug catcher ", Back end technology sharing , Architecture design 、 performance optimization 、 Source code reading 、 Troubleshoot problems 、 Step on the pit practice .


  1. tomcat常见面试题,聊聊你对分布式锁技术方案的理解,
  2. spring源码视频教程,我是如何收割多家大厂offer的?
  3. spring框架教程推荐,2021最新爱奇艺Java社招面试题目,
  4. Spring事務擴展機制,2021大廠Java知識點總結 面試題解析!
  5. Java Development Interview Question with Answers, 2021 Big Factory Java Knowledge point Summary Interview Question Analysis!
  6. Java + SSM Maotai Liquor e - commerce Platform for Computer Graduation DesignVente d'alcool
  7. spring框架教程推薦,2021最新愛奇藝Java社招面試題目,
  8. Recommandé pour le tutoriel Spring Framework, 2021 dernière question d'entrevue d'embauche de la société aiqiyi Java,
  9. Spring source Video tutoriel, comment récolter plusieurs grandes usines?
  10. Springcloud learning notes (I)
  11. Basic knowledge of hive (III) complete collection of functions in hive
  12. spring源碼視頻教程,我是如何收割多家大廠offer的?
  13. 【微信小程序】,看看最新BTA大厂的Java程序员的招聘技术标准,
  14. 【工作经验分享】,2021最新百度、头条等公司Java面试题目,
  15. 【微信小程序】,看看最新BTA大廠的Java程序員的招聘技術標准,
  16. [Widget Wechat] pour voir les dernières normes techniques de recrutement des programmeurs Java de BTA.
  17. Video | Tencent cloud enterprise MySQL (CDB) - dynamic thread pool function
  18. Upgrade your Linux PC hardware using open source tools
  19. RTFM! How to read (and understand) the magic man pages in Linux
  20. [partage d'expérience de travail], 2021 les dernières questions d'entrevue Java de Baidu, Headlines, etc.
  21. Java 16 is coming online. You can't even use the features of Java 8, can you?
  22. Java (3) basic data types and their type conversion
  23. 一位Java大牛的BAT面试心得与经验总结,2021年Java春招面试经历,
  24. 一举拿下腾讯美团滴滴offer,快来瞧瞧这份Spring面试小抄!
  25. 一个Java应届生从上海离职,万字长文总结Java多进程,
  26. Seven design principles of java object-oriented design pattern
  27. 一個Java應届生從上海離職,萬字長文總結Java多進程,
  28. Un nouvel étudiant Java a quitté Shanghai et a résumé plusieurs processus Java.
  29. Prenez d'un coup l'offre de Tencent meituan et jetez un coup d'oeil à cette copie de l'entrevue de printemps!
  30. L'expérience et l'expérience d'un Maverick Java en matière d'entrevue sur les MTD, l'expérience de l'entrevue d'embauche du printemps Java en 2021,
  31. Interface graphique X: mise à jour des tables de rendu et optimisation du Code (compilation intégrée 10)
  32. Widget de vérification de fichiers personnalisés Linux
  33. Java thread pool - work queue
  34. [Part 7] - Summary of B2B2C e-commerce technology of spring cloud live mall managed by git branch
  35. Reflection type of Java Foundation
  36. Want to get started with data structures, but always fall under the pomegranate skirt of the linked list?
  37. Interviewer: do redis transactions satisfy atomicity?
  38. 一篇文章教你搞定计算机网络面试,350道Java面试真题分享,
  39. 一条正确的Java职业生涯规划,揭秘今年Java春招面试必问问题有哪些?
  40. 一名毕业三年的女程序媛面试头条经验,关于Redis主从节点数据过期一致性的思考,
  41. Huawei cloud guassdb (for redis) released a new version: Lua script and SSL connection encryption
  42. Java thread pool - work queue
  43. 一名畢業三年的女程序媛面試頭條經驗,關於Redis主從節點數據過期一致性的思考,
  44. Trois ans d'expérience d'entrevue avec une femme de programmation diplômée, une réflexion sur la cohérence de l'expiration des données de redis Master slave Node,
  45. Un plan de carrière Java correct, découvrez les questions que vous devez poser lors de l'entrevue d'embauche du printemps Java de cette année.
  46. 万字详解微服务的哨兵机制,架构师带你玩转Redis高性能缓存设计实战,
  47. Un article vous a appris à gérer les entrevues sur le Web, à partager 350 vraies questions d'entrevue Java,
  48. Jquery Tools Methodology collation, Sharing a little interview Experience
  49. Tutoriel de développement Java, compétences de base nécessaires pour interviewer un programmeur Java dans une grande usine,
  50. "Anti Mafia storm" has just finished, another criminal investigation play has come, and the supporting actor is more popular than the protagonist
  51. 萬字詳解微服務的哨兵機制,架構師帶你玩轉Redis高性能緩存設計實戰,
  52. L'architecte vous guidera dans la conception de cache haute performance de redis.
  53. Linux驱动开发: 杂项字符设备
  54. Jquery plug - in urianchor, app front end Development
  55. Linux驅動開發: 雜項字符設備
  56. Développement de pilotes Linux: périphériques de caractères divers
  57. Utilisez @ async dans Spring boot pour effectuer des appels asynchrones et accélérer l'exécution des tâches!
  58. $in jquery, Visualized Web Development Tool
  59. Le développement Java doit être fait. Les entrevues https demandent souvent une analyse complète.
  60. 不断提升自己创造溢价的能力,字节跳动 阿里 华为 腾讯等大厂Java面试题,