We show that strained epitaxial layers can relax by two competing mechanisms. At large misfit, the surface becomes rough, allowing easy nucleation of dislocations. However, strain-induced surface roughening is thermally activated, and the energy barrier increases very rapidly with decreasing misfit \ensuremath{\varepsilon}. Thus below some misfit ${\mathrm{\ensuremath{\varepsilon}}}_{\mathit{c}}$, the strain relaxes by nucleation of dislocations at existing sources before the surface has time to roughen. Relaxation via surface roughening is technologically undesirable; we discuss how temperature, surfactants, or compositional grading change ${\mathrm{\ensuremath{\varepsilon}}}_{\mathit{c}}$ and so control the mode of relaxation.