解決 SQL Server & Hibernate 一起使用造成死結問題
Simply put, Snapshot isolation works a little bit like version control system for row data. Different versions of rows are kept for each connection while transactions are executing so that locks don’t have to be used at all. This is a bit like the way Hibernate uses optimistic locking for versioned objects. The benefit is that lock contention is totally removed because there aren’t any locks on rows! This means that concurrency can be much higher because you don’t have threads waiting on locks. The downside is that select operations can be a little bit slower because of the overhead of scanning for the proper versions of the rows. I haven’t performed any scientific load tests with this setting, but basic tests seem to show only a couple percentage point slow down on selects. In an application with lots of users, this performance loss is often regained (and sometimes results in an overall performance gain!) due to threads no longer dealing with lock contention.
下载地址
用户评论