tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Costin Manolache <>
Subject Re: JK2 module for AOLserver
Date Thu, 21 Nov 2002 18:48:08 GMT
Alexander Leyke wrote:

>>The JNI channel is special because it is single-threaded ( a doors channel
>>will use the same type of code ), and that has some implications in
>>how the request is processed - but the data encoding is the same.
> Does it mean that in-process worker is a performance bottleneck in
> single-process server?

It seems we have a communication problem :-) - again I don't understand
what you are reffering to.

In jk1, the JNI worker had some performance problems - because it created
a lot of strings and made many (expensive) JNI calls. The ajp
and socket was optimized, but the JNI was not ( it would have required a lot 
of C code ).

In jk2, all those strings are eliminated ( from C side ), we also eliminate
the buffer allocation ( we reuse the same jbyteArray and C array, with
code to eventually support NIO - that cuts 2 memcpy and few other small
things ). We also reduce the number of JNI calls to a minimum ( or almost ).

Regarding the single-threaded behavior - I think this is a major benefit
for JNI ( or doors ) workers, since it can avoid thread switching and a lot
of synchronization. In all other protocol there are 2 threads sending data
to each other. This won't be visible for a small number of RPS, but 
I expect it to be important for very high loads. Well - most likely this
is just a benchmarking exercise - if the servlets are doing anything usefull
they'll dominate the execution time anyway, the connector overhead is 
already extremely small.

>>The JNI worker is working for IIS and Apache2, I see no reason why it
>>won't work with AOLserver. ( I suppose you're aware of the jk1 AOLserver
>>connector - it also used JNI, so you shouldn't have any major problems )
> I am aware of nstomcat module which works with Tomcat 3, but not Tomcat
> 4. There is  nothing of that nature  under
> jakarta-tomcat-connectors-4.1.12-src/jk/native. Should I look better?

You just need to port the nstomcat module to jk2. 

jk1 doesn't support tomcat4 in-process, jk2 does. From the connector
point of view it doesn't matter what tomcat is run ( at one point
it even detected the tomcat version at runtime - all it cares is to
have coyote/jk2 available and have a class with main() ).

>>Just get the socket to work ( it's easier to debug the server-specific
>>code), then enable the jni channel and worker.
> OK, as I am working on it, there are some Java errors from Tomcat
> startup within AOLserver. I can repeat those errors when running
> TomcatStarter class from shell command line.

Did you get the connector to work with sockets ? ( i.e tomcat out
of process ) ? That's the first step, you need this to work well
to test the aol-specific code. 

Nacho and Mladen are using the JNI code the most, but I suspect
with a different version of tomcat.

You can configure a different starter ( TomcatStarter did work 
with an older version of BootstrapService - now you can't use
the 4.1 version of BS without daemon ). You can probably try
to just configure it to use o.a.catalina.startup.Bootstrap.
( or a different starter with a main() )


> ::::::::::::::
> stderr.log
> ::::::::::::::
> TomcatStarter: main()
> Try  org.apache.tomcat.startup.Main
> Try  org.apache.catalina.startup.BootstrapService
> Starting org.apache.catalina.startup.BootstrapService
> java.lang.NullPointerException
>         at
>         at
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
>         at
> Created catalinaLoader in: /<deleted -
> AL>/jakarta-tomcat-4.1.12/server/lib
> [INFO] Registry - -Loading registry information
> [INFO] Registry - -Creating new Registry instance
> [INFO] Registry - -Creating MBeanServer
> [INFO] Http11Protocol - -Initializing Coyote HTTP/1.1 on port 8089
> java.lang.ArrayIndexOutOfBoundsException
>         at
>         at java.lang.reflect.Method.invoke(Native Method)
>         at
>         at
> java.lang.ArrayIndexOutOfBoundsException
>         at
>         at
> ::::::::::::::
> stdout.log
> ::::::::::::::
> Bootstrap: Starting service
> TomcatStarter: Done
> TomcatStarter: Done

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message