-
Notifications
You must be signed in to change notification settings - Fork 8.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Design of SlotChainBuilder
#1308
Comments
And i think it'd better to be enhanced or fixed in |
For backward compatibility a new keyword Certainly we have other solutions if not. |
Very detailed description! Introduce |
Sorry for latency. I have read your design and summarize it follows:
Is that right? It's a good practice i think if we don't have the historical debt.
Questions above is that we should carefully deal with. |
... And based on your proposal i have several improvement to make more scenarios met:
|
Issue Description
SlotChainBuilder is used to decide the collection of modules with orders when doing a check.
And it's loaded and initialized in
SlotChainProvider
(which is called byCtSph
) through SPI.sentinel-core
offers a default implementationDefaultSlotChainBuilder
for fallback if no implementation found while bothsentinel-parameter-flow-control
andsentinel-api-gateway-adapter-common
offer its own implementation(HotParamSlotChainBuilder
andGatewaySlotChainBuilder
).If both of them are introduced which one would be the lucky one is undetermined.
So some of users may trigger the bug(refer to #1306 ).
Describe what you expected to happen
Following aspects should be considered:
Possible designs
Generally speaking, considering backward compatibility, function and capacity of customizing, there are mainly three directions:
1. Make
Slot
as a service.We could abandon
SlotBuilder
and turn to slots loading through SPI and introduce kind of@SpiOrder
to it to make them sortable.And existing attempts please refer to #316 #411
Which will not be supported or should be careful
Order value should be carefully assigned because new priority sensitive slots need available space of adjacent ones.
User-defined implementation can't resort slots.
It cannot deal with conflicts slots.
2. Enhance
SlotBuilder
supporting chainingMake the builders support something like filters or listeners and maintain their own slots and orders like:
DefaultSlotBuilder introduces
NodeSelecter
->ClusterBuilder
->Log
->Flow
->Degrade
.GatewaySlotBuilder introduces
GatewayFlow
afterLog
.ParamFlowSlotBuilder
introducesParamFlow
afterLog
.Sorts can be implemented as
getOrder
in ProcessorSlot or AbstractProcessorSlotaddSlotAt()
toProcessorSlotChain
For more capacity in user's implementations
getSlots()
/setSlots()
can be introduced intoProcessorSlotChain
.Which should be careful
The scenario updated and legacy sentinel-* are mixed.
Maybe make it unworkable or compatible is acceptable.
3. Create
NewSlotBuilder
supporting chainingNo change on legacy definitions but the scenario mixed mentioned above will become harder to deal with.
Proposal
I am mainly on design 2.
Further discussion is welcomed.
The text was updated successfully, but these errors were encountered: