A reverse osmosis system comprising: a pump operable to pressurize a feed stream; a first membrane array configured to receive the feed stream and to generate a first permeate stream and a first brine stream from the feed stream; a second membrane array configured to receive the first brine stream and to generate a second permeate stream and a second brine stream from the first brine stream; a first hydraulic pressure booster configured to receive a first portion of the second brine stream and to use energy from the second brine stream to increase the pressure of the first brine stream, the first hydraulic pressure booster includes a first variable geometry nozzle, a second hydraulic pressure booster configured to receive a second portion of the second brine stream and to use energy from the second brine stream to increase the pressure of the feed stream, an electric motor-generator coupled to the second hydraulic pressure booster, (a) operable to act as a motor to use electric power from a power supply to drive the first hydraulic pressure booster or the second hydraulic pressure booster, and (b) operable to (i) convert hydraulic energy from the second brine stream into electrical energy and (ii) return the electrical energy to the power supply, and a first controller that controls the first variable geometry nozzle to adjust flow of the first portion of the second brine stream through the first hydraulic pressure booster and thereby adjust a first amount by which the first hydraulic pressure booster increases the pressure of the first brine stream; wherein the second hydraulic pressure booster includes a second variable geometry nozzle, characterized in that the motor -generator comprises a torque control. a pump operable to pressurize a feed stream; a first membrane array configured to receive the feed stream and to generate a first permeate stream and a first brine stream from the feed stream; a second membrane array configured to receive the first brine stream and to generate a second permeate stream and a second brine stream from the first brine stream; a first hydraulic pressure booster configured to receive a first portion of the second brine stream and to use energy from the second brine stream to increase the pressure of the first brine stream, the first hydraulic pressure booster includes a first variable geometry nozzle, a second hydraulic pressure booster configured to receive a second portion of the second brine stream and to use energy from the second brine stream to increase the pressure of the feed stream, an electric motor-generator coupled to the second hydraulic pressure booster, (a) operable to act as a motor to use electric power from a power supply to drive the first hydraulic pressure booster or the second hydraulic pressure booster, and (b) operable to (i) convert hydraulic energy from the second brine stream into electrical energy and (ii) return the electrical energy to the power supply, and a first controller that controls the first variable geometry nozzle to adjust flow of the first portion of the second brine stream through the first hydraulic pressure booster and thereby adjust a first amount by which the first hydraulic pressure booster increases the pressure of the first brine stream; wherein the second hydraulic pressure booster includes a second variable geometry nozzle, characterized in that the motor -generator comprises a torque control.