Example 18 Let $x, y, z$ be real numbers, not all zero, find the maximum value of $f(x, y, z)=\frac{x y+2 y z}{x^{2}+y^{2}+z^{2}}$.
Solution 1 Notice the arithmetic mean inequality, and introduce two parameters $\lambda_{1}, \lambda_{2}>0$, we have
$$
\begin{aligned}
x y+2 y z & \leqslant \frac{1}{2}\left(\lambda_{1} x^{2}+\frac{1}{\lambda_{1}} y^{2}\right)+\left(\lambda_{2} y^{2}+\frac{1}{\lambda_{2}} z^{2}\right) \\
& =\frac{1}{2} \lambda_{1} x^{2}+\left(\frac{1}{2 \lambda_{1}}+\lambda_{2}\right) y^{2}+\frac{1}{\lambda_{2}} z^{2} .
\end{aligned}
$$

Let $\frac{1}{2} \lambda_{1}=\frac{1}{2 \lambda_{1}}+\lambda_{2}=\frac{1}{\lambda_{2}}$, solving yields $\lambda_{1}=\sqrt{5}, \lambda_{2}=\frac{2 \sqrt{5}}{5}$.
Thus, $f(x, y, z)=\frac{x y+2 y z}{x^{2}+y^{2}+z^{2}} \leqslant \frac{\frac{\sqrt{5}}{2}\left(x^{2}+y^{2}+z^{2}\right)}{x^{2}+y^{2}+z^{2}}=\frac{\sqrt{5}}{2}$ is the desired result.
Solution 2 Notice the introduction of a parameter $\lambda>0$ and the application of the arithmetic mean inequality, we have $x^{2}+y^{2}+z^{2}=x^{2}+\lambda y^{2}+(1-\lambda) y^{2}+z^{2} \geqslant 2 \sqrt{\lambda} x y+2 \sqrt{1-\lambda} y z$. Let $\frac{2 \sqrt{1-\lambda}}{2 \sqrt{\lambda}}=2$, solving yields $\lambda=\frac{1}{5}$. Thus, $f(x, y, z)=\frac{x y+2 y z}{x^{2}+y^{2}+z^{2}} \leqslant \frac{x y+2 y z}{2 \sqrt{\frac{1}{5}} x y+4 \sqrt{\frac{1}{5}} y z}=\frac{\sqrt{5}}{2}$ is the desired result.