blob: c79fda7278fdb5016a24ec955c272f40af04d76c [file] [log] [blame]
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Apache Dubbo – How to smoothly migrate to the new functions of Dubbo3</title><link>https://dubbo.apache.org/en/overview/tasks/migration/</link><description>Recent content in How to smoothly migrate to the new functions of Dubbo3 on Apache Dubbo</description><generator>Hugo -- gohugo.io</generator><language>en</language><atom:link href="https://dubbo.apache.org/en/overview/tasks/migration/index.xml" rel="self" type="application/rss+xml"/><item><title>Overview: Upgrade to Dubbo3</title><link>https://dubbo.apache.org/en/overview/tasks/migration/2to3/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/overview/tasks/migration/2to3/</guid><description>
&lt;p>** Upgrade directly to Dubbo 3.0 without changing any code. **&lt;/p>
&lt;p>At the beginning of the design and development of version 3.0, we set the goal of being compatible with older versions of Dubbo users (2.5, 2.6, 2.7). Therefore, the upgrade process to version 3.0 will be completely transparent, users do not need to do any business transformation, and the behavior of the framework after upgrading to version 3.x will remain completely consistent with version 2.x.&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-xml" data-lang="xml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;groupId&amp;gt;&lt;/span>org.apache.dubbo&lt;span style="color:#268bd2">&amp;lt;/groupId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;artifactId&amp;gt;&lt;/span>dubbo&lt;span style="color:#268bd2">&amp;lt;/artifactId&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span> &lt;span style="color:#268bd2">&amp;lt;version&amp;gt;&lt;/span>3.0.10&lt;span style="color:#268bd2">&amp;lt;/version&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;/dependency&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;p>But also note that the transparent upgrade is only the first step towards 3.0, because &amp;ldquo;consistent framework behavior&amp;rdquo; means that users will not be able to experience the new features of 3.0. **If you want to enable the new features brought by 3.0, users need to make some modifications. We call this process migration, which is an on-demand process. **&lt;/p>
&lt;p>Therefore, for legacy users, there are two different migration paths:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>In two steps, first promote business upgrade to version 3.0 in compatibility mode (no modification required), and then enable new features on demand at certain times (modification on demand);&lt;/strong>&lt;/li>
&lt;li>&lt;strong>The upgrade and migration are completed synchronously. When the business is upgraded to version 3.0, the transformation is completed and new features are enabled;&lt;/strong>&lt;/li>
&lt;/ul>
&lt;p>The new features provided by Dubbo 3.0 include:&lt;/p>
&lt;ul>
&lt;li>** New address discovery model (application-level service discovery). **
&lt;ul>
&lt;li>See &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/upgrades-and-compatibility/service-discovery/service-discovery-samples/">Application-Level Service Discovery Migration Samples&lt;/a>.&lt;/li>
&lt;li>See &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/upgrades-and-compatibility/service-discovery/migration-service-discovery/">Migration steps for application-level service discovery&lt;/a>&lt;/li>
&lt;li>See &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/upgrades-and-compatibility/service-discovery/service-discovery-rule/">Description of application-level service discovery address migration rules&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>**The next generation of the HTTP/2-based Triple protocol. **
&lt;ul>
&lt;li>See &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/upgrades-and-compatibility/migration-triple/">Triple Protocol Migration Steps&lt;/a>&lt;/li>
&lt;li>See &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/protocol/triple/guide/">Triple protocol usage&lt;/a>&lt;/li>
&lt;li>See &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/protocol/triple/overview/">Triple Protocol Design and Implementation&lt;/a>.&lt;/li>
&lt;/ul>
&lt;/li>
&lt;li>**Unified routing rules. **
&lt;ul>
&lt;li>See &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/advanced-features-and-usage/traffic/mesh-style/">Design and Implementation of Unified Routing Rules&lt;/a>&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ul></description></item><item><title>Overview: Guide to Migrating Dubbo Protocol to Triple Protocol</title><link>https://dubbo.apache.org/en/overview/tasks/migration/migration-triple/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/overview/tasks/migration/migration-triple/</guid><description>
&lt;h2 id="triple-introduction">Triple Introduction&lt;/h2>
&lt;p>For the format and principle of the &lt;code>Triple&lt;/code> protocol, please refer to &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/reference-manual/protocol/triple/overview/">RPC Communication Protocol&lt;/a>&lt;/p>
&lt;p>According to the goals of Triple design, the &lt;code>Triple&lt;/code> protocol has the following advantages:&lt;/p>
&lt;ul>
&lt;li>Capable of cross-language interaction. Both the traditional multi-language and multi-SDK mode and the Mesh cross-language mode require a more general and scalable data transmission protocol.&lt;/li>
&lt;li>Provide a more complete request model. In addition to supporting the traditional Request/Response model (Unary one-way communication), it also supports Stream (streaming communication) and Bidirectional (two-way communication).&lt;/li>
&lt;li>Easy to expand, high penetration, including but not limited to Tracing / Monitoring and other support, should also be recognized by devices at all levels, gateway facilities, etc. can identify data packets, friendly to Service Mesh deployment, and reduce the difficulty of understanding for users.&lt;/li>
&lt;li>Fully compatible with grpc, the client/server can communicate with the native grpc client.&lt;/li>
&lt;li>Components in the existing grpc ecosystem can be reused to meet cross-language, cross-environment, and cross-platform intercommunication requirements in cloud-native scenarios.&lt;/li>
&lt;/ul>
&lt;p>For Dubbo users currently using other protocols, the framework provides migration capabilities compatible with existing serialization methods. Without affecting existing online businesses, the cost of migrating protocols is almost zero.&lt;/p>
&lt;p>Dubbo users who need to add new connection to Grpc service can directly use the Triple protocol to achieve the connection, and do not need to introduce the grpc client separately to complete it. Not only can the existing Dubbo ease of use be retained, but also the complexity of the program and the development and maintenance can be reduced. Cost, it can be connected to the existing ecology without additional adaptation and development.&lt;/p>
&lt;p>For Dubbo users who need gateway access, the Triple protocol provides a more native way to make gateway development or use open source grpc gateway components easier. The gateway can choose not to parse the payload, which greatly improves the performance. When using the Dubbo protocol, the language-related serialization method is a big pain point for the gateway, and the traditional HTTP-to-Dubbo method is almost powerless for cross-language serialization. At the same time, since Triple&amp;rsquo;s protocol metadata is stored in the request header, the gateway can easily implement customized requirements, such as routing and current limiting.&lt;/p>
&lt;h2 id="dubbo2-protocol-migration-process">Dubbo2 protocol migration process&lt;/h2>
&lt;p>Dubbo2 users use dubbo protocol + custom serialization, such as hessian2 to complete remote calls.&lt;/p>
&lt;p>By default, Grpc only supports Protobuf serialization, and it cannot support multi-parameter and method overloading in the Java language.&lt;/p>
&lt;p>At the beginning of Dubbo3, one goal was to be perfectly compatible with Dubbo2. Therefore, in order to ensure the smooth upgrade of Dubbo2, the Dubbo framework has done a lot of work to ensure that the upgrade is seamless. Currently, the default serialization is consistent with Dubbo2 as &lt;code>hessian2&lt;/code>.&lt;/p>
&lt;p>**So, if you decide to upgrade to Dubbo3&amp;rsquo;s &lt;code>Triple&lt;/code> protocol, you only need to modify the protocol name in the configuration to &lt;code>tri&lt;/code> (note: not triple). **&lt;/p>
&lt;p>For more instructions on using the &lt;code>Triple&lt;/code> protocol, please refer to &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/upgrades-and-compatibility/migration-triple/">Triple Protocol Migration Guide&lt;/a>.&lt;/p></description></item><item><title>Overview: Dubbo3 application-level service discovery</title><link>https://dubbo.apache.org/en/overview/tasks/migration/service-discovery-samples/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://dubbo.apache.org/en/overview/tasks/migration/service-discovery-samples/</guid><description>
&lt;p>Application-level service discovery is a protocol for service discovery between applications. Therefore, to use application-level service discovery, both the consumer and the server must be upgraded to Dubbo 3.0 and new features enabled (enabled by default) to use application-level service discovery in the link. Take advantage of application-level service discovery.&lt;/p>
&lt;h2 id="open-method">Open method&lt;/h2>
&lt;h2 id="server">Server&lt;/h2>
&lt;p>After the application is upgraded to Dubbo 3.0, the server will automatically enable the interface-level + application-level dual registration function, and the developer does not need to modify any configuration by default&lt;/p>
&lt;h3 id="consumer-side">Consumer side&lt;/h3>
&lt;p>After the application is upgraded to Dubbo 3.0, the consumer side automatically starts the interface-level + application-level dual subscription function, and the developer does not need to modify any configuration by default. It is recommended that after the server is upgraded to Dubbo 3.0 and the application-level registration is enabled, configure the consumer end to close the interface-level subscription through rules to release the corresponding memory space.&lt;/p>
&lt;h2 id="detailed-description">Detailed description&lt;/h2>
&lt;h3 id="server-configuration">Server configuration&lt;/h3>
&lt;ol>
&lt;li>Global switch&lt;/li>
&lt;/ol>
&lt;p>Application configuration (can be specified by configuration file or -D) &lt;code>dubbo.application.register-mode&lt;/code> enables the global registration switch for instance (only register application level) and all (both interface level and application level registration). After configuring this switch , by default, application-level addresses will be registered with all registries for service discovery on the consumer side.&lt;/p>
&lt;blockquote>
&lt;p>Example: [https://github.com/apache/dubbo-samples/blob/master/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src/main/resources/ dubbo.properties](&lt;a href="https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src">https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-provider2/src&lt;/a> /main/resources/dubbo.properties)&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span># double registration
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>dubbo.application.register-mode=all
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-fallback" data-lang="fallback">&lt;span style="display:flex;">&lt;span># Application-level registration only
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>dubbo.application.register-mode=instance
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="2">
&lt;li>Registration center address parameter configuration&lt;/li>
&lt;/ol>
&lt;p>Registry-type=service can be configured on the address of the registry to display the registry that specifies the registry as application-level service discovery, and the registry with this configuration will only perform application-level service discovery.&lt;/p>
&lt;blockquote>
&lt;p>Example: [https://github.com/apache/dubbo-samples/blob/master/dubbo-samples-cloud-native/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src/main/resources/spring/ dubbo-provider.xml](&lt;a href="https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src">https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-demo-servicediscovery-xml/servicediscovery-provider/src&lt;/a> /main/resources/spring/dubbo-provider.xml)&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-xml" data-lang="xml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#268bd2">&amp;lt;dubbo:registry&lt;/span> address=&lt;span style="color:#2aa198">&amp;#34;nacos://${nacos.address:127.0.0.1}:8848?registry-type=service&amp;#34;&lt;/span>&lt;span style="color:#268bd2">/&amp;gt;&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;h3 id="consumer-subscription-mode">Consumer Subscription Mode&lt;/h3>
&lt;p>FORCE_INTERFACE: only interface-level subscription, the behavior is consistent with Dubbo 2.7 and previous versions.
APPLICATION_FIRST: interface level + application level multi-subscription, if the application level can subscribe to the address, use the application level subscription, if the address cannot be subscribed, use the interface level subscription, so as to ensure the greatest compatibility during the migration process. (Note: Due to the simultaneous subscription behavior, the memory usage in this mode will increase to a certain extent, so after all servers are upgraded to Dubbo 3.0, it is recommended to migrate to FORCE_APPLICATION mode to reduce memory usage)
FORCE_APPLICATION: Only application-level subscriptions will only use the new service discovery model.&lt;/p>
&lt;h3 id="consumer-configuration">Consumer configuration&lt;/h3>
&lt;ol>
&lt;li>Default configuration (no configuration required)&lt;/li>
&lt;/ol>
&lt;p>After upgrading to Dubbo 3.0, the default behavior is interface-level + application-level multi-subscription. If the address can be subscribed at the application level, the application-level subscription will be used. If the address cannot be subscribed, the interface-level subscription will be used to ensure maximum compatibility.&lt;/p>
&lt;ol start="2">
&lt;li>Subscription parameter configuration&lt;/li>
&lt;/ol>
&lt;p>Application configuration (can be specified by configuration file or -D) &lt;code>dubbo.application.service-discovery.migration&lt;/code> is &lt;code>APPLICATION_FIRST&lt;/code> to enable multi-subscription mode, and configuration to &lt;code>FORCE_APPLICATION&lt;/code> can force application-level subscription mode only.
The specific interface subscription can be configured in &lt;code>parameters&lt;/code> in &lt;code>ReferenceConfig&lt;/code>, and the Key is &lt;code>migration.step&lt;/code>, and the Value is &lt;code>APPLICATION_FIRST&lt;/code> or &lt;code>FORCE_APPLICATION&lt;/code> key-value pair to configure a single subscription.&lt;/p>
&lt;blockquote>
&lt;p>Example: [https://github.com/apache/dubbo-samples/blob/master/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/test/java/ org/apache/dubbo/demo/consumer/DemoServiceConfigIT.java](&lt;a href="https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration">https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration&lt;/a> /dubbo-servicediscovery-migration-consumer/src/test/java/org/apache/dubbo/demo/consumer/DemoServiceConfigIT.java)&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-java" data-lang="java">&lt;span style="display:flex;">&lt;span>System&lt;span style="color:#719e07">.&lt;/span>setProperty&lt;span style="color:#719e07">(&lt;/span>&lt;span style="color:#2aa198">&amp;#34;dubbo.application.service-discovery.migration&amp;#34;&lt;/span>&lt;span style="color:#719e07">,&lt;/span> &lt;span style="color:#2aa198">&amp;#34;APPLICATION_FIRST&amp;#34;&lt;/span>&lt;span style="color:#719e07">);&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-java" data-lang="java">&lt;span style="display:flex;">&lt;span>ReferenceConfig&lt;span style="color:#719e07">&amp;lt;&lt;/span>DemoService&lt;span style="color:#719e07">&amp;gt;&lt;/span> referenceConfig &lt;span style="color:#719e07">=&lt;/span> &lt;span style="color:#719e07">new&lt;/span> ReferenceConfig&lt;span style="color:#719e07">&amp;lt;&amp;gt;(&lt;/span>applicationModel&lt;span style="color:#719e07">.&lt;/span> &lt;span style="color:#268bd2">newModule&lt;/span>&lt;span style="color:#719e07">());&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>referenceConfig&lt;span style="color:#719e07">.&lt;/span>setInterface&lt;span style="color:#719e07">(&lt;/span>DemoService&lt;span style="color:#719e07">.&lt;/span>class&lt;span style="color:#719e07">);&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>referenceConfig&lt;span style="color:#719e07">.&lt;/span>setParameters&lt;span style="color:#719e07">(&lt;/span>&lt;span style="color:#719e07">new&lt;/span> HashMap&lt;span style="color:#719e07">&amp;lt;&amp;gt;());&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>referenceConfig&lt;span style="color:#719e07">.&lt;/span>getParameters&lt;span style="color:#719e07">().&lt;/span>put&lt;span style="color:#719e07">(&lt;/span>&lt;span style="color:#2aa198">&amp;#34;migration.step&amp;#34;&lt;/span>&lt;span style="color:#719e07">,&lt;/span> mode&lt;span style="color:#719e07">);&lt;/span>
&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#719e07">return&lt;/span> referenceConfig&lt;span style="color:#719e07">.&lt;/span>get&lt;span style="color:#719e07">();&lt;/span>
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>&lt;ol start="3">
&lt;li>Dynamic configuration (highest priority, configuration can be modified at runtime)&lt;/li>
&lt;/ol>
&lt;p>This configuration needs to be pushed based on the configuration center, the Key is the application name + &lt;code>.migration&lt;/code> (such as &lt;code>demo-application.migraion&lt;/code>), and the Group is &lt;code>DUBBO_SERVICEDISCOVERY_MIGRATION&lt;/code>. For details on rule body configuration, see &lt;a href="https://dubbo.apache.org/en/docs3-v2/java-sdk/upgrades-and-compatibility/service-discovery/service-discovery-rule/">Guidelines for migrating from interface-level service discovery to application-level service discovery&lt;/a>.&lt;/p>
&lt;blockquote>
&lt;p>Example: [https://github.com/apache/dubbo-samples/blob/master/dubbo-samples-cloud-native/dubbo-servicediscovery-migration/dubbo-servicediscovery-migration-consumer/src/main/java/ org/apache/dubbo/demo/consumer/UpgradeUtil.java](&lt;a href="https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration">https://github.com/apache/dubbo-samples/blob/master/2-advanced/dubbo-samples-service-discovery/dubbo-servicediscovery-migration&lt;/a> /dubbo-servicediscovery-migration-consumer/src/main/java/org/apache/dubbo/demo/consumer/UpgradeUtil.java)&lt;/p>
&lt;/blockquote>
&lt;div class="highlight">&lt;pre tabindex="0" style="color:#93a1a1;background-color:#002b36;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-java" data-lang="java">&lt;span style="display:flex;">&lt;span>step: FORCE_INTERFACE
&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div></description></item></channel></rss>