scylladb / scylla-machine-image

Apache License 2.0
18 stars 25 forks source link

Limit deeper C-states to reduce latency #430

Closed syuu1228 closed 1 year ago

syuu1228 commented 1 year ago

Since we want maximum performance and low latency, we need to disable deeper C-states on instances.

Fixes #425

syuu1228 commented 1 year ago

Verified boot finely, but I'm not sure how to check intel_idle.max_cstate=1 and processor.max_cstate=1 are working. AWS doc suggested to useturbostat to do that, but I coudn't able to run it in our image.

syuu1228 commented 1 year ago

Okay, I realized that why I couldn't execute turbostat was because i3.xlarge does not supported it. I able to execute it in i3.metal and verified deepest C state becomes C1:

$ sudo turbostat stress -c 2 -t 10
...
Package Core    CPU     Avg_MHz Busy%   Bzy_MHz TSC_MHz IPC     IRQ     SMI     POLL    C1      POLL%   C1%     CPU%c1  CPU%c3  CPU%c6  CoreTmp PkgTmp  Pkg%pc2 Pkg%pc3    PkgWatt RAMWatt PKG_%   RAM_%
-       -       -       52      1.81    2700    2453    1.41    442     0       0       430     0.00    104.77  98.19   0.00    0.00    36      42      0.00    0.00       125.49  27.42   0.00    0.00
0       0       0       42      1.56    2700    2300    0.44    13      0       0       6       0.00    98.52   98.44   0.00    0.00    36      42      0.00    0.00       55.53   12.63   0.00    0.00
0       0       36      23      0.84    2697    2299    0.47    9       0       0       6       0.00    99.19   99.16
0       1       1       24      0.91    2700    2300    0.42    6       0       0       6       0.00    99.17   99.09   0.00    0.00    35
0       1       37      21      0.79    2700    2300    0.47    6       0       0       6       0.00    99.27   99.21
0       2       2       24      0.90    2701    2300    0.41    7       0       0       6       0.00    99.17   99.10   0.00    0.00    35
0       2       38      21      0.76    2700    2300    0.48    6       0       0       6       0.00    99.28   99.24
0       3       3       24      0.88    2701    2300    0.43    6       0       0       6       0.00    99.17   99.12   0.00    0.00    35
0       3       39      20      0.74    2700    2300    0.49    7       0       0       6       0.00    99.30   99.26
0       4       4       26      0.96    2700    2300    0.43    6       0       0       6       0.00    99.08   99.04   0.00    0.00    34
0       4       40      21      0.76    2700    2300    0.50    6       0       0       6       0.00    99.28   99.24
0       8       5       26      0.97    2700    2300    0.42    7       0       0       6       0.00    99.10   99.03   0.00    0.00    35
0       8       41      21      0.78    2701    2300    0.48    6       0       0       6       0.00    99.28   99.22
0       9       6       26      0.98    2700    2300    0.42    6       0       0       6       0.00    99.07   99.02   0.00    0.00    35
0       9       42      21      0.78    2700    2300    0.47    6       0       0       6       0.00    99.26   99.22
0       10      7       25      0.93    2701    2300    0.43    7       0       0       6       0.00    99.15   99.07   0.00    0.00    36
0       10      43      21      0.77    2700    2300    0.48    6       0       0       6       0.00    99.28   99.23
0       11      8       26      0.95    2700    2300    0.41    7       0       0       6       0.00    99.10   99.05   0.00    0.00    35
0       11      44      21      0.78    2699    2300    0.48    7       0       0       6       0.00    99.27   99.22
0       16      9       26      0.98    2700    2300    0.42    6       0       0       6       0.00    99.09   99.02   0.00    0.00    36
0       16      45      22      0.80    2700    2300    0.47    6       0       0       6       0.00    99.26   99.20
0       17      10      27      0.99    2700    2300    0.43    7       0       0       6       0.00    99.07   99.01   0.00    0.00    35
0       17      46      21      0.78    2701    2300    0.50    6       0       0       6       0.00    99.27   99.22
0       18      11      25      0.91    2701    2300    0.41    6       0       0       6       0.00    99.15   99.09   0.00    0.00    34
0       18      47      21      0.78    2699    2300    0.49    7       0       0       6       0.00    99.28   99.22
0       19      12      27      1.00    2700    2300    0.43    6       0       0       6       0.00    99.06   99.00   0.00    0.00    34
0       19      48      22      0.81    2701    2300    0.48    6       0       0       6       0.00    99.24   99.19
0       20      13      26      0.97    2700    2300    0.42    6       0       0       6       0.00    99.09   99.03   0.00    0.00    35
0       20      49      22      0.82    2701    2300    0.48    6       0       0       6       0.00    99.25   99.18
0       24      14      25      0.91    2701    2300    0.44    6       0       0       6       0.00    99.15   99.09   0.00    0.00    35
0       24      50      21      0.79    2701    2300    0.50    7       0       0       6       0.00    99.27   99.21
0       25      15      25      0.93    2701    2300    0.44    6       0       0       6       0.00    99.13   99.07   0.00    0.00    35
0       25      51      21      0.77    2700    2300    0.51    6       0       0       6       0.00    99.28   99.23
0       26      16      27      1.00    2700    2300    0.42    6       0       0       6       0.00    99.06   99.00   0.00    0.00    34
0       26      52      22      0.83    2700    2300    0.48    7       0       0       6       0.00    99.24   99.17
0       27      17      27      1.01    2701    2300    0.42    6       0       0       6       0.00    99.06   98.99   0.00    0.00    34
0       27      53      24      0.88    2700    2300    0.46    6       0       0       5       0.00    99.17   99.12
1       0       18      28      1.04    2700    2300    0.39    6       0       0       5       0.00    99.04   98.96   0.00    0.00    30      36      0.00    0.00       58.69   12.29   0.00    0.00
1       0       54      29      1.09    2700    2300    0.53    6       0       0       6       0.00    98.96   98.91
1       1       19      26      0.96    2701    2300    0.43    5       0       0       5       0.00    99.09   99.04   0.00    0.00    30
1       1       55      22      0.80    2702    2300    0.49    6       0       0       5       0.00    99.24   99.20
1       2       20      24      0.91    2701    2300    0.44    7       0       0       5       0.00    99.15   99.09   0.00    0.00    31
1       2       56      78      2.89    2700    2300    0.78    9       0       0       6       0.00    97.17   97.11
1       3       21      27      0.99    2699    2300    0.43    5       0       0       6       0.00    99.07   99.01   0.00    0.00    31
1       3       57      23      0.85    2700    2300    0.48    6       0       0       6       0.00    99.19   99.15
1       4       22      27      0.98    2700    2300    0.42    6       0       0       6       0.00    99.08   99.02   0.00    0.00    31
1       4       58      22      0.83    2701    2300    0.53    6       0       0       6       0.00    99.24   99.17
1       8       23      27      1.02    2701    2300    0.41    5       0       0       6       0.00    99.05   98.98   0.00    0.00    30
1       8       59      23      0.85    2701    2300    0.48    5       0       0       6       0.00    99.22   99.15
1       9       24      26      0.98    2700    2300    0.44    5       0       0       6       0.00    99.09   99.02   0.00    0.00    32
1       9       60      22      0.82    2700    2300    0.49    5       0       0       6       0.00    99.23   99.18
1       10      25      32      1.18    2701    2300    0.43    6       0       0       7       0.00    98.89   98.82   0.00    0.00    31
1       10      61      23      0.86    2700    2300    0.48    5       0       0       6       0.00    99.20   99.14
1       11      26      26      0.96    2700    2300    0.45    5       0       0       6       0.00    99.10   99.04   0.00    0.00    31
1       11      62      21      0.77    2700    2300    0.52    5       0       0       6       0.00    99.28   99.23
1       16      27      28      1.05    2700    2300    0.43    5       0       0       6       0.00    99.03   98.95   0.00    0.00    32
1       16      63      27      0.99    2700    2300    0.52    7       0       0       11      0.00    99.10   99.01
1       17      28      28      1.04    2700    2300    0.43    5       0       0       6       0.00    99.01   98.96   0.00    0.00    32
1       17      64      22      0.83    2701    2300    0.50    6       0       0       6       0.00    99.24   99.17
1       18      29      28      1.04    2701    2300    0.42    5       0       0       6       0.00    99.03   98.96   0.00    0.00    30
1       18      65      22      0.82    2700    2300    0.50    5       0       0       6       0.00    99.23   99.18
1       19      30      28      1.02    2700    2300    0.42    5       0       0       6       0.00    99.05   98.98   0.00    0.00    29
1       19      66      22      0.82    2700    2300    0.51    7       0       0       6       0.00    99.26   99.18
1       20      31      29      1.09    2701    2300    0.41    5       0       0       6       0.00    98.97   98.91   0.00    0.00    31
1       20      67      24      0.89    2701    2300    0.47    5       0       0       6       0.00    99.17   99.11
1       24      32      29      1.06    2700    2300    0.47    6       0       0       6       0.00    99.00   98.94   0.00    0.00    31
1       24      68      23      0.84    2701    2300    0.50    6       0       0       6       0.00    99.21   99.16
1       25      33      28      1.03    2700    2300    0.43    5       0       0       6       0.00    99.03   98.97   0.00    0.00    30
1       25      69      24      0.88    2700    2300    0.49    5       0       0       6       0.00    99.19   99.12
1       26      34      27      1.01    2700    2300    0.42    5       0       0       6       0.00    99.04   98.99   0.00    0.00    30
1       26      70      21      0.79    2700    2300    0.51    6       0       0       6       0.00    99.29   99.21
1       27      35      29      1.07    2700    2300    0.43    12      0       0       6       0.00    98.99   98.93   0.00    0.00    31
1       27      71      1813    67.15   2700    2300    2.42    3       0       0       3       0.00    32.87   32.85

I also verified without the kernel parameter deepest C state becomes C6 just like described in AWS document.

And I realized the PR title "Disable C1 sleep state" is not correct, it should be "Limit deeper C-states".

yaronkaikov commented 1 year ago

Verified with https://jenkins.scylladb.com/job/scylla-master/job/releng-testing/job/next-machine-image/54/