Automated migration for Tomcat 9 to 10

2022-05-02 Thread Chetna Agrawal
Hi,



I want to migrate my webapp from Java EE8 to Jakarta EE 9 in order to run it on 
tomcat 10.0.18. I want migration to happen after starting tomcat (runtime) by 
adding - , in  my context defined in 
server.xml. I am providing the value of Context path as /chetna and docbase as 
absolute path to my webapp's folder. On starting Tomcat, it is running fine and 
is not giving any error in logs but seems like it is not able to access my 
webapp folder. When trying to hit url - https://localhost/chetna, it is giving 
error 404. While when I run migration tool on my webapp explicitly and then use 
that migrated webapp's path in docbase, my app is running fine.



In changelog of Tomcat 10.0.3, it is given that - Allow the loader to directly 
use the Tomcat Migration Tool for JakartaEE as a ClassFileTransformer using the 
jakartaConverter attribute. This only supports javax to jakarta conversion for 
classes, not for classloader resources or static files.



Is there a way I can migrate my webapp at runtime while running it on tomcat 
10. Please let me know if I am doing something wrong in this method.



Regards,

Chetna Agrawal

Disclaimer: The information in this email is strictly confidential and may be 
legally privileged. If you are not the intended recipient, any use of this 
email or the information contained therein or disclosure or any action taken or 
omissions made including but not limited to copying, distribution or placing 
reliance on it, is expressly prohibited and may be unlawful. This email is 
intended solely for the addressee, access to this email by anyone else is 
unauthorized, the recipient is requested to notify Seclore and delete this 
email from their system immediately.


Trying to use Loom virtual threads with Tomcat

2022-05-02 Thread Cay Horstmann
Hi, I am trying to experiment with Loom 
(https://openjdk.java.net/jeps/425) virtual threads in Tomcat 10. There 
is a nice extension point in server.xml where I can provide an Executor 
and use it in the default Connector. It works like a charm--all my 
requests run on a virtual thread, and AFAIK, nothing else does.


There is just one issue. It takes forever for Tomcat to execute the 
virtual threads. I made a timestamp for each invocation of


public void execute(Runnable command)

called from org.apache.tomcat.util.net.AbstractEndpoint.processSocket

When I fire 1000 simultaneous requests, I can see that method being 
invoked 1000 times, but it takes a while to work through the requests. 
The last invocation occurs two minutes (!) from the sending of the requests.


When using the org.apache.catalina.core.StandardThreadExecutor, that 
many requests are handled in 3 seconds.


Is there something that I am overlooking? I had hoped that execute would 
be called near-instantly 1000 times, and then the Loom virtual threads 
could show their mettle and execute concurrently.


Thanks,

Cay

--

Cay S. Horstmann | http://horstmann.com | mailto:c...@horstmann.com

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



Re: Trying to use Loom virtual threads with Tomcat

2022-05-02 Thread Rémy Maucherat
On Tue, May 3, 2022 at 6:24 AM Cay Horstmann  wrote:
>
> Hi, I am trying to experiment with Loom
> (https://openjdk.java.net/jeps/425) virtual threads in Tomcat 10. There
> is a nice extension point in server.xml where I can provide an Executor
> and use it in the default Connector. It works like a charm--all my
> requests run on a virtual thread, and AFAIK, nothing else does.
>
> There is just one issue. It takes forever for Tomcat to execute the
> virtual threads. I made a timestamp for each invocation of
>
> public void execute(Runnable command)
>
> called from org.apache.tomcat.util.net.AbstractEndpoint.processSocket
>
> When I fire 1000 simultaneous requests, I can see that method being
> invoked 1000 times, but it takes a while to work through the requests.
> The last invocation occurs two minutes (!) from the sending of the requests.
>
> When using the org.apache.catalina.core.StandardThreadExecutor, that
> many requests are handled in 3 seconds.
>
> Is there something that I am overlooking? I had hoped that execute would
> be called near-instantly 1000 times, and then the Loom virtual threads
> could show their mettle and execute concurrently.

I wanted to experiment with Loom, but most likely the current Tomcat
NIO(2) connector is not nice for that. I was thinking that
resurrecting the java.io code (actually: writing a new java.io
connector) could be a slightly better plan, but to be honest I don't
expect very good results. I wasn't planning to do it immediately since
Loom is so experimental right now.

Rémy

> Thanks,
>
> Cay
>
> --
>
> Cay S. Horstmann | http://horstmann.com | mailto:c...@horstmann.com
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

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



Re: Trying to use Loom virtual threads with Tomcat

2022-05-02 Thread Cay Horstmann

Il 03/05/2022 07:25, Rémy Maucherat ha scritto:

On Tue, May 3, 2022 at 6:24 AM Cay Horstmann  wrote:


Hi, I am trying to experiment with Loom
(https://openjdk.java.net/jeps/425) virtual threads in Tomcat 10. There
is a nice extension point in server.xml where I can provide an Executor
and use it in the default Connector. It works like a charm--all my
requests run on a virtual thread, and AFAIK, nothing else does.

There is just one issue. It takes forever for Tomcat to execute the
virtual threads. I made a timestamp for each invocation of

public void execute(Runnable command)

called from org.apache.tomcat.util.net.AbstractEndpoint.processSocket

When I fire 1000 simultaneous requests, I can see that method being
invoked 1000 times, but it takes a while to work through the requests.
The last invocation occurs two minutes (!) from the sending of the requests.

When using the org.apache.catalina.core.StandardThreadExecutor, that
many requests are handled in 3 seconds.

Is there something that I am overlooking? I had hoped that execute would
be called near-instantly 1000 times, and then the Loom virtual threads
could show their mettle and execute concurrently.


I wanted to experiment with Loom, but most likely the current Tomcat
NIO(2) connector is not nice for that. I was thinking that
resurrecting the java.io code (actually: writing a new java.io
connector) could be a slightly better plan, but to be honest I don't
expect very good results. I wasn't planning to do it immediately since
Loom is so experimental right now.



Thanks for your fast response. I am wondering what issue you see with 
that connector. I am not changing the threading for the NIO part. Only 
when a socket is connected, a Loom thread is created.


I tried reading through the code of NioEndpoint/AbstractEndpoint (which 
I find on the call stack of the call to execute in my executor). I can't 
find anything that throttles the acceptance. I don't think that there 
would necessarily be a huge win with Loom, but I am baffled why it is 
doing so much worse.


Cheers,

Cay

--

Cay S. Horstmann | http://horstmann.com | mailto:c...@horstmann.com

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