The paper is devoted to optimization of resonances in a 1-D open optical cavity. Thecavity’s structure is represented by its dielectric permittivity functionε(s). It is assumed thatε(s) takes values in the range1 ≤ ε1 ≤ ε(s) ≤ ε2.The problem is to design, for a given (real) frequency α, a cavity havinga resonance with the minimal possible decay rate. Restricting ourselves to resonances of agiven frequency α, we define cavities and resonant modes with locallyextremal decay rate, and then study their properties. We show that such locally extremalcavities are 1-D photonic crystals consisting of alternating layers of two materials withextreme allowed dielectric permittivities ε1 andε2. To find thicknesses of these layers, a nonlineareigenvalue problem for locally extremal resonant modes is derived. It occurs thatcoordinates of interface planes between the layers can be expressed via arg-function ofcorresponding modes. As a result, the question of minimization of the decay rate isreduced to a four-dimensional problem of finding the zeroes of a function of twovariables.