Dynamically Adjust Service Timeout
Dynamically adjust service timeout in Dubbo-Admin
Dubbo provides the ability to dynamically adjust service timeout, allowing adjustments without restarting the application, which is very effective for temporarily resolving issues of invocation failure due to unstable upstream and downstream service dependencies.
Before You Start
- Deploy the Shop mall project
- Deploy and open Dubbo Admin
Task Details
The mall project provides user information management services through org.apache.dubbo.samples.UserService
. Access http://localhost:8080/
, enter any username and password, and click Login
to log into the system.
In some scenarios, the speed of the User service may slow down, such as when the database storing user data is overloaded, resulting in slow queries, which can cause UserService
access timeouts and login failures.
In the demo system, you can simulate a sudden UserService
access timeout exception through the Timeout Login
in the image below.
Dynamically Adjust Timeout Through Rules
To address sudden login timeout issues, we can simply increase the waiting time for UserService
service calls.
Steps
- Open the Dubbo Admin console.
- In the left navigation bar, select 【Service Governance】 > 【Dynamic Configuration】.
- Click “Create”, enter the service
org.apache.dubbo.samples.UserService
, and the new timeout such as2000
.
After saving, click Timeout Login
again, and after a brief wait, the system can log in normally.
Rule Details
Rule key: org.apache.dubbo.samples.UserService
Rule body
configVersion: v3.0
enabled: true
configs:
- side: provider
parameters:
timeout: 2000
From the perspective of the UserService
provider, the overall timeout is adjusted to 2s.
parameters:
timeout: 2000
The side: provider
configuration will send the rule to the service provider instance, and all UserService
instances will re-publish based on the new timeout value, notifying all consumers via the registry.
Cleanup
To avoid affecting other tasks, delete or disable the timeout rule just configured through Admin.
Feedback
Was this page helpful?
Yes No
Last modified September 30, 2024: Update & Translate Overview Docs (#3040) (d37ebceaea7)