Chúng ta có thể đối phó với sự phức tạp thực hiện tăng cần thiết để hỗ trợ bộ nhớ đệm không? Điều này sẽ được giảm nhẹ nếu chúng ta sử dụng một, thực hiện bộ nhớ đệm, chung chung, nhưng chúng ta phải nhận thức được rằng đọc-ghi bộ nhớ đệm giới thiệu những vấn đề của luồng. | Performance Testing and Tuning an Application o Can we cope with the increased implementation complexity required to support caching This will be mitigated if we use a good generic cache implementation but we must be aware that read-write caching introduces significant threading issues. o Is the volume of data we need to cache manageable Clearly if the data set we need to cache contains millions of entities and we can t predict which ones users will want a cache will just waste memory. Databases are very good at plucking small numbers of records from a large range and our cache isn t likely to do a better job. o Will our cache work in a cluster This usually isn t an issue for reference data it s not a problem if each server has its own copy of read-only data but maintaining integrity of cached read-write data across a cluster is hard. If replication between caches looks necessary it s pretty obvious that we shouldn t be implementing such infrastructure as part of our application but looking for support in our application server or a third-party product. o Can the cache reasonably satisfy the kind of queries clients will make against the data Otherwise we might find ourselves trying to reinvent a database. In some situations the need for querying might be satisfied more easily by an XML document than cached Java objects. o Are we sure that our application server cannot meet our caching requirements For example if we know that it offers an efficient entity bean cache caching data on the client may be unnecessary. One decisive issue here will be how far in terms of network distance the client is from the EJB tier. The Pareto Principle the 80 20 rule is applicable to caching. Most of the performance gain can often be achieved with a small proportion of the effort involved in tackling the more difficult caching issues. Data caching can radically improve the performance of J2EE applications. However caching can add much complexity and is a common cause of bugs. The .