Re: Updating Tomcat native requires APR update

2016-06-30 Thread Ari Luoma
On Thu, Jun 30, 2016 at 8:49 AM, Ari Luoma wrote:
> On Wed, Jun 29, 2016 at 3:04 PM, Mark Thomas wrote:
>> On 29/06/2016 12:40, Ari Luoma wrote:
>>> First I would like to thank you for the great job you do by responding
>>> to these questions people have.
>>>
>>> I am about to update Tomcat 8.0.26 -> 8.5.3.
>>>
>>> I am using AJP APR connector between Tomcat and Apache.
>>>
>>> If I update APR (by downloading and compiling it from APR website) to
>>> the newest do I also need to compile httpd or can it use 1.3.9 APR
>>> with httpd when Tomcat uses 1.5.2?
>>
>> As long as you compile APR 1.5.2 to a separate location and don't
>> overwrite your APR 1.3.9 build you should be fine.
>>
>
> But even though if someone would overwrite the previous one it should
> be fine, because compiling later version?
>
> Binary Compatibility: "Similar to source compatibility, an application
> that has been compiled against a particular version will continue to
> be linkable against later versions (unless the major number changes).
> It is possible that an application will not be able to successfully
> link against a previous minor version."
> Source: http://apr.apache.org/versioning.html
>

But if I would override the original I would also need to update
OpenSSL because apr-util needs OpenSSL-1.0.2h for SSL support.
By not overriding I can leave apr util without SSL support

>>> Below more info about the current setup:
>>>
>>> One Server with: CentOS 6.3
>>> Apache HTTP Server 2.2.15 (installed from centos repo)
>>> Tomcat 8.0.26 (Installed by downloading tar.gz...)
>>> APR 1.3.9 (installed from centos repo and this is the newest version
>>> available from repo)
>>> Tomcat-native 1.1.33 (built from Tomcat directory)
>>>
>>> Server is running multiple Tomcats instances in different ports.
>>> httpd is there at front as a proxy with configuration something like this.
>>>
>>> Listen 443
>>> NameVirtualHost *:443
>>> 
>>> ...
>>>   
>>> ProxyPass ajp://localhost:8109/myWebApp/ timeout=3600
>>> ProxyPassReverseCookiePath /myWebApp /test
>>>   
>>> 
>>>
>>>
>>> Connector on Tomcat side:
>>> 
>>>
>>>
>>> #httpd -V
>>> Server version: Apache/2.2.15 (Unix)
>>> Server built:   Aug 13 2013 17:29:28
>>> Server's Module Magic Number: 20051115:25
>>> Server loaded:  APR 1.3.9, APR-Util 1.3.9
>>> Compiled using: APR 1.3.9, APR-Util 1.3.9
>>> ...
>>>
>>> When about to build the tomcat native 1.2.7 from Tomcat 8.5.3 it says:
>>> configure: error: Found APR 1.3.9. You need version 1.4.3 or newer 
>>> installed.
>>
>> Once you fix the APR issue, OpenSSL might be your next problem since
>> tomcat native requires OpenSSL 1.0.2. There are various solutions, the
>> simplest being to build Tomcat Native without OpenSSL support if you
>> don't need it.
>
> Thanks for that!
> Luckily I don't need the SSL support on Tomcat side, because httpd
> handles it and connection to manager goes through VPN so I can
> "downgrade" https connection into http.
>

Is tomcat_native library only used on APR connectors?
So that I (or someone else who happens to read this) could use
"org.apache.coyote.http11.Http11NioProtocol" for HTTPS and AJP APR for
httpd <-> Tomcat without SSL.
Are there any downsides for having both NIO and APR in use, like much
greater memory consumption?

>>
>> Mark
>>
>>
>> -
>> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
>> For additional commands, e-mail: users-h...@tomcat.apache.org
>>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Updating Tomcat native requires APR update

