Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^3: mod_perl blocking greedy clients

by BazB (Priest)
on Feb 11, 2006 at 22:56 UTC ( #529610=note: print w/ replies, xml ) Need Help??


in reply to Re^2: mod_perl blocking greedy clients
in thread mod_perl blocking greedy clients

Apache configuration directives traditionally go in the Apache configuration file, unsurprisingly.

I recommend you understand the code you intend on using and read the Apache documentation before implementing any changes.


If the information in this post is inaccurate, or just plain wrong, don't just downvote - please post explaining what's wrong.
That way everyone learns.


Comment on Re^3: mod_perl blocking greedy clients
Re^4: mod_perl blocking greedy clients
by Anonymous Monk on Feb 11, 2006 at 22:59 UTC
    Sorry I don't know anything about any of this, I pay for hosting and don't do anything myself. All I know is stuff I can do in cpanel.

      If you're using cPanel, you might want to have a look at their Hotlink Protection feature. This feature allows you to forbid direct access to image files (or any file types you specify). Users can still access the images through your Web pages, but they won't be able to simply slurp up your photos.

      I suggest that you have a look at your log files, though. The repeated accessing of your images by only a few users (or rather, only a few IP numbers) suggests an automated process, not people. In that case, you can use cPanel's IP Deny feature, which allows you to block individual IP's, or sets of them. You might also check whether these rude accesses are by a bot, but it really doesn't matter - whoever or whatever it is, it's hogging your bandwidth.

      Once you've got a recent access log for your Website, you can write a script to find who's making the most accesses.

      #!/usr/bin/perl -w use strict; use warnings; # Get the IP number from each line... while (<$INFILE>) { chomp; my $inline=$_; /(\d+.\d+.\d+.\d+)\s(.*)/; print $LOG "$1\n"; # . . . } # . . . # Create list of accesses, most frequent first. while(<$LOG>) { chomp; my $line=$_; $seen{$line}++; } # . . . foreach my $seenval ( sort {$seen{$b} <=> $seen{$a} } keys %seen) +{ next unless $seenval; print $FREQ "$seenval\t$seen{$seenval}\n"; }

      This will help you see who's visiting most frequently. That's not quite the same as finding who's hogging the most bandwidth, but it should be a good start.

      In order to get bandwidth itself, you'd need to do something like first identifying the size of the file downloaded, and then changing: $seen{$line}++; to $seen{$line}+=$size; (untested)

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://529610]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2014-10-23 05:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (124 votes), past polls