Skip to content

Conversation

@claudiamurialdo
Copy link
Collaborator

@claudiamurialdo claudiamurialdo commented Sep 29, 2025

Adds a SessionAsyncExtensions helper that ensures sessions are loaded asynchronously by explicitly calling LoadAsync before accessing session data.
This prevents the ASP.NET Core session provider from performing synchronous operations, improving scalability under high load.
Issue:206131

…ns in Redis and improve session handling performance.

Converted ProcessRestRequest method in GXRouting.cs to fully async implementation.
@claudiamurialdo claudiamurialdo requested a review from a team as a code owner September 29, 2025 19:12
@claudiamurialdo claudiamurialdo changed the base branch from master to release-1.33 September 29, 2025 19:13
Copy link
Member

@fedeazzato fedeazzato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left a note regarding a possible behavioral change in GxRouting.

@claudiamurialdo claudiamurialdo had a problem deploying to kafka-integration-tests October 2, 2025 17:19 — with GitHub Actions Failure
@claudiamurialdo claudiamurialdo temporarily deployed to external-storage-tests October 2, 2025 17:19 — with GitHub Actions Inactive
-Simplified exception handling by replacing await Task.FromException(ex) with throw
-Refactored to throw PageNotFoundException directly when the route cannot be handled, removed unnecessary result task, and moved CommitSessionAsync() to a finally block for clearer async flow

Removed CustomRedisSessionStore which was previously used as an experiment to reduce synchronous Redis Refresh calls. Now that LoadAsync is executed at the start of each request, those synchronous Refresh calls no longer appear to be necessary, because they were caused by the previous synchronous load.
@claudiamurialdo claudiamurialdo had a problem deploying to kafka-integration-tests October 6, 2025 18:32 — with GitHub Actions Failure
@claudiamurialdo claudiamurialdo temporarily deployed to external-storage-tests October 6, 2025 18:32 — with GitHub Actions Inactive
@claudiamurialdo claudiamurialdo temporarily deployed to external-storage-tests October 8, 2025 22:17 — with GitHub Actions Inactive
@claudiamurialdo claudiamurialdo had a problem deploying to kafka-integration-tests October 8, 2025 22:17 — with GitHub Actions Failure
@claudiamurialdo claudiamurialdo changed the title Perf/distributed session Make distributed session loading asynchronous to improve scalability Oct 8, 2025
@claudiamurialdo claudiamurialdo merged commit bb22cbb into release-1.33 Oct 8, 2025
3 of 4 checks passed
@claudiamurialdo claudiamurialdo deleted the perf/distributed-session branch October 8, 2025 22:41
claudiamurialdo added a commit that referenced this pull request Oct 15, 2025
…1195)

* Introduce CustomRedisSessionStore to reduce excessive EXPIRE operations in Redis and improve session handling performance.
Converted ProcessRestRequest method in GXRouting.cs to fully async implementation.

* Ensures sessions load asynchronously

* Apply suggestions from FAzzatto
-Simplified exception handling by replacing await Task.FromException(ex) with throw
-Refactored to throw PageNotFoundException directly when the route cannot be handled, removed unnecessary result task, and moved CommitSessionAsync() to a finally block for clearer async flow

Removed CustomRedisSessionStore which was previously used as an experiment to reduce synchronous Redis Refresh calls. Now that LoadAsync is executed at the start of each request, those synchronous Refresh calls no longer appear to be necessary, because they were caused by the previous synchronous load.

* Refactored method to remove the result variable and await tasks directly, preserving the original behavior.

---------

Co-authored-by: claudiamurialdo <c.murialdo@globant.com>
(cherry picked from commit bb22cbb)

# Conflicts:
#	dotnet/src/dotnetcore/GxClasses.Web/Middleware/GXRouting.cs
#	dotnet/src/dotnetcore/GxNetCoreStartup/SessionHelper.cs
#	dotnet/src/dotnetcore/GxNetCoreStartup/Startup.cs
#	dotnet/src/dotnetframework/GxClasses/Helpers/HttpHelper.cs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants