feature/74-tree_round_robin #77
No reviewers
Labels
No labels
P0
P1
P2
P3
good first issue
Infrastructure
blocked
bug
config
discussion
documentation
duplicate
enhancement
go
help wanted
internal
invalid
kludge
observability
perfomance
question
refactoring
wontfix
No milestone
No project
No assignees
6 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: TrueCloudLab/frostfs-s3-gw#77
Loading…
Reference in a new issue
No description provided.
Delete branch "dkirillov/frostfs-s3-gw:feature/74-tree_round_robin"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
close #74
244f087002
to79d33cd741
79d33cd741
tof0bbd5dcc2
WIP: feature/74-tree_round_robinto feature/74-tree_round_robin@a.bogatyrev has some tests for that, so let's invite him to try it.
@ -118,3 +118,3 @@
memCli, err := tree.NewTreeServiceClientMemory()
require.NoError(t, err)
return tree.NewTree(memCli)
return tree.NewTree(memCli, zap.NewExample())
Hm, haven't heard about
zap.NewExample
, how does it differ fromzaptest.New(t)
It writes json to stdout without timestamp and calling function. But probably we should use
zaptest
instead@ -340,0 +340,4 @@
```yaml
tree:
service:
- s01.frostfs.devenv:8080
On a side-note, why do we have a separate section for the tree service?
Back in the days tree service was served on a separate port from FrostFS API.
Maybe now is the time to move? We already have a list for "normal" endpoints.
We plan to use "normal" endpoints after integrating tree service with the SDK Pool component (#45). For now consider this as a effortless kludge which will be removed anyway.
@ -284,0 +367,4 @@
return
}
func (c *ServiceClientGRPC) requestWithRetry(fn func(treeClient) error) (err error) {
Not that it matters, but how about something like this:
Can avoid per-method wrappers with this.
f0bbd5dcc2
to276427d70e
@ -284,0 +330,4 @@
type grpcFunc[Req any, Resp any] func(context.Context, Req, ...grpc.CallOption) (Resp, error)
func requestWithRetry[Req any, Resp any](ctx context.Context, req Req, c *ServiceClientGRPC, fn func(client treeClient) grpcFunc[Req, Resp]) (res Resp, err error) {
for _, client := range c.clients {
Current implementation uses any available client in the
c.clients
that comes up first thus we use the clients in the beginning more often that the ones in the end of it. Also, we iterate through some part of the list on each request going throughrequestWithRetry
. I don't insist but may be we should change this?All implementations of round-robin approaches that I know suppose a cycling system: we go through a set of resources and distribute them one by one from start of a "list" to the end, and then we start over again. This way we achieve somewhat equal utilisation and don't have to look through a "list" of resources every time we need one.
Example of a round-robin approach: https://en.wikipedia.org/wiki/Round-robin_scheduling
Good point. I'll change behavior to start iterate client at the index where we stop previously.
As I understand we cannot drop iterating clients at all because we want to retry failed request
/cc @alexvanin @a.bogatyrev
2d9605dc91
toaca55c6d2f
9702998350
toc4dfd06377
c4dfd06377
toac177dab2e
35b7c3abc2
tod682487c9c
d682487c9c
toce11fd3757
ce11fd3757
to69d8779daf