Optimization of traffic and service quality in 5G networks