Resource Provisioning for Web Applications under Time-varying Traffic