質問

Yes, I've read session_start seems to be very slow (but only sometimes), but my problem is slightly different.

We have a PHP application that stores very simple sessions in memcached (elasticache to be specific), and have been monitoring our slowest-performing pageloads. Almost all of the slow ones spend a majority of their time in Zend_Session::Start, and we can't figure out why. It's a very AJAX-y front end, moving more and more toward a single-page app, making a number of simultaneous requests to the backend per pageload, and some of the requests take up to three to four times as long as they should based solely on this.

It's not every request, obviously, but enough of them that we're concerned. Has anyone else seen this behavior? We were under the impression that memcache is not blocking (how could it be?), so the very worst would be a user has a bum session, but multiple-second wait times in session_start seems inexplicable.

役に立ちましたか?

解決

Take a look at your session garbage collection mechanism (play with probability and divisor).

If gc is slowing down the app, consider cleaning the old sessions manually (e.g. setting gc probability to 1 and running gc script via cron).

Another possibilities:

  • session mechanism is locked (so the app waits to unlock, then write)
  • too much data saved
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top