Skip to Content Skip to Menu

šŸ•’ Save Time and Effort with CB Editor Assistant: Effortlessly create and refine content in Joomla 3, 4, & 5.
šŸŽ Limited Offer: Enjoy a 5-day FREE trial and save up to 30% afterward!

Cleaning session table from auto action

1 week 5 days ago #339904 by RobertvanderHulst
Cleaning session table from auto action was created by RobertvanderHulst
Our website is being accessed by some bots, and as a result our session database has a LOT of entries for anonymous users.
The who's online frequently shows over 30000 usersĀ  We are also using an integrated version of phpBB and its session table also has that many entries.
This makes the loading of the home page slow. We have even seen php out of memory issues when we logon as administrator.
Deleting the entries for anonymous users from both session tables fixes that issue.

Of course we could set the session timeout to a very low number, but that will also negativelyt affect users that are logged in.
So I was thinking of creating a Sql script that deletes anonymous rows from bothĀ  session table after several minutes of inactivity.
Is this something that we can do with an Auto action?
And how would we do that?
Any hint would be appreciated.

Robert

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48700
  • Thanks: 8317
  • Karma: 1447
1 week 4 days ago #339918 by krileon
Replied by krileon on topic Cleaning session table from auto action
Joomla uses keepalive to avoid logged in users sessions from expiring. So using a lower session time shouldn't really be a problem. What do you currently have it set to? The default is 15 minutes. Be sure within System > Manage > Scheduled Tasks that "Session GC" is published as it's responsible for clearing expired sessions so you could have sessions piling up simply due to the GC not happening. By default it runs once every day and you could increase that frequency if necessary.

You'd basically just be reinventing this process using CB Auto Actions so I'd recommend just making adjustments to Joomla itself. It is doable to clear sessions from CB Auto Actions though using a Query action and just deleting the table rows as needed in _session table.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

1 week 4 days ago #339919 by RobertvanderHulst
Replied by RobertvanderHulst on topic Cleaning session table from auto action
Kyle,
Thanks for the reply. The timeout was set to 30 minutes. I'll reduce that to the default of 15.
I did not know that Joomla keeps the sessions from logged in users alive.

Robert

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48700
  • Thanks: 8317
  • Karma: 1447
1 week 4 days ago #339920 by krileon
Replied by krileon on topic Cleaning session table from auto action
30 minutes should've also been fine. You shouldn't have issues with the table piling up with just 30 minutes. Are you sure session garbage collection is actually working? That might be the real problem here.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

1 week 4 days ago #339921 by RobertvanderHulst
Replied by RobertvanderHulst on topic Cleaning session table from auto action
Kyle,
Yes the GC is working. But even then we see thousands (25.000 and more) anonymous connections. We seem to be under attack from some eastern european IP addresses.

Robert

Please Log in or Create an account to join the conversation.

  • krileon
  • krileon
  • ONLINE
  • Posts: 48700
  • Thanks: 8317
  • Karma: 1447
1 week 4 days ago #339922 by krileon
Replied by krileon on topic Cleaning session table from auto action
That sounds more like a DDoS. I would contact your host about blocking that traffic at the host level.


Kyle (Krileon)
Community Builder Team Member
Before posting on forums: Read FAQ thoroughly + Read our Documentation + Search the forums
CB links: Documentation - Localization - CB Quickstart - CB Paid Subscriptions - Add-Ons - Forge
--
If you are a Professional, Developer, or CB Paid Subscriptions subscriber and have a support issue please always post in your respective support forums for best results!
--
If I've missed your support post with a delay of 3 days or greater and are a Professional, Developer, or CBSubs subscriber please send me a private message with your thread and will reply when possible!
--
Please note I am available Monday - Friday from 8:00 AM CST to 4:00 PM CST. I am away on weekends (Saturday and Sunday) and if I've missed your post on or before a weekend after business hours please wait for the next following business day (Monday) and will get to your issue as soon as possible, thank you.
--
My role here is to provide guidance and assistance. I cannot provide custom code for each custom requirement. Please do not inquire me about custom development.

Please Log in or Create an account to join the conversation.

Moderators: beatnantkrileon
Powered by Kunena Forum