Caching fundamentals remotely by value. A cluster scope (Web hosting mysql)
Saturday, February 16th, 2008Caching fundamentals remotely by value. A cluster scope cache therefore can t guarantee identity across a cluster. For typical web or enterprise application architectures, it s most convenient that the scope of object identity be limited to a single unit of work. In other words, it s neither necessary nor desirable to have identical objects in two concurrent threads. In other kinds of applications (including some desktop or fat-client architectures), it may be appropriate to use process scoped object identity. This is particularly true where memory is extremely limited the memory consumption of a unit of work scoped cache is proportional to the number of concurrent threads. However, the real downside to process-scoped identity is the need to synchronize access to persistent instances in the cache, which results in a high likelihood of deadlocks and reduced scalability due to lock contention. Caching and concurrency Any ORM implementation that allows multiple units of work to share the same persistent instances must provide some form of object-level locking to ensure synchronization of concurrent access. Usually this is implemented using read and write locks (held in memory) together with deadlock detection. Implementations like Hibernate that maintain a distinct set of instances for each unit of work (unit of work-scoped identity) avoid these issues to a great extent. It s our opinion that locks held in memory should be avoided, at least for web and enterprise applications where multiuser scalability is an overriding concern. In these applications, it usually isn t required to compare object identity across concurrent units of work; each user should be completely isolated from other users. There is a particularly strong case for this view when the underlying relational database implements a multiversion concurrency model (Oracle or PostgreSQL, for example). It s somewhat undesirable for the object/relational persistence cache to redefine the transactional semantics or concurrency model of the underlying database. Let s consider the options again. A transaction/unit of work-scoped cache is preferred if you also use unit of work-scoped object identity and if it s the best strategy for highly concurrent multiuser systems. This first-level cache is mandatory, because it also guarantees identical objects. However, this isn t the only cache you can use. For some data, a second-level cache scoped to the process (or cluster) that returns data by value can be a useful. This scenario therefore has two cache layers; you ll later see that Hibernate uses this approach.
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.