When core Moodle chat is used in "gui_ajax" mode, each open chat windows triggers Ajax update every 3 seconds:
This in turn causes mod/chat/chat_ajax.php script to update lastping field in chat_users table:
This does not scale well - it will cause a lot of DB writes when many users use the chat activity. And the problem gets pretty serious on installations when chat is commonly used - as users will usually keep the window open & running in the background for a long time.
I propose to check the current lastping time and not update it more often than (say) once every minute.