2016-06-29 Thread Ari Luoma
On Wed, Jun 29, 2016 at 3:04 PM, Mark Thomas wrote:
> On 29/06/2016 12:40, Ari Luoma wrote:
>> First I would like to thank you for the great job you do by responding
>> to these questions people have.
>>
>> I am about to update Tomcat 8.0.26 -> 8.5.3.
>>
>> I am using AJP APR connector between Tomcat and Apache.
>>
>> If I update APR (by downloading and compiling it from APR website) to
>> the newest do I also need to compile httpd or can it use 1.3.9 APR
>> with httpd when Tomcat uses 1.5.2?
>
> As long as you compile APR 1.5.2 to a separate location and don't
> overwrite your APR 1.3.9 build you should be fine.
>

But even though if someone would overwrite the previous one it should
be fine, because compiling later version?

Binary Compatibility: "Similar to source compatibility, an application
that has been compiled against a particular version will continue to
be linkable against later versions (unless the major number changes).
It is possible that an application will not be able to successfully
link against a previous minor version."
Source: http://apr.apache.org/versioning.html

>> Below more info about the current setup:
>>
>> One Server with: CentOS 6.3
>> Apache HTTP Server 2.2.15 (installed from centos repo)
>> Tomcat 8.0.26 (Installed by downloading tar.gz...)
>> APR 1.3.9 (installed from centos repo and this is the newest version
>> available from repo)
>> Tomcat-native 1.1.33 (built from Tomcat directory)
>>
>> Server is running multiple Tomcats instances in different ports.
>> httpd is there at front as a proxy with configuration something like this.
>>
>> Listen 443
>> NameVirtualHost *:443
>> 
>> ...
>>   
>> ProxyPass ajp://localhost:8109/myWebApp/ timeout=3600
>> ProxyPassReverseCookiePath /myWebApp /test
>>   
>> 
>>
>>
>> Connector on Tomcat side:
>> 
>>
>>
>> #httpd -V
>> Server version: Apache/2.2.15 (Unix)
>> Server built:   Aug 13 2013 17:29:28
>> Server's Module Magic Number: 20051115:25
>> Server loaded:  APR 1.3.9, APR-Util 1.3.9
>> Compiled using: APR 1.3.9, APR-Util 1.3.9
>> ...
>>
>> When about to build the tomcat native 1.2.7 from Tomcat 8.5.3 it says:
>> configure: error: Found APR 1.3.9. You need version 1.4.3 or newer installed.
>
> Once you fix the APR issue, OpenSSL might be your next problem since
> tomcat native requires OpenSSL 1.0.2. There are various solutions, the
> simplest being to build Tomcat Native without OpenSSL support if you
> don't need it.

Thanks for that!
Luckily I don't need the SSL support on Tomcat side, because httpd
handles it and connection to manager goes through VPN so I can
"downgrade" https connection into http.

>
> Mark
>
>
> -
> To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: users-h...@tomcat.apache.org
>

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Updating Tomcat native requires APR update

2016-06-29 Thread Ari Luoma
First I would like to thank you for the great job you do by responding
to these questions people have.

I am about to update Tomcat 8.0.26 -> 8.5.3.

I am using AJP APR connector between Tomcat and Apache.

If I update APR (by downloading and compiling it from APR website) to
the newest do I also need to compile httpd or can it use 1.3.9 APR
with httpd when Tomcat uses 1.5.2?


Below more info about the current setup:

One Server with: CentOS 6.3
Apache HTTP Server 2.2.15 (installed from centos repo)
Tomcat 8.0.26 (Installed by downloading tar.gz...)
APR 1.3.9 (installed from centos repo and this is the newest version
available from repo)
Tomcat-native 1.1.33 (built from Tomcat directory)

Server is running multiple Tomcats instances in different ports.
httpd is there at front as a proxy with configuration something like this.

Listen 443
NameVirtualHost *:443

...
  
ProxyPass ajp://localhost:8109/myWebApp/ timeout=3600
ProxyPassReverseCookiePath /myWebApp /test
  



Connector on Tomcat side:



