skip to Main Content

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

Answers


  1. Chosen as BEST ANSWER

    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
    

  2. Some possibilities :

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search