increase consumers and make choice more direct

This commit is contained in:
Andre Medeiros 2022-10-31 17:33:41 -04:00
parent 62df908b33
commit df0860dd05
3 changed files with 15 additions and 16 deletions

View file

@ -50,7 +50,7 @@ func SchedulerCmd(ctx context.Context) *cobra.Command {
}
defer db.Close()
redis, err := cmdutil.NewRedisClient(ctx, 2)
redis, err := cmdutil.NewRedisClient(ctx, 16)
if err != nil {
return err
}

View file

@ -23,7 +23,7 @@ var (
)
func WorkerCmd(ctx context.Context) *cobra.Command {
var multiplier int
var consumers int
var queueID string
cmd := &cobra.Command{
@ -46,10 +46,9 @@ func WorkerCmd(ctx context.Context) *cobra.Command {
}
defer statsd.Close()
consumers := runtime.NumCPU() * multiplier
poolSize := multiplier / 4
poolSize := consumers / 4
runtime.GOMAXPROCS(multiplier)
runtime.GOMAXPROCS(consumers)
db, err := cmdutil.NewDatabasePool(ctx, poolSize)
if err != nil {
@ -57,7 +56,7 @@ func WorkerCmd(ctx context.Context) *cobra.Command {
}
defer db.Close()
redis, err := cmdutil.NewRedisClient(ctx, multiplier)
redis, err := cmdutil.NewRedisClient(ctx, consumers)
if err != nil {
return err
}
@ -86,7 +85,7 @@ func WorkerCmd(ctx context.Context) *cobra.Command {
},
}
cmd.Flags().IntVar(&multiplier, "multiplier", 32, "The multiplier (by CPUs) to run")
cmd.Flags().IntVar(&consumers, "consumers", runtime.NumCPU()*64, "The consumers to run")
cmd.Flags().StringVar(&queueID, "queue", "", "The queue to work on")
return cmd

View file

@ -34,7 +34,7 @@ services:
- key: DEFAULT_POOL_SIZE
value: 178
- key: MAX_CLIENT_CONN
value: 1024
value: 2048
- key: MIN_POOL_SIZE
value: 8
- key: POOL_MODE
@ -79,7 +79,7 @@ services:
- type: worker
name: worker.notifications
env: go
plan: starter plus
plan: starter
envVars:
- fromGroup: env-settings
- key: BUGSNAG_APP_TYPE
@ -87,11 +87,11 @@ services:
- key: BUGSNAG_METADATA_QUEUE
value: notifications
scaling:
minInstances: 2
maxInstances: 20
minInstances: 20
maxInstances: 50
targetCPUPercent: 60
buildCommand: go install github.com/bugsnag/panic-monitor@latest && go build ./cmd/apollo
startCommand: panic-monitor ./apollo worker --queue notifications
startCommand: panic-monitor ./apollo worker --queue notifications --consumers 512
# Stuck Notifications Checker
- type: worker
@ -109,7 +109,7 @@ services:
maxInstances: 10
targetCPUPercent: 60
buildCommand: go install github.com/bugsnag/panic-monitor@latest && go build ./cmd/apollo
startCommand: panic-monitor ./apollo worker --queue stuck-notifications --multiplier 64
startCommand: panic-monitor ./apollo worker --queue stuck-notifications --consumers 64
# Scheduler
- type: worker
@ -135,7 +135,7 @@ services:
- key: BUGSNAG_METADATA_QUEUE
value: users
buildCommand: go install github.com/bugsnag/panic-monitor@latest && go build ./cmd/apollo
startCommand: panic-monitor ./apollo worker --queue users --multiplier 16
startCommand: panic-monitor ./apollo worker --queue users
# Subreddit Watcher
- type: worker
@ -153,7 +153,7 @@ services:
maxInstances: 10
targetCPUPercent: 60
buildCommand: go install github.com/bugsnag/panic-monitor@latest && go build ./cmd/apollo
startCommand: panic-monitor ./apollo worker --queue subreddits --multiplier 64
startCommand: panic-monitor ./apollo worker --queue subreddits
# Trending Posts Watcher
- type: worker
@ -171,7 +171,7 @@ services:
maxInstances: 10
targetCPUPercent: 60
buildCommand: go install github.com/bugsnag/panic-monitor@latest && go build ./cmd/apollo
startCommand: panic-monitor ./apollo worker --queue trending --multiplier 64
startCommand: panic-monitor ./apollo worker --queue trending
# Live Activities
- type: worker