Welcome Guest, Not a member yet? Register   Sign In
DBSession becoming slow
#1

[eluser]ACSparks[/eluser]
We use the DBSession library to manage the user session and extra data in our database in the ci_sessions table. When the table grows to around 60 thousand rows we see random slow queries when performing INSERT and UPDATE statements on the ci_sessions table. These slow queries also show up in the MySQL slow query log.

What can we do to improve performance of this table? Keep the entire table in memory? Unfortunately, the slow queries do not happen on every page load, and we haven't been able to figure out a pattern yet.

We also tried changing from an InnoDB table to MyISAM, but that didn't seem to change anything Sad

Any insight or suggestions would be much appreciated! Thanks!
#2

[eluser]TheFuzzy0ne[/eluser]
Do you know exactly what queries are causing the slow down? Also, have you noticed any pattern? For example, is it happening at 10 past every hour of the day? If there is a pattern, there's a chance that someone else is doing something resource intensive with their tables, and that could be causing your problem.

The Session class's query is virtually always in the same format. Each query contains between 1 and 3 very simple where clauses, so it's unlikely to be the query that's the problem, it's more likely to be the database. The only other thing I can think of is that your table is not indexed properly.
#3

[eluser]pistolPete[/eluser]
60,000 entries? Isn't the session library's garbage collection supposed to delete expired sessions?
Or are these all active sessions?




Theme © iAndrew 2016 - Forum software by © MyBB