PHP Session Handler - Better option

Anderson Zanardi 21 Reputation points
2022-03-30T17:35:28.71+00:00

Hello, I would like a suggestion to help me choose a solution for an alternative Session Handler for my appservice to become really distributed in the cloud.
I'm using PHP with Session Handler as File System but this limits me when I want to have a more distributed architecture.
I know F/S is the default solution and the one that works best for PHP but I need an alternative.

I'm looking into using a database (SQL Server/MySQL) or going to a Redis/Memcache.

Using a database, how can I measure what kind of configuration I would need to create a SQL Server here in Azure without having a high cost but with good performance?

With Redis, is there any difference if I connect via VNET about performance?

Looking at my current appservice, is it possible to measure what kind of 'machine' configuration I would need for any of these alternatives?

Thanks

Azure SQL Database
Azure Cache for Redis
Azure Cache for Redis
An Azure service that provides access to a secure, dedicated Redis cache, managed by Microsoft.
263 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
8,046 questions
0 comments No comments
{count} votes

Accepted answer
  1. Oury Ba-MSFT 19,886 Reputation points Microsoft Employee
    2022-05-09T19:19:19.78+00:00

    Hi @Anderson Zanardi Thank you for posting your query on Microsoft Q&A.

    You have the option to use Azure Redis Cache. For the performance
    *With Redis, is there any difference if I connect via VNET about performance? *
    No, because the additional configuration required to use VNETs with Azure Cache for Redis, we recommend using Private Links instead. There is, however, a performance difference when using a TLS/SSL connection. You can see some examples benchmarking here.

    Regards,
    Oury

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Takahito Iwasa 4,851 Reputation points MVP
    2022-03-31T04:56:44.063+00:00

    Hi. @Anderson Zanardi

    If your application is stateful, you want to share your session when you scale out.

    You have several options.

    First,

    • Session affinity (sticky session) features
    • Session store: RDBMS, NoSQL, Other ...

    Session affinity can be enabled in the App Service settings.
    You can also choose an RDBMS when choosing a session store, but KVS usually offers better performance when it comes to session management.

    The rest is to trade off by taking into account cost, network configuration, redundancy options, implementation library compatibility, and so on.

    Please also refer to the following best practices.
    https://learn.microsoft.com/en-us/azure/architecture/solution-ideas/articles/scalable-web-apps

    1 person found this answer helpful.

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.