pprof.diff

· erock's pastes · raw

expires: 20 Sep, 2024

 1diff --git a/pgs/ssh.go b/pgs/ssh.go
 2index 4d6b097..07e9ca4 100644
 3--- a/pgs/ssh.go
 4+++ b/pgs/ssh.go
 5@@ -3,6 +3,8 @@ package pgs
 6 import (
 7 	"context"
 8 	"fmt"
 9+	"net/http"
10+	_ "net/http/pprof"
11 	"os"
12 	"os/signal"
13 	"syscall"
14@@ -96,6 +98,10 @@ func StartSshServer() {
15 		HttpHandler: createHttpHandler(apiConfig),
16 	}
17 
18+	go func() {
19+		http.ListenAndServe("0.0.0.0:6060", nil)
20+	}()
21+
22 	sshAuth := util.NewSshAuthHandler(dbpool, logger, cfg)
23 	s, err := wish.NewServer(
24 		wish.WithAddress(fmt.Sprintf("%s:%s", host, port)),
25diff --git a/pprof.txt b/pprof.txt
26new file mode 100644
27index 0000000..04c9f61
28--- /dev/null
29+++ b/pprof.txt
30@@ -0,0 +1,53 @@
31+# Ran
32+
33+- `go tool pprof -seconds=30 http://localhost:6060/debug/pprof/heap`
34+- uploaded files a bunch of times
35+- ran `top25`
36+
37+# SFTP
38+
39+(pprof) top25
40+Showing nodes accounting for 528MB, 98.70% of 534.96MB total
41+Dropped 51 nodes (cum <= 2.67MB)
42+      flat  flat%   sum%        cum   cum%
43+     528MB 98.70% 98.70%      528MB 98.70%  github.com/minio/minio-go/v7.(*Client).putObjectMultipartStreamNoLength
44+         0     0% 98.70%      528MB 98.70%  github.com/minio/minio-go/v7.(*Client).PutObject
45+         0     0% 98.70%      528MB 98.70%  github.com/minio/minio-go/v7.(*Client).putObjectCommon
46+         0     0% 98.70%      528MB 98.70%  github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).Write
47+         0     0% 98.70%      528MB 98.70%  github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).writeAsset
48+         0     0% 98.70%      528MB 98.70%  github.com/picosh/pobj/storage.(*StorageMinio).PutObject
49+         0     0% 98.70%      528MB 98.70%  github.com/picosh/send/send/sftp.(*handler).Filewrite
50+         0     0% 98.70%      528MB 98.70%  github.com/pkg/sftp.(*Request).open
51+         0     0% 98.70%      528MB 98.70%  github.com/pkg/sftp.(*RequestServer).Serve.func2.1
52+         0     0% 98.70%      528MB 98.70%  github.com/pkg/sftp.(*RequestServer).packetWorker
53+         0     0% 98.70%     6.44MB  1.20%  runtime.doInit (inline)
54+         0     0% 98.70%     6.44MB  1.20%  runtime.doInit1
55+         0     0% 98.70%     6.44MB  1.20%  runtime.main
56+
57+# RSYNC
58+
59+Showing nodes accounting for 528MB, 98.75% of 534.66MB total
60+Dropped 46 nodes (cum <= 2.67MB)
61+      flat  flat%   sum%        cum   cum%
62+     528MB 98.75% 98.75%   528.52MB 98.85%  github.com/minio/minio-go/v7.(*Client).putObjectMultipartStreamNoLength
63+         0     0% 98.75%   529.58MB 99.05%  github.com/antoniomika/go-rsync-receiver/rsyncreceiver.(*recvTransfer).receiveData
64+         0     0% 98.75%   529.58MB 99.05%  github.com/antoniomika/go-rsync-receiver/rsyncreceiver.(*recvTransfer).recvFile1 (inline)
65+         0     0% 98.75%   529.58MB 99.05%  github.com/antoniomika/go-rsync-receiver/rsyncreceiver.(*recvTransfer).recvFiles
66+         0     0% 98.75%   529.58MB 99.05%  github.com/antoniomika/go-rsync-receiver/rsyncreceiver.ClientRun
67+         0     0% 98.75%   530.08MB 99.14%  github.com/charmbracelet/promwish.MiddlewareRegistry.func1.1
68+         0     0% 98.75%   530.08MB 99.14%  github.com/charmbracelet/ssh.(*session).handleRequests.func1
69+         0     0% 98.75%   528.52MB 98.85%  github.com/minio/minio-go/v7.(*Client).PutObject
70+         0     0% 98.75%   528.52MB 98.85%  github.com/minio/minio-go/v7.(*Client).putObjectCommon
71+         0     0% 98.75%   529.02MB 98.94%  github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).Write
72+         0     0% 98.75%   529.02MB 98.94%  github.com/picosh/pico/filehandlers/assets.(*UploadAssetHandler).writeAsset
73+         0     0% 98.75%   530.08MB 99.14%  github.com/picosh/pico/pgs.createRouter.func1.LogMiddleware.9.1
74+         0     0% 98.75%   529.58MB 99.05%  github.com/picosh/pico/pgs.createRouter.func1.Middleware.4.1
75+         0     0% 98.75%   530.08MB 99.14%  github.com/picosh/pico/pgs.createRouter.func1.Middleware.5.1
76+         0     0% 98.75%   530.08MB 99.14%  github.com/picosh/pico/pgs.createRouter.func1.PtyMdw.7.1
77+         0     0% 98.75%   530.08MB 99.14%  github.com/picosh/pico/pgs.createRouter.func1.WishMiddleware.8.1
78+         0     0% 98.75%   528.52MB 98.85%  github.com/picosh/pobj/storage.(*StorageMinio).PutObject
79+         0     0% 98.75%   530.08MB 99.14%  github.com/picosh/send/proxy.WithProxy.func1.1
80+         0     0% 98.75%   529.02MB 98.94%  github.com/picosh/send/send/rsync.(*handler).Put
81+         0     0% 98.75%     3.55MB  0.66%  runtime.doInit (inline)
82+         0     0% 98.75%     3.55MB  0.66%  runtime.doInit1
83+         0     0% 98.75%     3.55MB  0.66%  runtime.main