diff --git a/pgs/ssh.go b/pgs/ssh.go index 4d6b097..07e9ca4 100644 --- a/pgs/ssh.go +++ b/pgs/ssh.go @@ -3,6 +3,8 @@ package pgs import ( "context" "fmt" + "net/http" + _ "net/http/pprof" "os" "os/signal" "syscall" @@ -96,6 +98,10 @@ func StartSshServer() { HttpHandler: createHttpHandler(apiConfig), } + go func() { + http.ListenAndServe("0.0.0.0:6060", nil) + }() + sshAuth := util.NewSshAuthHandler(dbpool, logger, cfg) s, err := wish.NewServer( wish.WithAddress(fmt.Sprintf("%s:%s", host, port)), diff --git a/pprof.txt b/pprof.txt new file mode 100644 index 0000000..04c9f61 --- /dev/null +++ b/pprof.txt @@ -0,0 +1,53 @@ +# Ran + +- `go tool pprof -seconds=30 http://localhost:6060/debug/pprof/heap` +- uploaded files a bunch of times +- ran `top25` + +# SFTP + +(pprof) top25 +Showing nodes accounting for 528MB, 98.70% of 534.96MB total +Dropped 51 nodes (cum <= 2.67MB) + flat flat% sum% cum cum% + 528MB 98.70% 98.70% 528MB 98.70% github.com/minio/minio-go/v7.(*Client).putObjectMultipartStreamNoLength + 0 0% 98.70% 528MB 98.70% github.com/minio/minio-go/v7.(*Client).PutObject + 0 0% 98.70% 528MB 98.70% github.com/minio/minio-go/v7.(*Client).putObjectCommon + 0 0% 98.70% 528MB 98.70% github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).Write + 0 0% 98.70% 528MB 98.70% github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).writeAsset + 0 0% 98.70% 528MB 98.70% github.com/picosh/pobj/storage.(*StorageMinio).PutObject + 0 0% 98.70% 528MB 98.70% github.com/picosh/send/send/sftp.(*handler).Filewrite + 0 0% 98.70% 528MB 98.70% github.com/pkg/sftp.(*Request).open + 0 0% 98.70% 528MB 98.70% github.com/pkg/sftp.(*RequestServer).Serve.func2.1 + 0 0% 98.70% 528MB 98.70% github.com/pkg/sftp.(*RequestServer).packetWorker + 0 0% 98.70% 6.44MB 1.20% runtime.doInit (inline) + 0 0% 98.70% 6.44MB 1.20% runtime.doInit1 + 0 0% 98.70% 6.44MB 1.20% runtime.main + +# RSYNC + +Showing nodes accounting for 528MB, 98.75% of 534.66MB total +Dropped 46 nodes (cum <= 2.67MB) + flat flat% sum% cum cum% + 528MB 98.75% 98.75% 528.52MB 98.85% github.com/minio/minio-go/v7.(*Client).putObjectMultipartStreamNoLength + 0 0% 98.75% 529.58MB 99.05% github.com/antoniomika/go-rsync-receiver/rsyncreceiver.(*recvTransfer).receiveData + 0 0% 98.75% 529.58MB 99.05% github.com/antoniomika/go-rsync-receiver/rsyncreceiver.(*recvTransfer).recvFile1 (inline) + 0 0% 98.75% 529.58MB 99.05% github.com/antoniomika/go-rsync-receiver/rsyncreceiver.(*recvTransfer).recvFiles + 0 0% 98.75% 529.58MB 99.05% github.com/antoniomika/go-rsync-receiver/rsyncreceiver.ClientRun + 0 0% 98.75% 530.08MB 99.14% github.com/charmbracelet/promwish.MiddlewareRegistry.func1.1 + 0 0% 98.75% 530.08MB 99.14% github.com/charmbracelet/ssh.(*session).handleRequests.func1 + 0 0% 98.75% 528.52MB 98.85% github.com/minio/minio-go/v7.(*Client).PutObject + 0 0% 98.75% 528.52MB 98.85% github.com/minio/minio-go/v7.(*Client).putObjectCommon + 0 0% 98.75% 529.02MB 98.94% github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).Write + 0 0% 98.75% 529.02MB 98.94% github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).writeAsset + 0 0% 98.75% 530.08MB 99.14% github.com/picosh/pico/pgs.createRouter.func1.LogMiddleware.9.1 + 0 0% 98.75% 529.58MB 99.05% github.com/picosh/pico/pgs.createRouter.func1.Middleware.4.1 + 0 0% 98.75% 530.08MB 99.14% github.com/picosh/pico/pgs.createRouter.func1.Middleware.5.1 + 0 0% 98.75% 530.08MB 99.14% github.com/picosh/pico/pgs.createRouter.func1.PtyMdw.7.1 + 0 0% 98.75% 530.08MB 99.14% github.com/picosh/pico/pgs.createRouter.func1.WishMiddleware.8.1 + 0 0% 98.75% 528.52MB 98.85% github.com/picosh/pobj/storage.(*StorageMinio).PutObject + 0 0% 98.75% 530.08MB 99.14% github.com/picosh/send/proxy.WithProxy.func1.1 + 0 0% 98.75% 529.02MB 98.94% github.com/picosh/send/send/rsync.(*handler).Put + 0 0% 98.75% 3.55MB 0.66% runtime.doInit (inline) + 0 0% 98.75% 3.55MB 0.66% runtime.doInit1 + 0 0% 98.75% 3.55MB 0.66% runtime.main