One, foreword

Sentinel is a high-availability traffic protection component for distributed service architecture. It mainly takes traffic as the entry point and helps developers guarantee the stability of microservices from multiple dimensions such as traffic limiting, traffic shaping, fuse downgrading, system load protection and hotspot protection.

For example, in a very short period of time, there will be very large concurrent requests. If you do not limit the flow, the server may collapse suddenly.

Second, the installation



java -Dserver.port=8080 -Dcsp.sentinel.dashboard.server=localhost:8080 -jar sentinel-dashboard.jar
Copy the code

Access:http://localhost:8080/ Username and password: sentinel

Three, use,

3.1 the maven rely on

Add the following dependencies to pom.xml:

Copy the code

3.2 application. The properties

# dashboard
Copy the code

Four, test,

withjmeterLoop requests. The value of QPS (Queries per second) is about 20,000.

With flow control, QPS 5000 is capped

The monitor can see the QPS cap 5000 passed, all others are rejected.

There are various traffic control rules, including fast failure, Warm Up, and queue waiting. The value can be configured as required.

Five, the conclusion

Source code address:…

Synchronize wechat official account: Little Tiger’s technology blog