matomo-org / matomo

Empowering People Ethically with the leading open source alternative to Google Analytics that gives you full control over your data. Matomo lets you easily collect data from websites & apps and visualise this data and extract insights. Privacy is built-in. Liberating Web Analytics. Star us on Github? +1. And we love Pull Requests!
https://matomo.org/
GNU General Public License v3.0
19.74k stars 2.63k forks source link

Inefficient session "data" handling via "dbtable" session save handler #8308

Open SR-mkuhn opened 9 years ago

SR-mkuhn commented 9 years ago

If a value of the session is updated, the data field of piwik_session gets fully rewritten (it's a text blob) instead of simply updating the one value.

This text blob is already a data structure - but not a data structure mysql understands. This breaks mysql database replication binlog, because this change is logged there (to apply it to an other server) and causes higher database traffic as needed.

mattab commented 9 years ago

Hi @SR-mkuhn

do you find this issue is really bad, or just a little "nice to have", in other words, did you notice a real database traffic increase due to this issue?

SR-mkuhn commented 9 years ago

It is really bad, because there are cases, like #8307, where 16KB(and rising) are written multiple times in a second.

mattab commented 9 years ago

@SR-mkuhn we will fix #8307 with high priority, which hopefully makes this "inefficient session handler" less important bug. once #8307 will be fixed, if you still find this issue creates slowness in the db replication, please let me us know

SR-mkuhn commented 9 years ago

I understand the convenience to store data this way, because it is similar to a filebased sessionstore. ;-) Until somebody finds a way to put arbitrary large data in this field. I think #8307 is just one known way to trigger this bug. And as the replication binlog just saves differences, a rewrite causes more traffic even if a change is minimal inside this field-datastructure.