question

AndersonZanardi-6866 avatar image
0 Votes"
AndersonZanardi-6866 asked OuryBa-MSFT commented

PHP Session Handler - Better option

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-databaseazure-webappsazure-cache-redis
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

OuryBa-MSFT avatar image
1 Vote"
OuryBa-MSFT answered OuryBa-MSFT commented

Hi @AndersonZanardi-6866 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

· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @AndersonZanardi-6866 Please do not forget to mark as accept answer if the reply was helpful.

Regards,
Oury

0 Votes 0 ·

Hi @AndersonZanardi-6866 Thank you for visiting Microsoft Q&A forum.

Regards,
Oury

0 Votes 0 ·
TakahitoIwasa avatar image
1 Vote"
TakahitoIwasa answered OuryBa-MSFT commented

Hi. @AndersonZanardi-6866

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://docs.microsoft.com/en-us/azure/architecture/solution-ideas/articles/scalable-web-apps

· 4
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

In AWS we can use DynomoDB to handle php sessions. Do we have similar things in Azure? Thanks!

1 Vote 1 ·

Right @user2335065 , it would be nice if in Azure we could configure these alternative options via the panel as well.

0 Votes 0 ·
TakahitoIwasa avatar image TakahitoIwasa AndersonZanardi-6866 ·

Closer to AWS DynamoDB is Cosmos DB in Azure. In general, I think that Amazon Elastic Cashe / MemCache is often used for session management on AWS. In that case, you can use Azure Redis Cache.

In either case, is your PHP application compatible? Both Cosmos and Redis can envision session store scenarios.
You make trade-offs in terms of performance, availability, and cost to determine your architecture.

0 Votes 0 ·
Show more comments