2
votes

A basic page page with just session_start(); loads just fine, but once I've set something, for example $_SESSION['pet']="dog";, the page load time is around 5 seconds.

I'm using AWS's memcached server and the connection time to it from the EC2 instance is really fast. I'm not sure where the slow down is coming from.

The session.save_handler is set to memcached and session.save_path is set to xxx.cfg.use1.cache.amazonaws.com:11211

phpinfo also displays Registered save handlers as files user memcache memcached

EDIT : I uploaded test files to demonstrate the issue. The first file is simply session_start(); print_r($_SESSION); (http://rr915webapi.us-east-1.elasticbeanstalk.com/session.php). The second file is session_start();$_SESSION['pet']="dog";$_SESSION['name']="bob";(http://rr915webapi.us-east-1.elasticbeanstalk.com/session-set.php). After you load the second file, you can see the first takes a while longer to load than initially did.

2
Is the session stored in memcache or on disk?Lawrence Cherone
I've set the session.save_handler to memcached and session.save_path to the ElastiCache instance - Under session it lists Registered save handlers: files user memcache memcachedaustinh
Is there a way to check if it's truely using the memcached server?austinh
@austinhollis php.net/manual/en/function.session-save-path.php you can also just dump <?php phpinfo(); into a file and it will dump your config to a readable page.Neil Masters
@NeilMasters I did do that and didn't know if the order of Registered save handlers meant it was using something other than the session.save_path that is specifiedaustinh

2 Answers

1
votes

Some possibilities :

4
votes

By setting the following in the PHP ini file, the response time was reduced down to milliseconds.

session.lazy_write = 0
memcached.sess_locking = Off