0
votes

I have a linux server (CentOS 7.4.1708) with Apache (Version 2.4.6) and Tomcat (Version 8.0.28) installed.

My clients connects to the HTML static content on Apache with port 443 (https).

They then call the WebRequest to tomcat with a proxypass rule using the AJP connector (protocol: AJP/1.3).

ProxyPass /MyJavaWebApp/ ajp://localhost:8009/MyJavaWebApp/

Everything works as expected but I experience performance issue when clients download files via a Download servlet in MyJavaWebApp.

// the core code of the servlet is the following
// I use org.apache.commons.io.IOUtils to copy the streams
IOUtils.copy(new FileInputStream(file), response.getOutputStream());

I need to use a servlet as the download access is secure and permission check must be done.

When they download a file, I can see an httpd process using nearly 100% of one core on my linux server. Then, if all cores are used by download request the server becomes really slow, obviously.

If the client download straight from tomcat bypassing Apache it's all good.

http://example.com:8080/MyJavaWebApp/DownloadAsset

That makes me think that the problem comes from the ProxyPass rules.

Is there a way to optimise ProxyPass rule for the download servlet?

If not, what kid of alternative should I use?

Thanks for you help.

1
You're omitting quite a lot of details - e.g. Apache httpd & modules version, virtual host configuration etc... It's impossible to give you any confirmation or hint, other than "try to reproduce on the latest available version". I've never seen the connector behave like this.Olaf Kock
So it might be a problem with my config then, as on my development computer it works fine indeed.Vespucci75fr

1 Answers

0
votes

I finally found a few weeks ago the reason of the High Cpu.

It was not related to tomcat or AJP as a simple file copy make my CPU getting high on my CentOS box but only for large files (above 2Go).

Hope it can help someone!