Implementing an application as a mobile agent may improve the application's functionality and performance, but may have a detrimental effect on overall system performance. In this paper we consider the effect of moving an application from a client to a file server (as an agent), both on the application and the server. Under what circumstances does application performance improve, and does it come at the expense of other (non-mobile) background applications using the same server? We use a trace-driven simulation to measure the effect of mobile code, allowing system parameters such as the size of the server memory and server speed relative to client speed to be varied. We found that several factors influence the benefit of mobile agents. Server memory does not appear to be a significant problem; relatively small server caches have a high hit rate even when shared with mobile agents. The relative CPU performance of the client and server has a bigger effect on system performance: mobile agents should not be run on the server if its CPU is a bottleneck.