以在黑暗中拍攝(如果你確定這個功能是導致緩慢):
首先,你可以打開MySQL的慢查詢日誌:
http://dev.mysql.com/doc/refman/5.1/en/slow-query-log.html
然後,如果$sess_use_database
是TRUE
,您可以嘗試優化會話表。你可能會有一些開銷導致問題。
除此之外,我唯一能想到的其他事情是數據庫服務器存在問題。你可以嘗試運行MySQL的調諧器,看看是否可以改善的事情一點:
https://github.com/rackerhacker/MySQLTuner-perl
希望幫助!
FYI
這裏是代碼在運行時的OP運行sess_destroy()
(從V2.0.2):
/**
* Destroy the current session
*
* @access public
* @return void
*/
function sess_destroy()
{
// Kill the session DB row
if ($this->sess_use_database === TRUE AND isset($this->userdata['session_id']))
{
$this->CI->db->where('session_id', $this->userdata['session_id']);
$this->CI->db->delete($this->sess_table_name);
}
// Kill the cookie
setcookie(
$this->sess_cookie_name,
addslashes(serialize(array())),
($this->now - 31500000),
$this->cookie_path,
$this->cookie_domain,
0
);
}
嘗試評論了'sess_detroy()'調用,以確保它是什麼讓這個緩慢;當你確定它的時候,你需要告訴我們更多關於這個方法的用途。 – 2011-04-16 19:32:01
當我調用sess_destroy()時,我不確定究竟發生了什麼,它只是銷燬會話的CodeIgniter方法。 – Mala 2011-04-16 19:33:12