Welcome Guest, Not a member yet? Register   Sign In
Sessions Performance Issue (php7.1, CI 3.1.5)
#1

Currently, within the Session library when using file  - we see `CI_Session_files_driver::read` taking up to 20s to process. We have tried using Redis, and see the same thing on `CI_Session_files_driver::_lock`.

I've done the following:
1) Add `session_write_close();` to Sessions.php anytime I touch the session object before returning
2) Added `php_value session.gc_probability 10 php_value session.gc_divisor 100` to my `.htaccess`  to kick off garabage collection.
3) Use my own folder for `session_save`, and put it outside the web directory, and gave `www-data` access as the owner.

Sessions are pouring in, and getting removed so I know GC is working, but I see still see these performance issues on requests tracked in NewRelic where it takes 13-20s at some times to read the file (open it for lock).

An `ls -l` shows the following on the sessions folder:

drwxrwxrwx  2 www-data root 1126400 Aug 23 04:34 session

I assume this is a IO issue, where the file is being written and read from the same time, but 1) should address this. Anytime a session is touched (read or write) I add `session_write_close();`. I applied this on:
- `public function sess_destroy()`
- `public function userdata($key = NULL)`
- `public function set_userdata($data, $value = NULL)`
- `public function unset_userdata($key)`

All these function do  a `session_write_close()` before return.

Any other ideas on performance issues or this is a bug?
Reply


Messages In This Thread
Sessions Performance Issue (php7.1, CI 3.1.5) - by gregavola - 08-22-2017, 09:38 PM



Theme © iAndrew 2016 - Forum software by © MyBB