Queueing theory is a mathematical tool which can be applied for capacity planning and optimization of production, manufacturing or logistics systems. One of the possible applications of queueing theory is service capacity optimization. Let us consider that an engineering company operates m homogeneous machines. We assume that the machines are successively operating and down and times between failures and times to repair are exponentially distributed. The broken-down machines are repaired by repairmen; we assume that n < m. In the article a mathematical model of the problem is presented; the model can be used for the optimization of the number of the repairmen with respect to costs of the system. Results obtained by the mathematical model are compared with simulation results; a simulation model of the problem is based on colored Petri nets.