You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jacob Rhoden <li...@jacobrhoden.com> on 2008/02/15 02:00:58 UTC

Performance of Native library

Hi,

Are there any web sites that show/compare the performance of a plain 
install vs adding the native libraries for tomcat? How many of you guys 
actually use the native libraries in production, ie is this common or 
uncommon?

Best Regards,
Jacob

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Performance of Native library

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jacob,

Jacob Rhoden wrote:
| Are there any web sites that show/compare the performance of a plain
| install vs adding the native libraries for tomcat? How many of you guys
| actually use the native libraries in production, ie is this common or
| uncommon?

Here's my anecdote: we do not use APR in production. But, we use Tomcat
neither for SSL nor static content, which is where APR would provide the
most performance gains. We are also a small service, and don't currently
have any performance problems.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.8 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAke1n4EACgkQ9CaO5/Lv0PD+gACfWgQGu7IjQUUue4MwVzHx7B+8
cDoAn0CFqPKskPY7mxH3RaRKj/w/AUeV
=Hcp6
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Performance of Native library

Posted by brien colwell <xc...@gmail.com>.
Yes, sorry for the phrasing.

On Thu, Feb 14, 2008 at 5:26 PM, Caldarale, Charles R
<Ch...@unisys.com> wrote:
> > From: brien colwell [mailto:xcolwell@gmail.com]
>  > Subject: Re: Performance of Native library
>
> >
>  > You have to use native to use non blocking sockets & the Comet
>  > architecture
>
>  Not true - the pure Java NIO connector in Tomcat 6 also does the above:
>  http://tomcat.apache.org/tomcat-6.0-doc/aio.html
>
>   - Chuck
>
>
>  THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>  MATERIAL and is thus for use only by the intended recipient. If you
>  received this in error, please contact the sender and delete the e-mail
>  and its attachments from all computers.
>
>
>
>  ---------------------------------------------------------------------
>  To start a new topic, e-mail: users@tomcat.apache.org
>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>  For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Performance of Native library

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: brien colwell [mailto:xcolwell@gmail.com] 
> Subject: Re: Performance of Native library
> 
> You have to use native to use non blocking sockets & the Comet
> architecture

Not true - the pure Java NIO connector in Tomcat 6 also does the above:
http://tomcat.apache.org/tomcat-6.0-doc/aio.html

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Performance of Native library

Posted by brien colwell <xc...@gmail.com>.
hi Jacob,

You have to use native to use non blocking sockets & the Comet
architecture, which lets the number of active HTTP connections scale
up beyond what blocking sockets would allow. I use the native lib for
Comet ...

Maybe this is a start ...
http://www.mail-archive.com/users@tomcat.apache.org/msg32491.html

Brien


On Thu, Feb 14, 2008 at 5:00 PM, Jacob Rhoden <li...@jacobrhoden.com> wrote:
> Hi,
>
>  Are there any web sites that show/compare the performance of a plain
>  install vs adding the native libraries for tomcat? How many of you guys
>  actually use the native libraries in production, ie is this common or
>  uncommon?
>
>  Best Regards,
>  Jacob
>
>  ---------------------------------------------------------------------
>  To start a new topic, e-mail: users@tomcat.apache.org
>  To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>  For additional commands, e-mail: users-help@tomcat.apache.org
>
>

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Performance of Native library

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: news [mailto:news@ger.gmane.org] On Behalf Of Bill Barker
> Subject: Re: Performance of Native library
> 
> But it really depends on how well your JVM provider has 
> implimented sendfile in NIO on your platform 

Hmmm... I guess that's me :-)

Thanks very much for the info.  Just wish I had the time to poke around
with it.

- Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Performance of Native library

Posted by Bill Barker <wb...@wilshire.com>.
"Caldarale, Charles R" <Ch...@unisys.com> wrote in message 
news:2828B04F0113CD468E6D1D51DF4362A404E79DAE@USEA-EXCH2.na.uis.unisys.com...
>> From: news [mailto:news@ger.gmane.org] On Behalf Of Bill Barker
>> Subject: Re: Performance of Native library
>
>Thanks for the insight (not just the snippet below).
>
>> If you serve a lot of large static files, then it is likely to
>> be faster on most OSs (due to being able to use sendfile).
>
>How does APR stack up against the NIO connector for sendfile usage since
>both support that mode?  Does the JNI transition penalty outweigh any
>gains of using native code?
>

Well, they will both have to use native code to access the sendfile system 
call ;).

I haven't benchmarked it myself (my sites tend to be mostly dynamic, with 
maybe a few small gifs), and haven't seen benchmarks posted on either here 
or dev@tomcat.  I'm guessing that in most cases it will be close to a tie 
(possibly NIO winning slightly).  But it really depends on how well your JVM 
provider has implimented sendfile in NIO on your platform (also how well 
Apache has done the same).  Sun has put in some backdoors in their JVM to 
allow native methods in the core Java code to avoid the hit (can't tell you, 
'couse I don't know, you'll have to checkout the source code and find out ;) 
.

But it will still probably depend on your app, so you should benchmark it 
yourself.  It is pretty easy to to with either ab or JMeter (depending on 
what you expect the access pattern to be:  ab if a single page requests lots 
of large files, JMeter if it is more like a slide-show with delays between 
requests).

> - Chuck
>
>
>THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
>MATERIAL and is thus for use only by the intended recipient. If you
>received this in error, please contact the sender and delete the e-mail
>and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org





---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: Performance of Native library

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: news [mailto:news@ger.gmane.org] On Behalf Of Bill Barker
> Subject: Re: Performance of Native library

Thanks for the insight (not just the snippet below).

> If you serve a lot of large static files, then it is likely to 
> be faster on most OSs (due to being able to use sendfile).

How does APR stack up against the NIO connector for sendfile usage since
both support that mode?  Does the JNI transition penalty outweigh any
gains of using native code?

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: Performance of Native library

Posted by Bill Barker <wb...@wilshire.com>.
"Jacob Rhoden" <li...@jacobrhoden.com> wrote in message 
news:47B4E44A.8010003@jacobrhoden.com...
> Hi,
>
> Are there any web sites that show/compare the performance of a plain 
> install vs adding the native libraries for tomcat? How many of you guys 
> actually use the native libraries in production, ie is this common or 
> uncommon?
>

Other than for comet support (which other people have answered), the answer 
is very heavily dependant on your OS and Java vendor, and what your app 
mainly serves.  For low-volume sites with mostly dynamic content it is 
likely to be a bit slower (since it is designed for high-volume sites).  If 
you serve a lot of large static files, then it is likely to be faster on 
most OSs (due to being able to use sendfile).  You get the biggest gain if 
you are running an older Linux kernal with lots of large static files on a 
moderate to high volume site.  You will still get a decent gain if you are 
running an older Linux kernal with mostly dynamic content.  I haven't seen 
hard figures on using the latest Linux kernal, but the gains will likely be 
smaller than with the older kernals.  On Windows, I think it is close to 
break-even for a dynamic site, but with static content you will gain.  On 
Solaris (with Sun's JVM) you will probably lose on a dynamic site.

Basically, what the native libraries give you is the ability to use sendfile 
to serve static files, and that there will usually be many fewer Threads 
blocking on reads.  The downside of using the native libraries is that the 
JNI boundry will cause a performance hit (at least with Sun's JVM).  So for 
a dynamic site, it pretty much comes down to which costs more:  Have 1000 
Threads blocking on reads before they timeout, or the JNI hit.  On Solaris, 
Windows, and newer Linuxes, the cost of 1000 Threads isn't all that high.
> Best Regards,
> Jacob
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
> 




---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org