Sample Application Architecture

Demonstrates how to use Dubbo’s traffic management features.

This task demonstrates the traffic control capabilities of Dubbo based on a simple online shopping mall microservice system.

Note

All capabilities demonstrated in this example are implemented based on Dubbo Routing Rules. For detailed information on how they work, please check the specifics.

The architecture diagram of the online mall is as follows:

shop-arc

The system consists of 5 microservice applications:

  • Frontend Shopping Mall Home, which serves as the web interface interacting with users, calling User, Detail, Order, etc., to provide user login, product display, and order management services.
  • User Service, responsible for user data management and identity verification.
  • Order Service, providing order creation and query services, relying on the Detail service to validate product stock information.
  • Detail Service, displaying detailed product information and calling the Comment service to show user comments on products.
  • Comment Service, managing user comments on products.

Deploying the Mall System

For convenience, we will deploy the entire system on a Kubernetes cluster. Execute the following command to complete the mall project deployment. The source code example is in dubbo-samples/task.

  1. kubectl apply -f https://raw.githubusercontent.com/apache/dubbo-samples/master/10-task/dubbo-samples-shop/deploy/All.yml

The complete deployment architecture diagram is as follows:

shop-arc

The Order Service has two versions, v1 and v2, with v2 being the newly released optimized version of the order service.

  • Version v1 simply creates orders without displaying order details.
  • Version v2 displays the delivery address details after the order is created successfully.

Both the Detail and Comment services also have two versions, v1 and v2, demonstrating the effect of traffic diversion across multiple versions.

  • Version v1 provides services for all requests by default.
  • Version v2 simulates services deployed in specific regions, so the v2 instances carry specific labels.

Execute the following commands to ensure all services and Pods are running normally:

  1. $ kubectl get services -n dubbo-demo
  1. $ kubectl get pods -n dubbo-demo

To ensure the integrity of the system, in addition to the several microservice applications related to the mall, examples also start up Nacos registration configuration center, Dubbo Admin Console, and Skywalking full-link tracing system in the background.

  1. $ kubectl get services -n dubbo-system
  1. $ kubectl get pods -n dubbo-system

Obtaining Access Address

Execute the following commands to map the cluster ports to local ports:

  1. kubectl port-forward -n dubbo-demo deployment/shop-frontend 8080:8080
  1. kubectl port-forward -n dubbo-system service/dubbo-admin 38080:38080
  1. kubectl port-forward -n dubbo-system service/skywalking-oap-dashboard 8082:8082

At this point, open your browser to access the following addresses:

  • Mall Home Page http://localhost:8080
  • Dubbo Admin Console http://localhost:38080
  • Skywalking Console http://localhost:8082

Task Items

Next, try to add some traffic control rules to the mall through the following task items.

Adjust Timeout

By dynamically adjusting the service timeout during runtime, it can effectively address issues such as unreasonable timeout settings and frequent timeouts due to system anomalies, improving system stability.

Increase Retry Count

Retries after the initial service call failure can effectively increase the overall call success rate.

Access Log

Access logs can effectively record all service request information processed by a machine within a certain period. Dynamically enabling access logs in runtime is very helpful for troubleshooting.

Same Data Center/Region Priority

Same data center/region priority means prioritizing calls to service providers in the same data center/region when invoking services, avoiding network delays caused by cross-region calls, thereby reducing response time for calls.

Environment Isolation

By logically isolating one or more applications in a cluster, this can be used for gray environments or building multiple testing environments.

Parameter Routing

For example, route traffic based on user ID, forwarding a small portion of user requests to the newly released product version to validate the stability of the new version and gather user feedback on product experience.

Weight Ratio

By dynamically adjusting the weight of a single or a set of machines through rules, the distribution of request traffic can be altered in runtime to achieve dynamic, proportional traffic routing.

Service Downgrade

The core goal of service downgrade is to maintain functional integrity by returning downgraded results when weak dependencies are unavailable or calls fail.

Fixed Machine Traffic Diversion

By forwarding requests to a specific provider machine, this helps quickly reproduce development or online issues.


Feedback

Was this page helpful?

Yes No

Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)