2. Given positive real numbers $a, b, a<b$. Let $x_{1}, x_{2}, \cdots, x_{2022} \in[a, b]$, find the maximum value of $\frac{\left|x_{1}-x_{2}\right|+\left|x_{2}-x_{3}\right|+\cdots+\left|x_{2021}-x_{2022}\right|+\left|x_{2022}-x_{1}\right|}{x_{1}+x_{2}+\cdots+x_{2022}}$.
First, prove: for $x, y \in [a, b]$, we have $|x-y| \leqslant \frac{b-a}{a+b}(x+y)$.
Without loss of generality, assume $a \leqslant x \leqslant y \leqslant b$, then $1 \leqslant \frac{y}{x} \leqslant \frac{b}{a}$, thus $\frac{|x-y|}{x+y}=\frac{y-x}{y+x}=\frac{\frac{y}{x}-1}{\frac{y}{x}+1}$ $=1-\frac{2}{\frac{y}{x}+1} \leqslant 1-\frac{2}{\frac{b}{a}+1}=1-\frac{2a}{a+b}=\frac{b-a}{a+b} \Rightarrow |x-y| \leqslant \frac{b-a}{a+b}(x+y)$, equality holds when $x=a, y=b$ or $x=b, y=a$.
Therefore, $\frac{|x_{1}-x_{2}|+|x_{2}-x_{3}|+\cdots+|x_{2021}-x_{2022}|+|x_{2022}-x_{1}|}{x_{1}+x_{2}+\cdots+x_{2022}}$ $\leqslant \frac{\frac{b-a}{a+b}\left[(x_{1}+x_{2})+(x_{2}+x_{3})+\cdots+(x_{2021}+x_{2022})+(x_{2022}+x_{1})\right]}{x_{1}+x_{2}+\cdots+x_{2022}}=\frac{2(b-a)}{a+b}$, equality holds when $x_{1}, x_{3}, \cdots, x_{2021}=a, x_{2}, x_{4}, \cdots, x_{2022}=b$.
Thus, the maximum value of the original expression is $\frac{2(b-a)}{a+b}$.