Forum Moderators: open
I was reading a thread here on WW a few days ago about using files to block IPs that are too active on a website. Here's a link to the thread for reference, it went on for a good while:
[webmasterworld.com...]
Basically it's a throttle script to keep bad bots from bringing down a site. A file is created for each IP entering the site, and a record kept of how many hits the IP produces. If the number of hits goes over the limit in a certain amount of time, the IP is temporarily banned from the site.
I was wondering this: if the same were to be done with a single mySQL table holding nothing more than the IP, hitcount, and access time, would there be a significant amount of overhead in submitting repeated queries to the database vs repeated file accesses for the other method?
Wouldn't it be the same deal if the bot was hitting a dynamic page about 10 times a second? (Which happens to me every so often)
My site is pretty low traffic at the moment, only a few thousand unique a month, but I'm curious to know how the situation would change with a high traffic site as well. I've been working with mySQL and php for a couple of years but never really pushed either to the limit and have never done any speed tests comparing file access to database access.
As for the buildup of records, I'd just do a cron every night to wipe the table clean.
Thanks for any info.