Skip to content

Commit 0f01f72

Browse files
authored
[performance] Bump default workers to CPUs * 2 (#608)
* add license text to workers.go * bump default workers to maxprocs*2
1 parent 5668ce1 commit 0f01f72

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

internal/concurrency/workers.go

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
GoToSocial
3+
Copyright (C) 2021-2022 GoToSocial Authors [email protected]
4+
5+
This program is free software: you can redistribute it and/or modify
6+
it under the terms of the GNU Affero General Public License as published by
7+
the Free Software Foundation, either version 3 of the License, or
8+
(at your option) any later version.
9+
10+
This program is distributed in the hope that it will be useful,
11+
but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
GNU Affero General Public License for more details.
14+
15+
You should have received a copy of the GNU Affero General Public License
16+
along with this program. If not, see <http://www.gnu.org/licenses/>.
17+
*/
18+
119
package concurrency
220

321
import (
@@ -27,7 +45,7 @@ func NewWorkerPool[MsgType any](workers int, queueRatio int) *WorkerPool[MsgType
2745

2846
if workers < 1 {
2947
// ensure sensible workers
30-
workers = runtime.GOMAXPROCS(0)
48+
workers = runtime.GOMAXPROCS(0) * 2
3149
}
3250
if queueRatio < 1 {
3351
// ensure sensible ratio

0 commit comments

Comments
 (0)