PHP Session Handler - Better option

Anderson Zanardi 21 Reputation points

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?


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.
194 questions
Azure App Service
Azure App Service
Azure App Service is a service used to create and deploy scalable, mission-critical web apps.
6,074 questions
0 comments No comments
{count} votes

Accepted answer
  1. Oury Ba-MSFT 14,061 Reputation points Microsoft Employee

    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.


    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Takahito Iwasa 4,831 Reputation points MVP

    Hi. @Anderson Zanardi

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

    You have several options.


    • 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.

    1 person found this answer helpful.