PDA

View Full Version : Limitare la banda su server web Debian


Ninno
03-12-2008, 07:33
Ciao a tutti,
ho realizzato un serverino web + php + mysql su distribuzione Debian 4 etch.
Sfruttando cosi' la nostra linea internet a 4 mega shdsl, per ospitare il nostro sito web.

Sul sito ci sono dei file che i nostri clienti possono scaricare via http.
Ma quando questo avviene non riusciamo piu' neanche a navigare, in quanto vengono utilizzati tutti i 4 mega.

Non posso purtroppo usare ftp, sono costretto a farlo in http, in quanto bisognerebbe far rifare il sito.

C'e' un modo per limitare, (magari a livello di scheda di rete) la banda ?

Si potrebbe usare qualche software, oppure è necessario un hw particolare ?

Grazie a tutti del prezioso aiuto.

Ninno
03-12-2008, 07:37
Chiedo scusa non avevo visto questo ottimo post :

http://www.hwupgrade.it/forum/showthread.php?t=1662129&highlight=limitare+banda

Comunque se avete altri suggerimenti... Altrimenti si puo' anche chiudere sto post
;)

kingv
04-12-2008, 08:56
come hai indicato puoi effettuare traffic shaping sull'interfaccia di rete sulla quale esponi il servizio web.
un'alternativa è data da gestire invece la limitazione della banda a livello di server web (usi apache, vero?).
esisteono diversi moduli che ti consentono di farlo, anche se nessuno fa parte della distribuzione standard. puoi dare un occhio qui: http://www.linuxdocs.org/HOWTOs/Apache-Overview-HOWTO-5.html

il vantaggio di operare a livello più alto è che puoi operare le limitazioni a livello di virtual server, directory, utente, ip del richiedente, ecc.ecc.

Ninno
04-12-2008, 13:21
Grazie mille !

In questo articolo :
http://www.cohprog.com/mod_bandwidth.html
c'e' forse anche quello che serve a me, ovvero :

# LargeFileLimit
Syntax : LargeFileLimit <filesize> <rate>
Default : none
Context : per directory, .htaccess

Set a maximal <rate> (in bytes/sec) to use when transfering a file of <filesize> KBytes or more.

Several "LargeFileLimit" can be set for various files sizes to create range. The rate used for a given file size will be the one of the matching range.

A <rate> of "0" mean that there isn't any limit based on the size.

A <rate> of "-1" mean that there isn't any limit for that type of file. It's override even a BandWidth limit. I found this usefull to give priority to very small files (html pages, very small pictures) while seting limits for larger files... (users with their video files can go to hell ! :)

Example :
If the following limits are set :
LargeFileLimit 200 3072
LargeFileLimit 1024 2048

That's mean that a file of less than 200KBytes won't be limited based on his size. A file with a size between 200KBytes (included) and 1023Kbytes (included) will be limited to 3072Bytes/sec and a file of 1024Kbytes or more will be limited to 2048Bytes/sec.


Solo che ho un po' paura a ricompilare apache, perche' non l'ho mai fatto.

Secondo te è complicato ? Rischio ?

kingv
05-12-2008, 11:37
non ho utilizzato il modulo in questione, ma generalmente non hai necessità di ricompilare apache ma solo il modulo in questione che è poi caricato dinamicamente come DSO.
per moduli non parte della distribuzione standard (ad esempio mod_proxy_html) ho sempre fatto così.