Growth of $r_{2}(n)$ Let $n$ be a positive integer. From Jacobi's two-square theorem we know that the number $r_{2}(n)$ of representations of $n$ as a sum of two squares is given by
$$
r_{2}(n)=4(d_{1}(n)-d_{3}(n)),
$$
where
$$
d_{i}(n)=\sum_{d\mid n,d\equiv i{\rm (mod\,4)}} 1.
$$
But, what can we say about the growth of $r_{2}(n)$ when $n$ increases? Is it a polynomial or logarithmic growth (according to $n$)? and what is the best-known approximation in this sense?
Thank you.
 A: Plotting records (from A071383 and A071385) suggests that an upper bound of the form
$$
\log r_2(n)\ll\log^\alpha n
$$
is plausible, perhaps for $\alpha$ around $0.6$ or $0.7$. Polynomial bounds seem too large, while polylog bounds seem too small.
Edit: See the answer by GH from MO which shows that
$$
\leq\frac{(\log 2+o(1))\log n}{\log\log n}
$$
should be used in place of $\ll\log^\alpha n.$
A: It is known that $f(n):=r_2(n)/4$ is a multiplicative function such that for $p\equiv 1\pmod{4}$ we have $f(p^k)=k+1$, while for $p\equiv 3\pmod{4}$ we have $f(p^k)=1$ or $f(p^k)=0$ depending on whether $k$ is even or odd. Using this information, one can show that
$$r_2(n)\leq n^{\frac{\log 2+o(1)}{\log\log n}},$$
and this is best possible in the sense that $\log 2$ cannot be lowered here. The proof goes almost verbatim as the proof of Theorem 2 in Section 5.2 in Tenenbaum: Introduction to analytic and probabilistic number theory. In fact the statement of this theorem itself implies the above upper bound, because $f(n)\leq\tau(n)$. The sharpness of $\log 2$ only requires a Chebyshev type lower bound that 
$$\sum_{\substack{p\leq x\\p\equiv 1\pmod{4}}}\log p\gg x.$$
Regarding Noam Elkies's comment: Landau proved that the number of $n\leq x$ with $r_2(n)>0$ is asymptotically 
$$2^{-1/2}\prod_{p\equiv 3\pmod{4}}(1-p^{-2})^{-1/2}\frac{x}{\sqrt{\log x}}.$$
For a proof, see Section 1.8 in Brüdern: Einführung in die analytische Zahlentheorie.
