SQL Server 2014: In-Memory OLTP DLLs

In-Memory OLTP DLLs are the product of Native Compilation process in SQL Server 2014. SQL Server 2014 introduces the concept of In-Memory OLTP. To achieve In-Memory OLTP, the tables and the stored procedures assessing the tables should be optimized for In-Memory OLTP. Only optimized tables and stored procedures can be loaded to the memory for faster performance. To load the tables and the stored procedures to the memory, they have to be compiled to native code. This compilation process is called Native Compilation. The output of Native Compilation are the In-Memory OLTP DLLs. Read more about Native Compilation of Tables and Stored Procedures…..

Location of In-Memory OLTP DLLs:

On creating tables and stored procedures which are optimized for In-Memory OLTP, they are converted to C code and then compiled to native dll files. The dll files are stored in a physical file location in the hard disk. In SQL Server 2014 CTP1, I found the files under the folder “C:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\xtp\“. under the ..\xtp\ folder there will be sub-folders for each database with the database id as the folder name. The table dll starts with the prefix “xtp_t_“. The stored procedure dll starts with the prefix “xtp_p_“. The native compiled file names will have the object id. If you see the below screen shot of the native compiled file, you can see 6 files with the same name and different extension. All the files starts with the prefix “xtp“, then “t” for table or “p” for stored procedure. The third section of the file name has the database id. In this example the database id is “5“. The last part of the file name is the object id, followed by the file extension.

The file with “.c” extension is the C code file. During the native compilation process the create table/procedure Transact-SQL script is converted to C code first. You can see the content of this C code file in my article Native Compilation of Tables and Stored Procedures. The file with extension “.mat” is the metadata file. The other files with extensions “.obj”, “.out” and “.pdb” are created during the native compilation process.

Native Compiled Tables:
In-Memory OLTP DLLs Tables

Native Compiled Stored Procedures:
In-Memory OLTP DLLs Stored procedures

In-Memory OLTP DLLs on Memory:

These In-Memory OLTP DLL files are loaded to the memory for faster fetching and manipulation of data.

Every time the SQL Server reboots, the Native Compilation process re-compiles the SQL objects and created the dlls and load them to the memory. This cycle continues every time the SQL Server reboots.

You can use the dynamic management view dm_os_loaded_modules for identifying the In-Memory OLTP DLLs loaded to the memory. The below query will fetch the details, name and the location of the dll files in the hard disc.

Select * From sys.dm_os_loaded_modules Where Description = ‘XTP Native DLL’

SQL-2014-IN-Memory-OLTP-DLL-01

These In-Memory OLTP native files will be deleted once the table is dropped or the stored procedure is dropped.

Read more about Native Compilation of Tables and Stored Procedures…..

Read more about Memory Optimized Stored procedures….

Read more about Memory Optimized Tables….

Reference: msdn.

Leave your thoughts...