A method and apparatus for producing a biocide from a hypochlorite oxidant andanammonium salt are provided. The method includes monitoring a control parametertooptimize the ratio between the hypochlorite oxidant and the ammonium salt. Thecontrolparameter may be oxidation-reduction potential, conductivity, induction oroxygensaturation.