Issue Details (XML | Word | Printable)

Key: MDL-20462
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Eloy Lafuente (stronk7)
Reporter: Alex Djachenko
Votes: 0
Watchers: 1
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

Patch for DB overload with sessiondb

Created: 07/Oct/09 01:42 AM   Updated: 07/Oct/09 03:34 AM
Return to search
Component/s: Database SQL/XMLDB, Performance
Affects Version/s: 1.9.5
Fix Version/s: None

Environment: SessionDB = On

Database: Any, MySQL
Participants: Alex Djachenko, Eloy Lafuente (stronk7) and Petr Skoda
Security Level: None
Affected Branches: MOODLE_19_STABLE


 Description  « Hide
Our server (100-200 online users) was been block with expiry-update requests in mdl_session2.
When we used MyISAM tables were locked, when we used InoDB requests worket too long.


When session DB switches on, database is overloaded with queries for expiry time update.
Every http request needs 'expiry' update and it needs db indexes update. If there are thousands records in mdl_session2, the indexes update take a long time.
If page includes some pictures etc the one page needs 30-50 http-requests and 30-50 expiry updates every time.
But it isn't necessary - there aren't any sense in every seconds expiry updates.

This is patch for lib/adodb/session/adodb-session2.php (method write()):

$timeNoUpdate = $conn->OffsetDate($lifetime/(24*3600)-60,$sysTimeStamp);
$sql = "UPDATE $table SET expiry = $expiry ,expireref=".$conn->Param('0').", modified = $sysTimeStamp WHERE $binary sesskey = ".$conn->Param('1')." AND expiry >= $sysTimeStamp AND expity < $timeNoUpdate";


It's adding "AND expity < $timeNoUpdate".

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
No changes have yet been made on this issue.