Re: Apache losing its connection from Tomcat in few minutes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



You don't give enough information about the setup to solve any of your problems really.

Are the apache/tomcat/cms on the same box or different

We have seen big problems with mod_jk when there are firewalls involved (so much so we don't use it any more but use mod_proxy instead) - connections are severed by the firewall - you need to look up "tcp keep alive" settings for your connections - but even then that doesn't help - mod_jk doesn't handle this situation well... (ditto nginx, mod_fcgi etc none of them really handle any form of flakyness when it comes to network well)

And also mod_proxy is a lot easier to set up that mod_jk - and the slight overhead of not-compressing the apache headers/possibly renogatiting connections will not be significant if your CMS is take 10 seconds to return - which is already about 9 seconds to long anyway!

Other things - shared file systems are generally a bad idea in a web environment - (esp NFS) as overhead/stability issues can be critical in high volume webservers..

Now for mod_proxy for what you want to do!

ProxyPass /files !
ProxyPass / http://tomcatserver:port/
ProxyPassReverse / http://tomcatserver:port/

Caching probably isn't an issue now - or shouldn't be... as your static content is being server via Apache directly - but I would read up on web optimisation in general:
  • How to minimize number of resources in a web page;
  • Setting cache control, etag headers etc to stop the client re-requesting resources;
  • Using mod_deflate correctly [ Note turn off deflate on tomcat - DO NOT GET IT TO COMPRESS CONTENT!]
  • Look at avoiding redirects etc if possible....

Only when you have resolved all those issues then will you want to look at setting up "dumb server" caching - because unless you understand it well it can cause more problems that it solves! and anyway getting the cache headers right will make it easier! Get servers closer to the user caching content is always the best way!!!

James


On 04/09/2016 09:48, Jayaram Ponnusamy wrote:
Dear All,

In our Environment we are using Apache HTTP and Tomcat as AppServer on J2EE based CMS System. and We are using AJP 1.3 connector (Apache HTTPD, Tomcat, CMS are in seperate systems)

Normally accessing the sites & pages through WebServer URL is very slow compare to use Tomcat URL. 

The Wired behavior is Apache HTTP is losing connection with Tomcat in few minutes (eg 10-15minutes) then we have to hit the WebServer URL continuously or reboot httpd to resolve this issue.

In the MOD_JK Logs we could see below errors.

[Sun Sep 04 01:17:34 2016][7945:488081152] [info] ajp_connection_tcp_get_message::jk_ajp_common.c (1150): (prd_live_svr) can't receive the response header message from tomcat, network problems or tomcat (10.100.116.31:9009) is down (errno=110)
[Sun Sep 04 01:17:34 2016][7945:488081152] [error] ajp_get_reply::jk_ajp_common.c (1962): (prd_live_svr) Tomcat is down or refused connection. No response has been sent to the client (yet)
[Sun Sep 04 01:17:34 2016][7945:488081152] [info] ajp_service::jk_ajp_common.c (2447): (prd_live_svr) sending request to tomcat failed (recoverable),  (attempt=1)
[Sun Sep 04 03:35:02 2016]prd_live_svr cmsliv.com 32.624815
[Sun Sep 04 03:36:02 2016][13358:488081152] [info] ajp_process_callback::jk_ajp_common.c (1788): Writing to client aborted or client network problems
[Sun Sep 04 03:36:02 2016][13358:488081152] [info] ajp_service::jk_ajp_common.c (2447): (prd_live_svr) sending request to tomcat failed (unrecoverable), because of client write error (attempt=1)
[Sun Sep 04 03:36:02 2016]prd_live_svr cmsliv.com 39.879029
[Sun Sep 04 03:36:02 2016][13358:488081152] [info] jk_handler::mod_jk.c (2608): Aborting connection for worker=prd_live_svr

Errors Log:
[Sun Sep 04 09:32:00 2016] [debug] proxy_util.c(1921): proxy: worker proxy:reverse already initialized
[Sun Sep 04 09:32:00 2016] [debug] proxy_util.c(2017): proxy: initialized single connection worker 0 in child 24423 for (*)
[Sun Sep 04 09:54:24 2016] [debug] proxy_util.c(1901): proxy: grabbed scoreboard slot 0 in child 24513 for worker proxy:reverse
[Sun Sep 04 09:54:24 2016] [debug] proxy_util.c(1921): proxy: worker proxy:reverse already initialized
[Sun Sep 04 09:54:24 2016] [debug] proxy_util.c(2017): proxy: initialized single connection worker 0 in child 24513 for (*)
[Sun Sep 04 09:54:29 2016] [debug] proxy_util.c(1901): proxy: grabbed scoreboard slot 0 in child 24514 for worker proxy:reverse
[Sun Sep 04 09:54:29 2016] [debug] proxy_util.c(1921): proxy: worker proxy:reverse already initialized
[Sun Sep 04 09:54:29 2016] [debug] proxy_util.c(2017): proxy: initialized single connection worker 0 in child 24514 for (*)
[Sun Sep 04 10:01:48 2016] [debug] proxy_util.c(1901): proxy: grabbed scoreboard slot 0 in child 24563 for worker proxy:reverse
[Sun Sep 04 10:01:48 2016] [debug] proxy_util.c(1921): proxy: worker proxy:reverse already initialized
[Sun Sep 04 10:01:48 2016] [debug] proxy_util.c(2017): proxy: initialized single connection worker 0 in child 24563 for (*)


Configurations:
worker.list=prd_live_svr
worker.prd_live_svr.type=ajp13
worker.prd_live_svr.host=cmsliv
worker.prd_live_svr.port=9009

live.conf
<VirtualHost *:80>
ServerAlias cmsliv
    ErrorLog logs/live/http_error.log
    RewriteLog logs/live/http_rewrite.log
    CustomLog "|/opt/apps/apache/bin/rotatelogs -f  /opt/apps/apache/logs/live/http_access.log.%Y.%m.%d 86400 +60" imi
    RewriteEngine on
RewriteCond %{REMOTE_ADDR} !^10\.100\.116\.31$
DocumentRoot /opt/apps/opentext
RewriteRule ^/+$ /sites/  [R,L]
<IfModule rewrite_module>
Options +FollowSymlinks
RewriteEngine On
RewriteOptions Inherit 
#RewriteLogLevel 9
RewriteLog logs/rewrite.log
</IfModule>
JkMount   /*        prd_live_svr
</VirtualHost>

httpd.conf:
NameVirtualHost *:80
Include conf/qu/live.conf
Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15

<IfModule worker.c>
StartServers 6 
MaxClients 230 
MinSpareThreads 75 
MaxSpareThreads 150
ThreadsPerChild 25
MaxRequestsPerChild 0
</IfModule>


Kindly please help to resolve this issue.



-- 
Thanks & Regards,
Jayaram Ponnusamy 




Avast logo

This email has been checked for viruses by Avast antivirus software.
www.avast.com



-- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux