Enable blocking profiles. (#3957)

Per https://golang.org/pkg/runtime/#SetBlockProfileRate, to use blocking
profiling we need to set a profile rate. This enables it at once per
second. This might help us debug the problem where Publisher sometimes
stalls on submitting to all logs.
This commit is contained in:
Jacob Hoffman-Andrews 2018-12-03 10:25:45 -08:00 committed by Roland Bracewell Shoemaker
parent bd4c254942
commit 9e39680e3f
2 changed files with 8 additions and 0 deletions

View File

@ -3,6 +3,7 @@ package main
import (
"flag"
"os"
"runtime"
"time"
ct "github.com/google/certificate-transparency-go"
@ -19,6 +20,10 @@ type config struct {
Publisher struct {
cmd.ServiceConfig
Features map[string]bool
// If this is non-zero, profile blocking events such that one even is
// sampled every N nanoseconds.
// https://golang.org/pkg/runtime/#SetBlockProfileRate
BlockProfileRate int
}
Syslog cmd.SyslogConfig
@ -46,6 +51,8 @@ func main() {
err = features.Set(c.Publisher.Features)
cmd.FailOnError(err, "Failed to set feature flags")
runtime.SetBlockProfileRate(c.Publisher.BlockProfileRate)
if *grpcAddr != "" {
c.Publisher.GRPC.Address = *grpcAddr
}

View File

@ -1,5 +1,6 @@
{
"publisher": {
"blockProfileRate": 1000000000,
"maxConcurrentRPCServerRequests": 100000,
"submissionTimeout": "5s",
"debugAddr": ":8009",