summaryrefslogtreecommitdiff
path: root/cmd
diff options
context:
space:
mode:
authorWolfy-J <[email protected]>2018-06-10 18:53:28 +0300
committerWolfy-J <[email protected]>2018-06-10 18:53:28 +0300
commitcb3e7a6b4ec294e7c44c0752f88ffea2297d58b9 (patch)
treeb167af577e1e4b4d77b07e3f77f9fb08dc931d95 /cmd
parent41ae7e1f8c57075ba19c41f4c5c07da1807f8e1b (diff)
nicer command
Diffstat (limited to 'cmd')
-rw-r--r--cmd/rr/.rr.yaml2
-rw-r--r--cmd/rr/http/workers.go14
2 files changed, 14 insertions, 2 deletions
diff --git a/cmd/rr/.rr.yaml b/cmd/rr/.rr.yaml
index 34475da7..bf4c699b 100644
--- a/cmd/rr/.rr.yaml
+++ b/cmd/rr/.rr.yaml
@@ -33,7 +33,7 @@ http:
# worker pool configuration.
pool:
# number of workers to be serving.
- numWorkers: 2
+ numWorkers: 16
# maximum jobs per worker, 0 - unlimited.
maxJobs: 0
diff --git a/cmd/rr/http/workers.go b/cmd/rr/http/workers.go
index 6083f10c..9ad20be7 100644
--- a/cmd/rr/http/workers.go
+++ b/cmd/rr/http/workers.go
@@ -33,6 +33,7 @@ import (
"time"
"github.com/dustin/go-humanize"
"github.com/spiral/roadrunner/cmd/rr/utils"
+ "github.com/shirou/gopsutil/process"
)
func init() {
@@ -61,13 +62,14 @@ func workersHandler(cmd *cobra.Command, args []string) error {
}
tw := tablewriter.NewWriter(os.Stdout)
- tw.SetHeader([]string{"PID", "Status", "Execs", "Created"})
+ tw.SetHeader([]string{"PID", "Status", "Execs", "Memory", "Created"})
for _, w := range r.Workers {
tw.Append([]string{
strconv.Itoa(w.Pid),
renderStatus(w.Status),
renderJobs(w.NumJobs),
+ renderMemory(w.Pid),
renderAlive(time.Unix(0, w.Created)),
})
}
@@ -101,3 +103,13 @@ func renderJobs(number uint64) string {
func renderAlive(t time.Time) string {
return humanize.RelTime(t, time.Now(), "ago", "")
}
+
+func renderMemory(pid int) string {
+ p, _ := process.NewProcess(int32(pid))
+ i, err := p.MemoryInfo()
+ if err != nil {
+ return err.Error()
+ }
+
+ return humanize.Bytes(i.RSS)
+}