#httpd -V
Server version: Apache/2.2.15 (Unix)
Server built:   Aug 13 2013 17:29:28
Server's Module Magic Number: 20051115:25
Server loaded:  APR 1.3.9, APR-Util 1.3.9
Compiled using: APR 1.3.9, APR-Util 1.3.9
...

When about to build the tomcat native 1.2.7 from Tomcat 8.5.3 it says:
configure: error: Found APR 1.3.9. You need version 1.4.3 or newer installed.


Best Regards,
Ari Luoma

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



Re: Tomcat - Multiple sites and SSL

2016-01-15 Thread Ari Luoma
Hi,

Try following. I can't guarantee it works with Jira and Confluence but this
could work.

Set up the cert in Apache and create AJP proxies between Apache and Tomcats
(if running one Tomcat for jira and one for confluence). I have similar
setup with other applications.

-Ari

15.1.2016 21.02 "Jeff Jennings" wrote:
>
> I will have two applications running on my tomcat server
>
> Jira on port 8080 and confluence on port 8090
>
> I'm going to get an ssl cert for the server which I'll call something like
> test.mysite.com
>
> Once I get my ssl cert for test.mysite.com how do I go about setting up
the
> configuration file for tomcat so that both sites can share the cert.
>
> I've been using regular apache for years and know how to do it with
virtual
> hosts in httpd.conf and ssl.conf but tomcat is new to me.
>
> any pointers would be appreciated.
>
> I'm thinking I'd like to map 8080 to something like test.mysite.com/jira
> and 8090 to test.mysite.com/confluence
>
> but I'm open to all ideas.
>
> I see tomcat want to use port 8443 for ssl
>
> I have read this page:
> https://tomcat.apache.org/tomcat-6.0-doc/ssl-howto.html but am unsure how
> to handle multiple apps on the same server that listen on different ports.
>
> thanks
>
> jeff


Re: why only 2 requests for async request can raise from a end-point?

2015-06-29 Thread Ari Luoma
Hi,

The number of concurrent connections is limited by the browser:
http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browse

Best Regards,
Ari Luoma


On Mon, Jun 29, 2015 at 12:08 PM, 许明  wrote:

 Hi,

 I am trying to bench async servlet, tomcat7 and tomcat8, now it's seems I
 can only start 2 request from a end-point.


 I make a simple tool, start 100 request same time, each request has own
 session, and write a simple async servlet, which pasted in the bottom of
 this mail.


 It's the result:


 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 1
 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 2
 06-29 16:29:02 633 DEBUG (Test.java:54)- timout and  print
 06-29 16:29:02 637 DEBUG (Test.java:54)- timout and  print
 06-29 16:29:02 642 INFO  (Test.java:35)- test serve 3
 06-29 16:29:02 677 INFO  (Test.java:35)- test serve 4
 06-29 16:29:12 647 DEBUG (Test.java:54)- timout and  print
 06-29 16:29:12 650 INFO  (Test.java:35)- test serve 5
 06-29 16:29:12 682 INFO  (Test.java:35)- test serve 6
 


 i have test this on tomcat7 and tomcat8 in windows and linux(ubuntu), and
 test it in browser manually.


 Best Regards


 ===
 my Test servlet:
 ===


 package com.botao.im;


 import java.io.IOException;
 import java.io.PrintWriter;
 import java.util.concurrent.Executors;
 import java.util.concurrent.ScheduledExecutorService;
 import java.util.concurrent.TimeUnit;


 import javax.servlet.AsyncContext;
 import javax.servlet.ServletException;
 import javax.servlet.annotation.WebServlet;
 import javax.servlet.http.HttpServlet;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;


 import org.apache.log4j.Logger;


 /**
  * Servlet implementation class Test
  */
 @WebServlet(asyncSupported = true, name = test, urlPatterns = { /test
 })
 public class Test extends HttpServlet {
 private static final long serialVersionUID = 1L;


 private static Logger logger = Logger.getLogger(Test.class);

 private static ScheduledExecutorService es =
 Executors.newSingleThreadScheduledExecutor();

 private static int counter = 0;

 protected void doGet(HttpServletRequest request, final
 HttpServletResponse response) throws ServletException, IOException {

 logger.info(test serve  + (++counter ));
 final AsyncContext context = request.startAsync();


 context.start(new Runnable() {

 @Override
 public void run() {
 context.setTimeout(100);
  es.schedule(new Runnable(){


 @Override
 public void run() {

 response.setContentType(text/plain);
 PrintWriter out;
 try {
 out =
 response.getWriter();

 out.print(hello);

 out.flush();

 context.complete();

 logger.debug(timout and  print);
 } catch
 (IOException e) {
 }

 }

  }, 10, TimeUnit.SECONDS);
 }
 });

 }




 }


