嵌入式数据库mssql的latch技术(mssql latch)

扩展

Latches, a synchronization construct, and their derivatives are widely used in modern embedded database systems, such as Microsoft’s SQL Server. A latch is a lightweight synchronization object that allows threads to protect shared resources. In SQL Server, latches are typically used internally for protecting various objects in the database, including tables and indexes.

Latches have gone through numerous performance improvements over the years, largely driven by customer demands as application loads have increased. The latest improvement, Universal Latch, has been implemented in the latest versions of MSSQL. Universal Latches build upon the earlier latch technology to provide increased scalability, reliability and predictability.

Universal Latches combine many of the existing latch types into a single entity which can be used to protect any resource within the database. These latches vary in their implementation depending on the type of resource that is being protected, however they all have the same basic underlying principle. A latch is acquired when a thread wishes to access a protected resource and is released when the thread has finished it’s work.

In theory, these latches should allow SQL Server’s concurrency to be increased without sacrificing performance. In practice, the effect of Universal Latches is reduced contention and improved scalability. This can be seen from the performance benchmark tests that have been conducted on various implementations of SQL Server.

Further to this, Universal Latches are capable of protecting a shared resource without the need for individual latches as used previously. This increases the robustness of the locks and reduces complexity and development time.

The improvements offered by the Universal Lock technology of MSSQL are visible in the performance gains made possible by their implementation. These improvements are likely to become even more essential as storage loads, and the size of protected objects grow. Universal Locks allow developers to cope with this growth efficiently, while also providing relief to already overburdened systems.

To implement Universal Latches in a database system, use a statement similar to the following:

USE master;

GO

ALTER DATABASE [DatabaseName]

SET ENABLE_BROKER_LATCH_FAULTING ON;

GO

The above statement changes the current database to enable the new Universal Latch Faulting feature. This allows for Universal Latches to be used to protect resources without having to manually create individual latches for each resource.

Overall, the use of Universal Latches in embedded databases can provide organizations with greater scalability and reliability for their databases. By reducing the overhead of individual locks and providing greater flexibility for resource protection, organizations can be sure that their databases remain secure and performant.


数据运维技术 » 嵌入式数据库mssql的latch技术(mssql latch)