A multi-server queueing system, that is loaded continuously in certain periods of time and which functions for a certain amount of time allocated for the functioning of the system, is considered. Based on the renewal theory, an expression is obtained for the distribution density of the number of arrivals served herewith the service time for each server can be different. In the numerical example, the distributions of the number of services for the systems consisting of one, two, five servers are obtained. The approach to optimization of the queue using the stochastic model of supply and demand is outlined. According to the model, the distributions of the number of services, the queue length as the number of unused arrivals, the number of idle servers as the number of unused services are calculated. Each of these values corresponds to the cost. Knowledge of the distribution functions of the model indicators makes it possible to calculate the cost parameters with dependence of unit costs on the number of servers. The optimal number of servers can be selected from the condition of the maximum of the total average cost.