apachetomcatfile-uploadload-balancingmod-jk

apache frontend slowing the filupload


Following is my setup. I have an apache server and mod_jk module for loadbalancing 2 tomcat servers with sticky session enabled. The file upload directly to each tomcat is much faster than uploading through apache. We found the MPM module will make some difference for large threads. so we are using that also. Now With just one thread and large file its much slower than accessing the tomcat server directly. [00:33 vs 4:30].

Apache version 2.4.3 Mod_jk version 1.2.15 Tomcat 6

httpd.conf

LoadModule jk_module modules/mod_jk.so

JkWorkersFile          conf/workers.properties
JkLogFile              logs/jk.log
JkLogLevel             debug

JkMount                /*            router
JkMount                /jk_status    status

<Location /server-status>
SetHandler server-status
Allow from 192.168.188.143
</Location>

<IfModule unixd_module>
User daemon
Group daemon
</IfModule>

worker.properties

worker.list=router,status

worker.worker1.port=8009
worker.worker1.host=192.168.188.128
worker.worker1.type=ajp13
worker.worker1.lbfactor=1
worker.worker1.sticky_session=1

worker.worker2.port=8009
worker.worker2.host=192.168.188.129
worker.worker2.type=ajp13
worker.worker2.lbfactor=1
worker.worker2.sticky_session=1

worker.router.type=lb
worker.router.balanced_workers=worker1,worker2

worker.status.type=status

Please Help!!! Have I missed some important settings ? Please let me know


Solution

  • We did some further debugging on slow apache file upload operations and got the root cause of slowness as described below:

    We were using mod_jk connector for making apache talk to tomcat servers and it was having two problems:

    1. Mod_jk connectors log level was set to debug by default , which was making all uploaded data bytes to be written to jk.log file too, and hence causing a slowness, after correcting it time came down to 1 minute 30 seconds as compared to 4 minutes 30 seconds initially observed by us. Better but not enough!
    2. After further debugging we found that connector protocol behind mod_jk, i.e. AJP has an inherent limitation of max packet size of 64 KB which is lower than what can consume on our server side 16 MB I guess after seeing the configuration on test setup. So pipe was narrow at mod_jk side and hence was affecting end to end upload speed.

    After this we did some tests using http connector (via mod_proxy) and load balancer (via mod_proxy_balancer) and have achieved excellent results