We have multiple ojs installations on our dedicated server, recently the cpu usage of mysql server increased to more than 300%. After investigation, only one of the journals is causing this problem. Almost all queries in mysql process list are from this journal (mostly modifying sessions table). The journal was working fine for months. Any ideas on how to overcome this problem?
Can I empty the sessions table? It contains 27k rows
The sessions table represents user logins. If you clear the sessions table, all users will be logged out of the system.
If you suddenly have 27k sessions, I would suspect that you are being attacked by a swarm of spam registrations. You may want to check your users table to see if that is the case.
Thanks for the reply.
The sessions are accumulated over time (not sudden) but I wonder if it is normal to have that number of sessions?
Logging users out is not a problem for me (they only need to login again), is that the only effect of clearing the table?
27k historic sessions is quite plausible for a large install, and will not affect performance. If the mysql processes were primarily modifying the sessions table, this represents a lot of current activity (logins / logouts). Emptying the table will only have the effect of logging out all current users, but will not change your site performance or load. You probably want to analyze the access logs or current session table activity to identify the cause of the added load.