  5G networks are going to support a variety of vertical services, with a
diverse set of key performance indicators (KPIs), by using enabling
technologies such as software-defined networking and network function
virtualization. It is the responsibility of the network operator to efficiently
allocate the available resources to the service requests in such a way to honor
KPI requirements, while accounting for the limited quantity of available
resources and their cost. A critical challenge is that requests may be highly
varying over time, requiring a solution that accounts for their dynamic
generation and termination. With this motivation, we seek to make joint
decisions for request admission, resource activation, VNF placement, resource
allocation, and traffic routing. We do so by considering real-world aspects
such as the setup times of virtual machines, with the goal of maximizing the
mobile network operator profit. To this end, first, we formulate a one-shot
optimization problem which can attain the optimum solution for small size
problems given the complete knowledge of arrival and departure times of
requests over the entire system lifespan. We then propose an efficient and
practical heuristic solution that only requires this knowledge for the next
time period and works for realistically-sized scenarios. Finally, we evaluate
the performance of these solutions using real-world services and large-scale
network topologies. {Results demonstrate that our heuristic solution performs
better than a state-of-the-art online approach and close to the optimum.
