CS Stored Sessions

Hi All



I have regularlty cleared logs inside Admin. Yet the table CS_Cart_Stored_Sessions is full of 2,000 session entries.



Is it ok to FLUSH this table inside PHP Myadmin?



I am thinking it will speed up the site in general.



CS 2.1.1

[quote name=‘alamar’]Hi All



I have regularlty cleared logs inside Admin. Yet the table CS_Cart_Stored_Sessions is full of 2,000 session entries.



Is it ok to FLUSH this table inside PHP Myadmin?



I am thinking it will speed up the site in general.



CS 2.1.1[/quote]



If you clear sessions it means that customer carts and the like will also be flushed.

So I am curious here and have a few questions:


  1. How do you “flush” a table?


  2. Shouldn’t these abandoned shopping carts be able to be “cleaned up” or flushed within the CS admin? Or maybe they are cleaned up after 30 days or something?


  3. Why do you regularly “flush” files in PHP MyAdmin? Is there a cron setting that can do this?


  4. Do you have to “flush” files in PHP MyAdmin? Isn’t it enough to clean up files within CS admin?

[quote name=‘clips’]

  1. How do you “flush” a table?

    [/quote]


TRUNCATE `cscart_stored_sessions`


[quote name=‘clips’]

2) Shouldn’t these abandoned shopping carts be able to be “cleaned up” or flushed within the CS admin? Or maybe they are cleaned up after 30 days or something?

[/quote]



Not sure - However my live store has that same table account for 50% of the table size. We do not delete as customers can go months without purchasing from their shopping cart.


[quote name=‘clips’]

3) Why do you regularly “flush” files in PHP MyAdmin? Is there a cron setting that can do this?[/quote]

We don’t. Some webhosts place limitations on database sizes and hence the clearing of said table reduces the overall size HOWEVER it also creates customer confusion and ‘distaste’ when you ‘lose’ their shopping cart.


[quote name=‘clips’]

4) Do you have to “flush” files in PHP MyAdmin? Isn’t it enough to clean up files within CS admin?[/quote]



Clear Cache/Compiled Director = CS-CART

Flush/Truncate Table = mySQL/PHPMyAdmin



DO NOT use this command on ANYTHING other than cscart_stored_sessions unless you know what you are doing.

I clean my cs_stored_sessions table almost every day and the only shopping cart’s lost are the ones that belonged to non clients, the sign in clients never lost they’r carts.

Anyway, I clean it to maintain a “healthy” database size and untill now never had a problem

Users->Abandoned/Live carts->Select which ones you want to delete or just “Delete all found”

Wow, another cool class in php and cs admin.



THANKS!

Hi all



cscart_sessions table from phpmyadmin has 167.5 MB.

What is the purpose of this table should I delete?

The content of this table is huge (167.5 MB) and I can not export database from phpmyadmin

Is any way to reduce the size of this table if is not recommmended to delete the content it?



Thanks



Adrian

Most of space in my cart took data stored by visiting spiders

After emptying cscart_sessions table, records stopped to fill out. Its still empty and we have short expiry time. Structure of table is OK.



Where could be a problem?

Digging up an old post here.



On the “CS_Cart_Stored_Sessions” it is now 7.1 GiB with over 9 million stored sessions on one of our sites. How large should we seriously allow this too get? This “stored_sessions” also does not appear to be the same as “abandoned carts”. When we optimize the database it gets stuck on this file for a few minutes before it moves on.

Shouldn't have anything over 14 days old by default. Check your config.php file for the define for max_session_time or something similar. On tablet so can't look it up for you.

Tony, does your software help keep this cleaned up better? I was looking at it but did not see anything about sessions.



In the config.php I fould the following…


// Live time for permanent cookies (currency, language, etc...)
define('COOKIE_ALIVE_TIME', SECONDS_IN_DAY * 7); // one week
// Session live time
define('SESSION_ALIVE_TIME', SECONDS_IN_HOUR * 2); // 2 hours
// Sessions storage live time
define('SESSIONS_STORAGE_ALIVE_TIME', SECONDS_IN_DAY * 7 * 2); // 2 weeks
// Number of seconds after last session update, while user considered as online
define('SESSION_ONLINE', 60 * 5); // 5 minutes


…but none of those appear to be real long times. I am guessing that the 'SESSIONS_STORAGE_ALIVE_TIME' is what you are talking about and it is set for 2 weeks.

Assume you are referring to EZ Admin Helper addon. No it does not manage sessions since that is handled in the session class used by cs-cart. I can only assume that your session class is not running the garbage collection method (Session::gc($max_lifetime) or that the parameter being passed is very large…



Suggest you have helpdesk identify the problem and fix it for you. But would like to see the fix posted here.



As time goes on, the internal code is becoming more and more convoluted and the session class is a mix of class and storage methods now…

Thanks for the reply.



Contact the CS-Cart helpdesk…hmmm? I may have to ponder that. Contacting them has become one of those things that I dread doing. They will charge me just to say, “nope, it does not work”. Then they will charge me more to send me to a link on their website that has nothing to do with the issue. Sorry, I have lost so much confidence in CS-Cart, their software, their service, in them. It is quite discouraging to say the least.



If I get up the will power to contact them and find out anything I will post it.

So we ended up trying to flush the table that was mentioned above but could not get it to work. So we contacted CS-Cart and the told us to do the same thing. So we tried again and it still did not work. So we asked our host to do it and they got it to work. Now it has been a couple of days and the same file is already up to 490 mb. Yet our traffic has been next to nothing. So it is kind of confusing why this file would be so large already. On our other site with the same version the database file is only 9mb. I know that the “norm” depends on your traffic, but almost 500mb in a couple of days seems kind of crazy.



So far, other than what Jesse recommended above CS has not offered any other options or possible problems.

I would guess that you have changed the schema along the way so you no longer have the proper primary and other keys in the table. Hence when updates happen, it always creates a new row versus updating an existing row (this is just a guess).



Suggest you verify the schema against the standard distribution and/or the table definition on another cs-cart installation (same version) that is working properly.



Did you truncate via phpMyAdmin or did you try to do a restore of a SQL file that had the TRUNCATE verb in it? Note that error reporting is OFF when you do a DB table restore so you'd never see the error.

Yes, I did the truncate via phpMyAdmin but could not get it to work. I'm not for sure how the host did it.



On changing the schema, I have no idea. We have tried to use a few add-ons, but not near what we have in the past. So I am guessing those may have changed something.



The interesting part is now the “cscart_stored_sessions” is up to 683mb and growing. I will try to check it with our other site, but will have to figure out what the scema part is.

I figured out what is causing the database to grow so fast. There are TONS of post (almost 870,000) trying to be made on the “comments and reviews” with links back to websites or keywords. I cannot locate any IP addresses to try to block them right now. So basically we are having some “thing” trying to post a ton of stuff but so far they have not been able to because the CS “Anti-bot validation” is not letting it happen. Sadly though it is clogging up our database and probably what has been slowing down our site.

That could do it… Your host can help you identify and block the access. Be careful when blocking ranges so you don't Denny valid users and bots.



Tough to get these before session initialization.