IHS plug-in component download speed limit scheme

Outline

Because business needs, the need to achieve download speed limit function in IBM HTTP Server.

demand analysis

Because IHS is based on the Apache HTTPD building, which itself does not achieve download speed limit function, therefore, need to use a third-party components to achieve this functionality, speed limits used in this function is the name for the Bandwidth Mod.

The home page:

http://bwmod.sourceforge.net/#

Installation depends

Be pre-installed httpd-devel

installation steps

Execute the command / opt / IBM / HTTPServer / bin / apxs -ic mod_bw.c to compile.

Edit /opt/IBM/HTTPServer/conf/httpd.conf, add the following entry to achieve a speed function:

LoadModule bw_module modules/mod_bw.so

BandWidthModule On

ForceBandWidthModule On

BandWidth all 1024000 # speed limits for each client 1M

LargeFileLimit * 10240 102400 # If the file is larger than 10M, speed 100K / s

 

test

In the / opt / IBM / HTTPServer / htdocs directory into files larger than 10M, and then the browser window to access the file url will find the download speed is limited to 100K / s or less.

appendix:

Installation Issues:

1. there are mistakes,

./mod_bw/mod_bw.c: In function 'get_bw_rate':

./mod_bw/mod_bw.c:484:59: error: 'conn_rec' has no member named 'remote_addr'

             if (apr_ipsubnet_test(e[i].x.ip, r->connection->remote_addr)) {

                                                           ^

./mod_bw/mod_bw.c: In function 'get_maxconn':

./mod_bw/mod_bw.c:567:59: error: 'conn_rec' has no member named 'remote_addr'

             if (apr_ipsubnet_test(e[i].x.ip, r->connection->remote_addr)) {

                                                           ^

./mod_bw/mod_bw.c: In function 'get_sid':

./mod_bw/mod_bw.c:612:59: error: 'conn_rec' has no member named 'remote_addr'

             if (apr_ipsubnet_test(e[i].x.ip, r->connection->remote_addr)) {

                                                           ^

Wherein the need to modify the mod_bw.c remote_addr replaced client_addr, remote_ip replaced client_ip

2. there are mistakes

../bin/apachectl -k start

httpd: Syntax error on line 869 of /opt/IBM/HTTPServer/conf/httpd.conf: Cannot load modules/mod_bw.so into server: /opt/IBM/HTTPServer/modules/mod_bw.so: undefined symbol: apr_atomic_set

Modify mod_bw.c, wherein the code is modified

#ifdef APR_MAJOR_VERSION // add

#if (APR_MAJOR_VERSION < 1)

    #define apr_atomic_inc32 apr_atomic_inc

    #define apr_atomic_dec32 apr_atomic_dec

    #define apr_atomic_add32 apr_atomic_add

    #define apr_atomic_cas32 apr_atomic_cas

    #define apr_atomic_set32 apr_atomic_set

#endif

#endif  //新增

 

 

Guess you like

Origin blog.csdn.net/nikx/article/details/91418179