Skip to content

Schema change limits aspnetcore session state in SQL #44028

Closed
@PhilM-IT

Description

@PhilM-IT

Summary

The schema generated by "Microsoft.Extensions.Caching.SqlConfig.Tools" for session state storage in SQL was adjusted to use a datetype incompatible with SQL memory-optimized tables. This significantly reduces performance potential using this solution compared to traditional .net framework.

Motivation and goals

the datetimeoffset data type is used in the ASPStateTempSessionsV2 table. This datatype is essentially datetime2 with timezone support.

Options:

  1. Create a flag that allows for the use of schema and code that doesn't use datetimeoffset and replaces this with a supported equivalent type (https://docs.microsoft.com/en-us/sql/relational-databases/in-memory-oltp/supported-data-types-for-in-memory-oltp?view=sql-server-ver16).

  2. change entirely to supported datatime datatype. I can't be certain if the loss of timezone information will impact existing functionality.

  3. Move Timezone or timezoneoffset value to a new column supported within memory optimized tables and handle any adjustments in code using multiple columns.

In scope

  1. adjust SQL schema to support using memory-optimized tables again.

Out of scope

Forcing changes to the supported datatypes in SQL server for memory optimized tables (even SQL 2022 this isn't supported).

Risks / unknowns

lack of native timezone support?? unsure here.

Examples

Suggestions above. Not sure what else I can provide for examples.

Detailed design

I'm not sure I have enough detail/background as to why the schema was changed to begin with.
-->

Metadata

Metadata

Assignees

No one assigned

    Labels

    area-middlewareIncludes: URL rewrite, redirect, response cache/compression, session, and other general middlewaresdesign-proposalThis issue represents a design proposal for a different issue, linked in the descriptionfeature-cachingIncludes: StackExchangeRedis and SqlServer distributed caches

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions