Replication on multiple nodes is an effective way to improve the availability in the P2P or grid environment. It is difficult to determine how many replicas can fulfill the user request for availability QoS, because of the undependable peers, networks and uncertainty of user access mode. We emphasize the availability QoS in the way that replica number should adapt to both the fluctuant user demands on service capability and system enviroment undependability, when determining replica number. Aiming to supply service to users with availability QoS at a low replica cost, we introduce a minimum replica cost model to predict the optimal replica number and dynamically control the replicas number and the cost. To mask the undependability of our P2P system, we also regard replication as a redundant mechanic. In our model, a simulation is analyzed to describe the prediction of optimal replica number and we compare the cost and availability in our system to those in others under different cost ...