How to prevent the `customer_visitor` table from growing?

Install the yireo/magento2-disablelog2 module:

bin/magento maintenance:enable
composer require yireo/magento2-disablelog2:*
bin/magento setup:upgrade
rm -rf var/di var/generation generated/code && bin/magento setup:di:compile
rm -rf pub/static/* && bin/magento setup:static-content:deploy en_US <additional locales, e.g.: de_DE>
bin/magento maintenance:disable

Then you can truncate the customer_visitor and customer_log tables:

SET FOREIGN_KEY_CHECKS=0;
TRUNCATE customer_log;
TRUNCATE customer_visitor;
SET FOREIGN_KEY_CHECKS=1;