1
votes

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 ?

2
I ended up switching to amazon aws which provided everything I need. Thanks google cloud for the wonderful support.Seme1

2 Answers

2
votes

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

0
votes

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.