multipart and Apache Tomcat 11

2025-05-01 Thread Ernesto Reinaldo Barreiro
Hi,

We have an Apache Wicket application that I just ported to wicket 10. The
application works as expected with the latest Tomcat 10.1.40. But our
application does not work with Tomcat 11.0.6 because file upload (multipart
processing is broken).

Apache wicket 10.x uses fileupload2.jakarta.servlet5 thus I create a branch
using fileupload2.jakarta.servlet6 (
https://mvnrepository.com/artifact/org.apache.commons/commons-fileupload2-jakarta-servlet6/2.0.0-M2)
thinking that might be the problem... But after some debugging the problem
seems to be in Http11InputBuffer and related classes (it seems the whole
package is very different from 10.x branch) or the way fileupload2 is using
them.

Has anyone experienced any similar problems?

-- 
Regards - Ernesto Reinaldo Barreiro


Re: What is a reasonable performance degradation?

2025-05-01 Thread Christopher Schultz

Rainer and Doug,

On 4/30/25 12:47 PM, Rainer Jung wrote:

Am 30.04.25 um 15:59 schrieb Doug Whitfield:

Hi folks,

This feature was added in 9.0.90:
The system property org.apache.catalina.connector.RECYCLE_FACADES will 
now default to true if not specified, which will in turn set the 
default value for the discardFacades connector attribute, thus causing 
facade objects to be discarded by default. (remm)


It makes sense that would cause some performance degradation. We are 
currently seeing *at least* a 5x increase in the number of 
connections. This doesn’t *seem* right, but maybe it is?


We’ve been able to reproduce this in 9.0.90 through 9.0.104. If we set 
RECYCLE_FACADES to false, then we get the performance we have come to 
expect.


I am trying to get some additional information from the performance 
team to see what exactly they are doing. Perhaps something needs to be 
updated in their code, but in the meantime wondering what others have 
seen and what folks think is a reasonable degradation.


Maybe your environment was already experiencing a high memory/GC 
pressure from object allocation. Then the additional allocations needed 
due to throwing away the objects instead of reusing them cloud have 
pushed the JVM over the border.


+1

The repeated allocations of these kinds of objects might be causing much 
more frequent GC activity, especially if you have a very high number of 
requests.


Performance bottlenecks often show non-linear behavior. As long as you 
stay away from the bottleneck you wont observe it, when you get close to 
it and above, it kills your throughput.


So when doing profiling etc. also check your for GC behavior and GC 
logs. Analyzing apps for performance problems while in fact you have a 
GC problem often feels like looking for an automotive engine problem 
while in fact you have your hand brakes put on.


I would enable GC logging if you haven't already done so, and then 
observe the situation both with and without recycling those facades.


Finally, remember that it's only the default that has changed. This 
change was done for security and container-protection reasons. If your 
application is well-behaved and you need that performance back, feel 
free to change the settings from the default.


-chris


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



Re: Help with Cluster Setup on Tomcat 9

2025-05-01 Thread Zoran Avtarovski

Thanks Chris,

I appreciate you input. In answer to your questions the primary issue we 
are experiencing is that on occasions (once a month or two) we will get 
two users on different nodes with the same session id. We suspect this 
could be because there is a short window from when tomcat creates a new 
session and when it is persisted to db which under heavy loads 
duplicates can be created.


We are keen to use DB based sessions and tomcat clustering but when we 
tried to start clustering tomcat threw a warning that clustering was not 
started because it doesn't support PersistentManager.


Finally, the ideal situation is for us to avoid the duplicate session 
ids. We have been discussing internally if we should drop persistent 
sessions as the clustering avoids the need for them and try just 
clustering as it may be a more reliable solution, but we are far from 
experts in this area.


Z.


On 26/4/2025 5:29 am, Christopher Schultz wrote:

Zoran,

On 4/24/25 4:21 AM, Zoran Avtarovski wrote:

Thanks Chuck,

I missed that and will implement. Bigger problem is that 
PersistentManager is incompatible with Clusters so we have to migrate 
back to memory based sessions and use clusters to share sessions.


I would have thought that cluster would be easier to support with DB 
based sessions. Does anyone know why they aren't supported?


What is the primary problem you are trying to solve? Are you trying to 
solve the problem of mixed-up sessions (which sounds very surprising 
to me that it happens, with the session identifier space being so big) 
or do you want to move to clustering anyway? It seems like you've 
decided that clustering is the solution to your problem and so now you 
have a new problem: how to implement clustering.


You can use both persistent sessions AND clustering if you want. It's 
how your sessions can survive a situation where all members of the 
cluster are stopped.


But it would be helpful if you would tell us your ideal situation and 
we can help you get there.


-chris


On 24/4/2025 11:20 am, Chuck Caldarale wrote:
On 2025 Apr 23, at 20:02, Zoran Avtarovski 
wrote:


We have a cluster of tomcat servers on AWS EC2 which operate behind 
an AWS load balancer with sticky sessions.


We have our session storage on a DB using a JDBC store which for 
the most part is working well, but we occasionally see duplicate 
session ids which create issues where a new session with a 
duplicate session id hijacks an existing session.


As you can imagine we would like to prevent this from occurring and 
have been looking into the issue. It looks like using the cluster 
tag might be the solution but I wanted to tap into the collective 
wisdom of the group on the best way forward. We can't just add the


| |

tag as it uses ip multicast which doesn't work in EC2 as there is 
no physical broadcast layer. The alternative appears to be to use 
the StaticMemebrshipService and I wanted to confirm if my config 
ideas are correct? I have the following setup:


className="org.apache.catalina.tribes.membership.StaticMembershipService">
    className="org.apache.catalina.tribes.membership.StaticMember"
  host="10.0.1.11" port="4004" 
uniqueId="{0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15}"/>
   className="org.apache.catalina.tribes.membership.StaticMember"
  host="10.0.1.12" port="4004" 
uniqueId="{1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1}"/>



Does this look right to others and do I need a separate Member tag 
for each member of the cluster?


I'd appreciate any assistance on this and other suggestions you 
guys may have.


Have you specified a unique jvmRoute attribute in the  
element of each Tomcat server?


https://tomcat.apache.org/tomcat-9.0-doc/config/ 
engine.html#Common_Attributes


   - Chuck