- Notifications
You must be signed in to change notification settings - Fork5.2k
Commit13eb6bb
committed
Fix performance regression with flush of pending fixed-numbered stats
The callback added infc415ed used to check if there is any pendingdata to flush for fixed-numbered statistics, done by looping across allthe builtin and custom stats kinds with a call to have_fixed_pending_cb,is proving to able to show in workloads that do not report any stats(read-only, no function calls, no WAL, no IO, etc). The code used inv17 was cheaper than that what HEAD has introduced, relying on threeboolean checks for WAL, SLRU and IO stats.This commit switches the code to use a more efficient approach thanfc415ed, with a single boolean flag that can be switched to "true"by any fixed-numbered stats kinds to force pgstat_report_stat() to gothrough one round of reports. The flag is reset by pgstat_report_stat()once a full round of reports is done. The flag being false means thatfixed-numbered stats kinds saw no activity, and that there is no pendingdata to flush.ac000fc took one step in improving the performance by reducing thenumber of stats kinds that the backend can hold. This commit takes amore drastic step by bringing back the code efficiency to what it wasbefore v18 with a cheap check at the beginning of pgstat_report_stat()for its fast-exit path.The callback have_static_pending_cb is removed as an effect of all that.Reported-by: Andres Freund <andres@anarazel.de>Reviewed-by: Bertrand Drouvot <bertranddrouvot.pg@gmail.com>Discussion:https://postgr.es/m/eb224uegsga2hgq7dfq3ps5cduhpqej7ir2hjxzzozjthrekx5@dysei6buqtheBackpatch-through: 181 parentbae5078 commit13eb6bb
File tree
7 files changed
+62
-88
lines changed- src
- backend
- access/transam
- utils/activity
- include/utils
7 files changed
+62
-88
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
96 | 96 | | |
97 | 97 | | |
98 | 98 | | |
| 99 | + | |
99 | 100 | | |
100 | 101 | | |
101 | 102 | | |
| |||
1092 | 1093 | | |
1093 | 1094 | | |
1094 | 1095 | | |
| 1096 | + | |
| 1097 | + | |
| 1098 | + | |
1095 | 1099 | | |
1096 | 1100 | | |
1097 | 1101 | | |
| |||
2109 | 2113 | | |
2110 | 2114 | | |
2111 | 2115 | | |
| 2116 | + | |
| 2117 | + | |
| 2118 | + | |
| 2119 | + | |
| 2120 | + | |
| 2121 | + | |
2112 | 2122 | | |
2113 | 2123 | | |
2114 | 2124 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
212 | 212 | | |
213 | 213 | | |
214 | 214 | | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
215 | 220 | | |
216 | 221 | | |
217 | 222 | | |
| |||
370 | 375 | | |
371 | 376 | | |
372 | 377 | | |
373 | | - | |
374 | 378 | | |
375 | 379 | | |
376 | 380 | | |
| |||
437 | 441 | | |
438 | 442 | | |
439 | 443 | | |
440 | | - | |
441 | 444 | | |
442 | 445 | | |
443 | 446 | | |
| |||
455 | 458 | | |
456 | 459 | | |
457 | 460 | | |
458 | | - | |
459 | 461 | | |
460 | 462 | | |
461 | 463 | | |
| |||
474 | 476 | | |
475 | 477 | | |
476 | 478 | | |
477 | | - | |
478 | 479 | | |
479 | 480 | | |
480 | 481 | | |
| |||
708 | 709 | | |
709 | 710 | | |
710 | 711 | | |
711 | | - | |
| 712 | + | |
| 713 | + | |
712 | 714 | | |
713 | | - | |
714 | | - | |
715 | | - | |
716 | | - | |
717 | | - | |
718 | | - | |
719 | | - | |
720 | | - | |
721 | | - | |
722 | | - | |
723 | | - | |
724 | | - | |
725 | | - | |
726 | | - | |
727 | | - | |
728 | | - | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
| 715 | + | |
734 | 716 | | |
735 | 717 | | |
736 | 718 | | |
| |||
784 | 766 | | |
785 | 767 | | |
786 | 768 | | |
787 | | - | |
| 769 | + | |
788 | 770 | | |
789 | | - | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
790 | 774 | | |
791 | | - | |
792 | | - | |
793 | | - | |
794 | | - | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
795 | 779 | | |
796 | | - | |
| 780 | + | |
| 781 | + | |
797 | 782 | | |
798 | 783 | | |
799 | 784 | | |
| |||
815 | 800 | | |
816 | 801 | | |
817 | 802 | | |
| 803 | + | |
818 | 804 | | |
819 | 805 | | |
820 | 806 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| 69 | + | |
69 | 70 | | |
70 | 71 | | |
71 | 72 | | |
| |||
81 | 82 | | |
82 | 83 | | |
83 | 84 | | |
| 85 | + | |
84 | 86 | | |
85 | 87 | | |
86 | 88 | | |
| |||
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | | - | |
312 | | - | |
313 | | - | |
314 | | - | |
315 | | - | |
316 | 306 | | |
317 | 307 | | |
318 | 308 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
80 | 80 | | |
81 | 81 | | |
82 | 82 | | |
| 83 | + | |
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| |||
167 | 168 | | |
168 | 169 | | |
169 | 170 | | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | 171 | | |
180 | 172 | | |
181 | 173 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
143 | 143 | | |
144 | 144 | | |
145 | 145 | | |
146 | | - | |
147 | | - | |
148 | | - | |
149 | | - | |
150 | | - | |
151 | | - | |
152 | | - | |
153 | | - | |
154 | | - | |
155 | 146 | | |
156 | 147 | | |
157 | 148 | | |
| |||
247 | 238 | | |
248 | 239 | | |
249 | 240 | | |
| 241 | + | |
250 | 242 | | |
251 | 243 | | |
252 | 244 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
74 | 83 | | |
75 | 84 | | |
76 | 85 | | |
| |||
92 | 101 | | |
93 | 102 | | |
94 | 103 | | |
95 | | - | |
| 104 | + | |
96 | 105 | | |
97 | 106 | | |
98 | 107 | | |
| |||
136 | 145 | | |
137 | 146 | | |
138 | 147 | | |
139 | | - | |
140 | | - | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
147 | | - | |
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
295 | 295 | | |
296 | 296 | | |
297 | 297 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | 298 | | |
306 | | - | |
307 | | - | |
| 299 | + | |
| 300 | + | |
308 | 301 | | |
309 | | - | |
| 302 | + | |
310 | 303 | | |
311 | 304 | | |
312 | 305 | | |
| |||
627 | 620 | | |
628 | 621 | | |
629 | 622 | | |
630 | | - | |
631 | 623 | | |
632 | 624 | | |
633 | 625 | | |
| |||
676 | 668 | | |
677 | 669 | | |
678 | 670 | | |
679 | | - | |
680 | 671 | | |
681 | 672 | | |
682 | 673 | | |
| |||
738 | 729 | | |
739 | 730 | | |
740 | 731 | | |
741 | | - | |
742 | 732 | | |
743 | 733 | | |
744 | 734 | | |
| |||
750 | 740 | | |
751 | 741 | | |
752 | 742 | | |
753 | | - | |
754 | 743 | | |
755 | 744 | | |
756 | 745 | | |
| |||
778 | 767 | | |
779 | 768 | | |
780 | 769 | | |
781 | | - | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
782 | 784 | | |
| 785 | + | |
| 786 | + | |
783 | 787 | | |
784 | 788 | | |
785 | 789 | | |
| |||
0 commit comments
Comments
(0)