Here we will discuss about IDENTITY_CACHE , IDENTITY_CACHE set to ON (default) in SQL Server 2017.
In below SQL server 2017 below versions when data inserting in any table suppose server have been rebooted then it will insert the data then there is a gap in the identity values:
In this case we need to disable the this feature on 2017
ALTER DATABASE SCOPED CONFIGURATION SET IDENTITY_CACHE = OFF
Now try to do the same there is no gap in the identity values
SQL Server 2017 provides a new database scoped configuration option IDENTITY_CACHE. By default, this option is set to ON. In SQL Server, the database engine stores a series of values for the identity columns and it uses them as needed. The database engine generates identity values in a batch to reduce transaction log write and it only logs the max value of the batch. Sometimes when the identity column is being populated and an unexpected SQL Server restart/failover occurs, after a restart the next value of last batch max identity value will be used, so there will be a gap between identity columns values before the restart and after the restart. This feature was introduced in SQL Server 2012.