Reputation: 143
I have a php application that will be running on several instances of Google Compute Engine (GCE). The application will utilize php sessions. I understand Amazon AWS offers a DynamoDB Session Handler for handling sessions on EC2 instances (link here ).
What about Google Compute Engine ? I could not find any available options other than the Session Affinity setting on the Load Balancer.
Are there any classes or available libraries that can make it easier to implement scalable php sessions on GCE instances ?
Upvotes: 1
Views: 1178
Reputation: 7725
If you run your php engine on google app-engine it includes access to a free shared memacache service: https://cloud.google.com/appengine/docs/standard/python/memcache/examples
There's also a paid dedicated service.
I don't know if you can access these from compute engine.
Upvotes: 0
Reputation: 886
Google Cloud Compute Engine does not provide a dedicated service for distributed PHP session management.
As a workaround I suggest the following solutions:
1) Deploy a Memcached [1] or Redis instance [2] and save sessions in it [3].
2) Keep sessions files in sync between web servers with Unison utility (based on Rsync) [4].
3) If your PHP application relies on MySQL you could save sessions there, you can consider a memory storage engine table for faster access to data. You can find an example at [5].
Links:
[1] - http://www.nginxtips.com/store-php-sessions-memcached/
[2] - https://cloud.google.com/solutions/redis/
[3] - http://www.sitepoint.com/saving-php-sessions-in-redis/
[4] - http://www.cis.upenn.edu/~bcpierce/unison/
[5] - http://phpsecurity.org/code/ch08-2
Regards
Paolo
Upvotes: 2