exec_limit

package
v3.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 5, 2024 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package exec_limit provides a filter for limiting the number of in-progress request and it's thread-safe.

example:
"UserProvider":
  registry: "hangzhouzk"
  protocol : "dubbo"
  interface : "com.ikurento.user.UserProvider"
  ... # other configuration
  execute.limit: 200 # the name of MethodServiceTpsLimiterImpl. if the value < 0, invocation will be ignored.
  execute.limit.rejected.handle: "default" # the name of rejected handler
  methods:
   - name: "GetUser"
     execute.limit: 20, # in this case, this configuration in service-level will be ignored.
   - name: "UpdateUser"
     execute.limit: -1, # If the rate<0, the method will be ignored
   - name: "DeleteUser"
     execute.limit.rejected.handle: "customHandler" # Using the custom handler to do something when the request was rejected.
   - name: "AddUser"
From the example, the configuration in service-level is 200, and the configuration of method GetUser is 20.
it means that, the GetUser will be counted separately.
The configuration of method UpdateUser is -1, so the invocation for it will not be counted.
So the method DeleteUser and method AddUser will be limited by service-level configuration.
Sometimes we want to do something, like log the request or return default value when the request is over limitation.
Then you can implement the RejectedExecutionHandler interface and register it by invoking SetRejectedExecutionHandler.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ExecuteState

type ExecuteState struct {
	// contains filtered or unexported fields
}

ExecuteState defines the concurrent count

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL