Search code examples
phpajaxperformancedrupaldatabase-performance

How will saving user marked text affect site performance


We have a website that provides educational content to students.

I am currently implementing a feature on this website, where every time a user marks text from the content, jquery is run to pick the marked text, and call ajax to save it to the database. This is merely for analytics / heatmap purposes.

It has been less than 20 hours since I made this feature live and I already got 16k (and counting) records on my table. Will this have a huge impact on overall site speed and performance?

Do you have suggestions or idea on how should this feature be done more efficiently?

Thanks!

UPDATE with more details: Database schema: MySQL, 4 fields

  • int(10)
  • varchar(255)
  • text
  • date (timestamp)

Code is a very simple jquery ajax - .get() and a simple insert query on my php file


Solution

  • Obviously logging huge amounts of arbitrary data will affect performance. Your database (which you don't specify) is busy writing records of people clicking randomly on their screen. Your web server is swamped with thousands of requests. So yes, it will affect performance. The only question is how much - and that my friend, has to be found via testing. You could use Selenium to test the user selecting text. You could look at your servers' RAM/CPU/network levels in peak usage times with this feature enabled or disabled. Although all this boils down to - does perceptibly affect your load times or interactions while browsing your site? If no, then just keep logging this (kind of weird) data.

    I can't speak to any legality of tracking this. I suspect little to no one will care unless you're Facebook and have privacy watchdogs with their noses up your you-know-what. If you are Facebook, please let us know so we have another reason to deactivate our account.