Cost and availability aware resource allocation and virtual function placement for CDNaaS provision