2. Function
$$
y=\left|\sqrt{x^{2}+4 x+5}-\sqrt{x^{2}+2 x+5}\right|
$$

The maximum value is $\qquad$.
2. $\sqrt{2}$.

Notice that
$$
\begin{array}{l} 
y= \mid \sqrt{(x+2)^{2}+(0-1)^{2}}- \\
\sqrt{(x+1)^{2}+(0-2)^{2}} \mid .
\end{array}
$$

The above expression represents the absolute value of the difference in distances from point $P(x, 0)$ to points $A(-2,1)$ and $B(-1,2)$ (as shown in Figure 3). Therefore,
$$
\begin{array}{l}
|P A-P B| \\
\leqslant|A B|=\sqrt{2} .
\end{array}
$$

Thus, the maximum value of $y$ is $\sqrt{2}$, which occurs when $x=-3$.