Re: Also having issue on high CPU Usage on Tomcat 8

2015-06-15 Thread Ari Luoma
Hi,

Does anyone have any ideas how this issue with ajp-apr-poller could be
solved?

Using CATALINA_OPTS:
  -XX:+HeapDumpOnOutOfMemoryError
  -XX:HeapDumpPath=/xyz/HeapDump.log
  -Xms384m
  -Xmx1024m
  -XX:PermSize=128m
  -XX:MaxPermSize=512m
  -XX:+UseParallelGC
  -XX:MaxGCPauseMillis=1500
  -XX:GCTimeRatio=9
  -server
  -XX:+DisableExplicitGC

Using JAVA_OPTS:
  -Xloggc:/xyz/gc.log
  -XX:+PrintHeapAtGC
  -XX:+PrintGCDetails
  -XX:+PrintGCTimeStamps
  -XX:+PrintGCApplicationStoppedTime
  -XX:+PrintGCApplicationConcurrentTime
  -XX:-HeapDumpOnOutOfMemoryError

See also thread: High cpu on Tomcat 8
https://mail-archives.apache.org/mod_mbox/tomcat-users/201505.mbox/thread

Best regards,
Ari Luoma


On Wed, Jun 10, 2015 at 10:01 AM, Greg Huber  wrote:

 Ari,

 No, I could not find the cause.  I checked the source and there does not
 look like there was any changes in the polling code, so it maybe something
 else.  I changed to 7.0.62 with exactly the same startup scripts/jdk and
 the problem goes away.  It sometimes also happens on my dev box running
 jdk1.8.0_40/8.0.21 so its not just our production server.

 Maybe someone on the tomcat list can help?

 Cheers Greg


 On 9 June 2015 at 13:41, Ari Luoma wrote:

 Versions I am using:
 Tomcat: 8.0.9

 Java
 java version 1.7.0_65
 OpenJDK Runtime Environment (rhel-2.5.1.2.el6_5-x86_64 u65-b17)
 OpenJDK 64-Bit Server VM (build 24.65-b04, mixed mode)

 CentOS release 6.5

 I was just wondering if updating to 8.0.21 would help, but it seems that
 you are already using it.
 Comment on changelog of 8.0.21:  Numerous fixes to the APR/native
 connector to improve robustness. (markt)



 On Tue, Jun 9, 2015 at 3:25 PM, Ari Luoma  wrote:

 Hi,


 Did you find a solution for this?
 --
 First of all I wan't to say that I wasn't a tomcat-users subscriber and
 couldn't response directly to your question.
 --

 I am also experiencing this issue almost every day.
 Thread count rises from about 47 to 57 and CPU usage goes high even
 though there is no users using our software.

 I was also able to narrow it to ajp-apr-8009-Poller.

 When lookin it from jvisualvm it all the time changed from Wait to
 Running and back to Wait state.
 ...
 1:30:00.172: Running
  1:30:01.179: Wait
  1:30:02.171: Running
  1:30:05.251: Wait
  1:30:06.178: Running
  1:30:16.183: Wait
  1:30:17.183: Running
  1:30:21.186: Wait
 ...

 CPU usage was high for a couple of hours and then dropped back to zero
 and also thread count dropped back to normal.

 I am using CentOS and Tomcat native library.
 We have multiple Tomcat instances running on the same machine and this
 always happens concurrently on all of them.

 Best Regards,
 Ari Luoma