Scientists started to make records of sunspot activity in the mid 18th century, and by the mid 19th it was discovered that the number of spots (which are lower-temperature entry-and-exit points for magnetic flux lines penetrating the Sun's surface) varies on a very regular cycle of approximately 11.1 years.
The reason for the oscillation is unknown.
We are currently in the 25th recorded cycle.
The magnetic poles of the sun flip with each cycle, so it may be more accurately described as a 22.2 year cycle.
The cycles are now being intensely studied - because the intensity of solar flares and magnetic events on the Sun, which are also linked to the cycle, have been found to strongly affect electronic equipment in Earth orbit. As well as influencing weather events and biological systems etc.
Further reading : The calm before the storms Science, Vol. 364, Issue 6443, pp. 818-821, May 2019.
Also see : Solar flares