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 ɛ. Thus below some misfit , 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 and so control the mode of relaxation.