Skip to content
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

[WIP] Performance tuning #3932

Draft
wants to merge 18 commits into
base: edge
Choose a base branch
from
Draft

Conversation

butonic
Copy link
Contributor

@butonic butonic commented Jun 5, 2023

This is work in progress where we document some performance tweaks we made when running on a large scale deployment. We will extract individual PRs from this to make reviewing easier.

  1. jsoncs3 concurrency concurrently invalidate mtime cache in jsoncs3 share manager #3933
  2. sharesstorageprovider stat cache add stat cache to sharesstorageprovider #3940
  3. reuse connections properly, requires upstream fixes enhancement: introduce micro registry and client pool selectors #3939
  4. drop locks in jsoncs3 [wip] Jsoncs3 investigate #3935
  5. add tracing in various places
  6. helm file changes: add settings cache store owncloud/ocis-charts#299

fschade and others added 18 commits May 28, 2023 15:27
replace the prepared service registry with a go micro service registry
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
Signed-off-by: Jörn Friedrich Dreyer <[email protected]>
@@ -300,13 +300,18 @@
return u, tokenScope, nil
}

func getUserGroups(ctx context.Context, u *userpb.User, client gatewayv1beta1.GatewayAPIClient) ([]string, error) {
func getUserGroups(ctx context.Context, u *userpb.User, selector pool.Selectable[gateway.GatewayAPIClient]) ([]string, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ',' in parameter list

@@ -124,13 +128,18 @@ func expandAndVerifyScope(ctx context.Context, req interface{}, tokenScope map[s
return errtypes.PermissionDenied(fmt.Sprintf("access to resource %+v not allowed within the assigned scope", req))
}

func resolveLightweightScope(ctx context.Context, ref *provider.Reference, scope *authpb.Scope, user *userpb.User, client gateway.GatewayAPIClient, mgr token.Manager) error {
func resolveLightweightScope(ctx context.Context, ref *provider.Reference, scope *authpb.Scope, user *userpb.User, selector pool.Selectable[gateway.GatewayAPIClient], mgr token.Manager) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ',' in parameter list (and 10 more errors)

@@ -163,6 +166,8 @@
providerCache cache.ProviderCache
createHomeCache cache.CreateHomeCache
createPersonalSpaceCache cache.CreatePersonalSpaceCache
authRegistrySelector pool.Selectable[auth.RegistryAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 2 more errors)

"strings"

gateway "github.com/cs3org/go-cs3apis/cs3/gateway/v1beta1"
userv1beta1 "github.com/cs3org/go-cs3apis/cs3/identity/user/v1beta1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 10 more errors)


// Options represent options
type Options struct {
GatewaySelector pool.Selectable[gateway.GatewayAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 2 more errors)

// Handler handles propfind requests
type Handler struct {
PublicURL string
getClient GetGatewayServiceClientFunc
selector pool.Selectable[gateway.GatewayAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 10 more errors)

@@ -37,8 +38,8 @@ import (
// LookupReferenceForPath returns:
// a reference with root and relative path
// the status and error for the lookup
func LookupReferenceForPath(ctx context.Context, client gateway.GatewayAPIClient, path string) (*storageProvider.Reference, *rpc.Status, error) {
space, cs3Status, err := LookUpStorageSpaceForPath(ctx, client, path)
func LookupReferenceForPath(ctx context.Context, selector pool.Selectable[gateway.GatewayAPIClient], path string) (*storageProvider.Reference, *rpc.Status, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ',' in parameter list (and 1 more errors)

@@ -161,7 +168,7 @@ func (s *svc) handleTPCPull(ctx context.Context, w http.ResponseWriter, r *http.
fmt.Fprintf(w, "success: Created")
}

func (s *svc) performHTTPPull(ctx context.Context, client gateway.GatewayAPIClient, r *http.Request, w http.ResponseWriter, ns string) error {
func (s *svc) performHTTPPull(ctx context.Context, selector pool.Selectable[gateway.GatewayAPIClient], r *http.Request, w http.ResponseWriter, ns string) error {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ',' in parameter list


// ID returns the node ID.
ID() string
func GetRegistry() mRegistry.Registry {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

exported function GetRegistry should have comment or be unexported

// CS3 represents a metadata storage with a cs3 storage backend
type CS3 struct {
providerAddr string
gatewayAddr string
providerSelector pool.Selectable[provider.ProviderAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 5 more errors)

"google.golang.org/grpc/metadata"
)

// Impersonate returns an authenticated reva context and the user it represents
func Impersonate(userID *user.UserId, gwc gateway.GatewayAPIClient, machineAuthAPIKey string) (context.Context, *user.User, error) {
usr, err := GetUser(userID, gwc, machineAuthAPIKey)
func Impersonate(userID *user.UserId, selector pool.Selectable[gateway.GatewayAPIClient], machineAuthAPIKey string) (context.Context, *user.User, error) {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing ',' in parameter list (and 2 more errors)

@@ -45,7 +46,7 @@ type Options struct {
JWTSecret string

FavoriteManager favorite.Manager
GatewayClient gateway.GatewayAPIClient
GatewaySelector pool.Selectable[gateway.GatewayAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 2 more errors)

@@ -58,7 +58,7 @@ func init() {

// Manager implements a publicshare manager using a cs3 storage backend
type Manager struct {
gatewayClient gateway.GatewayAPIClient
gatewaySelector pool.Selectable[gateway.GatewayAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 7 more errors)

"google.golang.org/grpc"
)

type Selectable[T any] interface {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ']', found any (and 4 more errors)

@@ -145,8 +149,8 @@ type Manager struct {

initialized bool

gateway gatewayv1beta1.GatewayAPIClient
eventStream events.Stream
gatewaySelector pool.Selectable[gatewayv1beta1.GatewayAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 10 more errors)

item PermissionsChecker // handles item permissions
space CS3PermissionsClient // handlers space permissions
item PermissionsChecker // handles item permissions
space pool.Selectable[cs3permissions.PermissionsAPIClient] // handlers space permissions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 2 more errors)

@@ -39,14 +40,14 @@ type Downloader interface {
}

type revaDownloader struct {
gtw gateway.GatewayAPIClient
selector pool.Selectable[gateway.GatewayAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 2 more errors)

@@ -46,12 +47,12 @@ type Walker interface {
}

type revaWalker struct {
gtw gateway.GatewayAPIClient
selector pool.Selectable[gateway.GatewayAPIClient]
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expected ';', found '[' (and 2 more errors)

@butonic butonic changed the title [WIP] Performance tunig [WIP] Performance tuning Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants