The emerging paradigm of network function virtualization (NFV) technology promises an efficient solution for optimized service deployment in the cloud computing environment thanks to its ability to dynamically add or remove virtual resources when there is a change in workload. Nevertheless, telecom providers are still facing a challenging issue in efficiently adopting NFV to deploy Web real-time communication (WebRTC) service on top of IP multimedia subsystem (IMS). Providing WebRTC service increases the inherent complexity of the IMS system in terms of the number of service nodes as virtual network functions (VNFs) and the way they interact, both of which play significant roles in the problem of optimally allocating resources. This paper proposes a virtualized interworking system between IMS and WebRTC called NFV-based interworking architecture, and describes the mechanism for VNFs to exchange messages with each other. We present an analytic system model considering the constraints of resources, quality of service (QoS), and service costs. A real-time Markov approximation-based resource allocation algorithm (RIDRA) is then designed allowing a provisioned resource at service nodes to be reconfigured in time to meet performance requirements. The proposed solution is evaluated on the large scale by simulation and on the small scale by our developed testbed. Experimental results reveal that our algorithm effectively responds to fluctuating service demands with a service cost reduced by 19% via efficiently allocating virtual resources while maintaining QoS requirement.