  For a numerical semigroup ring $K[H]$ we study the trace of its canonical
ideal. The colength of this ideal is called the residue of $H$. This invariant
measures how far is $H$ from being symmetric, i.e. $K[H]$ from being a
Gorenstein ring. We remark that the canonical trace ideal contains the
conductor ideal, and we study bounds for the residue.
  For $3$-generated numerical semigroups we give explicit formulas for the
canonical trace ideal and the residue of $H$. Thus, in this setting we can
classify those whose residue is at most one (the nearly-Gorenstein ones), and
we show the eventual periodic behaviour of the residue in a shifted family.
